Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
Diffstat (limited to 'intern')
-rw-r--r--intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp3
-rw-r--r--intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp4
-rw-r--r--intern/audaspace/intern/AUD_C-API.cpp12
-rw-r--r--intern/audaspace/intern/AUD_C-API.h5
-rw-r--r--intern/audaspace/intern/AUD_FileFactory.cpp3
-rw-r--r--intern/audaspace/intern/AUD_NULLDevice.cpp4
-rw-r--r--intern/bsp/intern/BSP_MeshPrimitives.cpp4
-rw-r--r--intern/bsp/intern/CSG_BooleanOps.cpp4
-rw-r--r--intern/bsp/test/BSP_GhostTest/BSP_GhostTest3D.cpp4
-rw-r--r--intern/bsp/test/BSP_GhostTest/BSP_MeshDrawer.cpp4
-rw-r--r--intern/bsp/test/BSP_GhostTest/BSP_PlyLoader.cpp4
-rw-r--r--intern/bsp/test/BSP_GhostTest/main.cpp4
-rw-r--r--intern/bsp/test/BSP_GhostTest/plyfile.c4
-rw-r--r--intern/container/intern/CTR_List.cpp4
-rw-r--r--intern/decimation/intern/LOD_EdgeCollapser.cpp4
-rw-r--r--intern/decimation/intern/LOD_ExternNormalEditor.cpp4
-rw-r--r--intern/decimation/intern/LOD_FaceNormalEditor.cpp4
-rw-r--r--intern/decimation/intern/LOD_ManMesh2.cpp4
-rw-r--r--intern/decimation/intern/LOD_MeshPrimitives.cpp4
-rw-r--r--intern/decimation/intern/LOD_QSDecimator.cpp4
-rw-r--r--intern/decimation/intern/LOD_QuadricEditor.cpp4
-rw-r--r--intern/decimation/intern/LOD_decimation.cpp4
-rw-r--r--intern/elbeem/CMakeLists.txt2
-rw-r--r--intern/ghost/CMakeLists.txt93
-rw-r--r--intern/ghost/GHOST_C-api.h31
-rw-r--r--intern/ghost/GHOST_ISystem.h14
-rw-r--r--intern/ghost/GHOST_IWindow.h15
-rw-r--r--intern/ghost/GHOST_Path-api.h63
-rw-r--r--intern/ghost/SConscript3
-rw-r--r--intern/ghost/intern/GHOST_Buttons.cpp4
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp31
-rw-r--r--intern/ghost/intern/GHOST_CallbackEventConsumer.cpp4
-rw-r--r--intern/ghost/intern/GHOST_DisplayManager.cpp4
-rw-r--r--intern/ghost/intern/GHOST_DisplayManagerCarbon.cpp4
-rw-r--r--intern/ghost/intern/GHOST_DisplayManagerWin32.cpp4
-rw-r--r--intern/ghost/intern/GHOST_DisplayManagerX11.cpp4
-rw-r--r--intern/ghost/intern/GHOST_DropTargetWin32.cpp4
-rw-r--r--intern/ghost/intern/GHOST_EventManager.cpp4
-rw-r--r--intern/ghost/intern/GHOST_EventPrinter.cpp4
-rw-r--r--intern/ghost/intern/GHOST_ISystem.cpp4
-rw-r--r--intern/ghost/intern/GHOST_ModifierKeys.cpp4
-rw-r--r--intern/ghost/intern/GHOST_Path-api.cpp50
-rw-r--r--intern/ghost/intern/GHOST_Rect.cpp4
-rw-r--r--intern/ghost/intern/GHOST_System.cpp4
-rw-r--r--intern/ghost/intern/GHOST_System.h7
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.cpp22
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.h9
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.h18
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm570
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp42
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h13
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp77
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.h8
-rw-r--r--intern/ghost/intern/GHOST_TimerManager.cpp4
-rw-r--r--intern/ghost/intern/GHOST_Window.cpp6
-rw-r--r--intern/ghost/intern/GHOST_Window.h14
-rw-r--r--intern/ghost/intern/GHOST_WindowCarbon.cpp8
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.h19
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm594
-rw-r--r--intern/ghost/intern/GHOST_WindowManager.cpp4
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.cpp27
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.h3
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp13
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.h1
-rw-r--r--intern/ghost/intern/Makefile2
-rw-r--r--intern/ghost/make/msvc_9_0/ghost.vcproj14
-rw-r--r--intern/ghost/test/gears/GHOST_C-Test.c4
-rw-r--r--intern/ghost/test/gears/GHOST_Test.cpp4
-rw-r--r--intern/ghost/test/multitest/Basic.c4
-rw-r--r--intern/ghost/test/multitest/EventToBuf.c4
-rw-r--r--intern/ghost/test/multitest/MultiTest.c4
-rw-r--r--intern/ghost/test/multitest/ScrollBar.c4
-rw-r--r--intern/ghost/test/multitest/Util.c4
-rw-r--r--intern/ghost/test/multitest/WindowData.c4
-rw-r--r--intern/guardedalloc/MEM_guardedalloc.h28
-rw-r--r--intern/guardedalloc/intern/mallocn.c91
-rw-r--r--intern/guardedalloc/test/simpletest/memtest.c4
-rw-r--r--intern/iksolver/intern/IK_QSegment.cpp23
-rw-r--r--intern/iksolver/intern/TNT/svd.h10
-rw-r--r--intern/iksolver/test/ik_glut_test/common/GlutDrawer.cpp4
-rw-r--r--intern/iksolver/test/ik_glut_test/common/GlutKeyboardManager.cpp4
-rw-r--r--intern/iksolver/test/ik_glut_test/common/GlutMouseManager.cpp4
-rw-r--r--intern/iksolver/test/ik_glut_test/intern/main.cpp4
-rw-r--r--intern/itasc/Armature.cpp5
-rw-r--r--intern/memutil/intern/MEM_CacheLimiterC-Api.cpp4
-rw-r--r--intern/memutil/intern/MEM_RefCountedC-Api.cpp4
-rw-r--r--intern/moto/intern/MT_CmMatrix4x4.cpp4
-rw-r--r--intern/moto/intern/MT_Matrix3x3.cpp4
-rw-r--r--intern/moto/intern/MT_Matrix4x4.cpp4
-rw-r--r--intern/moto/intern/MT_Plane3.cpp4
-rw-r--r--intern/moto/intern/MT_Point3.cpp4
-rw-r--r--intern/moto/intern/MT_Quaternion.cpp4
-rw-r--r--intern/moto/intern/MT_Transform.cpp4
-rw-r--r--intern/moto/intern/MT_Vector2.cpp4
-rw-r--r--intern/moto/intern/MT_Vector3.cpp4
-rw-r--r--intern/moto/intern/MT_Vector4.cpp4
-rw-r--r--intern/moto/intern/MT_random.cpp4
-rw-r--r--intern/smoke/CMakeLists.txt2
-rw-r--r--intern/string/STR_String.h4
99 files changed, 1712 insertions, 479 deletions
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp
index f67c819ff10..8e71c97baec 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp
@@ -23,6 +23,9 @@
* ***** END LGPL LICENSE BLOCK *****
*/
+// needed for INT64_C
+#define __STDC_CONSTANT_MACROS
+
#include "AUD_FFMPEGFactory.h"
#include "AUD_FFMPEGReader.h"
#include "AUD_Buffer.h"
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
index 027ac015eb5..313ea52e892 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
@@ -67,12 +67,12 @@ int AUD_FFMPEGReader::decode(AVPacket* packet, AUD_Buffer* buffer)
audio_pkg_data,
audio_pkg_size);
- buf_pos += data_size;
-
// read error, next packet!
if(read_length < 0)
break;
+ buf_pos += data_size;
+
// move packet parameters
audio_pkg_data += read_length;
audio_pkg_size -= read_length;
diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp
index f7394e36c4d..8740f62c9a7 100644
--- a/intern/audaspace/intern/AUD_C-API.cpp
+++ b/intern/audaspace/intern/AUD_C-API.cpp
@@ -27,6 +27,11 @@
#include <cstring>
#include <cmath>
+#ifdef WITH_FFMPEG
+// needed for INT64_C
+#define __STDC_CONSTANT_MACROS
+#endif
+
#include "AUD_NULLDevice.h"
#include "AUD_I3DDevice.h"
#include "AUD_FileFactory.h"
@@ -62,6 +67,7 @@
#include "AUD_JackDevice.h"
#endif
+
#ifdef WITH_FFMPEG
extern "C" {
#include <libavformat/avformat.h>
@@ -84,11 +90,15 @@ static AUD_IDevice* AUD_device = NULL;
static int AUD_available_devices[4];
static AUD_I3DDevice* AUD_3ddevice = NULL;
-int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize)
+void AUD_initOnce()
{
#ifdef WITH_FFMPEG
av_register_all();
#endif
+}
+
+int AUD_init(AUD_DeviceType device, AUD_DeviceSpecs specs, int buffersize)
+{
AUD_IDevice* dev = NULL;
if(AUD_device)
diff --git a/intern/audaspace/intern/AUD_C-API.h b/intern/audaspace/intern/AUD_C-API.h
index a7372c29885..55aed02153f 100644
--- a/intern/audaspace/intern/AUD_C-API.h
+++ b/intern/audaspace/intern/AUD_C-API.h
@@ -56,6 +56,11 @@ typedef struct
#endif
/**
+ * Initializes FFMPEG if it is enabled.
+ */
+extern void AUD_initOnce();
+
+/**
* Initializes an audio device.
* \param device The device type that should be used.
* \param specs The audio specification to be used.
diff --git a/intern/audaspace/intern/AUD_FileFactory.cpp b/intern/audaspace/intern/AUD_FileFactory.cpp
index b63390803b1..5888479a0ba 100644
--- a/intern/audaspace/intern/AUD_FileFactory.cpp
+++ b/intern/audaspace/intern/AUD_FileFactory.cpp
@@ -29,6 +29,9 @@
#include <cstring>
#ifdef WITH_FFMPEG
+// needed for INT64_C
+#define __STDC_CONSTANT_MACROS
+
#include "AUD_FFMPEGReader.h"
#endif
#ifdef WITH_SNDFILE
diff --git a/intern/audaspace/intern/AUD_NULLDevice.cpp b/intern/audaspace/intern/AUD_NULLDevice.cpp
index 3936695c28f..c9dfadd1839 100644
--- a/intern/audaspace/intern/AUD_NULLDevice.cpp
+++ b/intern/audaspace/intern/AUD_NULLDevice.cpp
@@ -23,6 +23,8 @@
* ***** END LGPL LICENSE BLOCK *****
*/
+#include <limits>
+
#include "AUD_NULLDevice.h"
#include "AUD_IReader.h"
#include "AUD_IFactory.h"
@@ -76,7 +78,7 @@ bool AUD_NULLDevice::seek(AUD_Handle* handle, float position)
float AUD_NULLDevice::getPosition(AUD_Handle* handle)
{
- return 0.0f;
+ return std::numeric_limits<float>::quiet_NaN();
}
AUD_Status AUD_NULLDevice::getStatus(AUD_Handle* handle)
diff --git a/intern/bsp/intern/BSP_MeshPrimitives.cpp b/intern/bsp/intern/BSP_MeshPrimitives.cpp
index 16cca56622f..f77d353ec94 100644
--- a/intern/bsp/intern/BSP_MeshPrimitives.cpp
+++ b/intern/bsp/intern/BSP_MeshPrimitives.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "BSP_MeshPrimitives.h"
#include "MT_assert.h"
diff --git a/intern/bsp/intern/CSG_BooleanOps.cpp b/intern/bsp/intern/CSG_BooleanOps.cpp
index fc7eb5d14d7..dfc46dff85d 100644
--- a/intern/bsp/intern/CSG_BooleanOps.cpp
+++ b/intern/bsp/intern/CSG_BooleanOps.cpp
@@ -30,10 +30,6 @@
* Implementation of external api for CSG part of BSP lib interface.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "../extern/CSG_BooleanOps.h"
#include "BSP_CSGMesh_CFIterator.h"
#include "MEM_RefCountPtr.h"
diff --git a/intern/bsp/test/BSP_GhostTest/BSP_GhostTest3D.cpp b/intern/bsp/test/BSP_GhostTest/BSP_GhostTest3D.cpp
index 122eda99f66..7b0d144c5c7 100644
--- a/intern/bsp/test/BSP_GhostTest/BSP_GhostTest3D.cpp
+++ b/intern/bsp/test/BSP_GhostTest/BSP_GhostTest3D.cpp
@@ -31,10 +31,6 @@
* $Id$
* Copyright (C) 2001 NaN Technologies B.V.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#if defined(WIN32) || defined(__APPLE__)
# ifdef WIN32
# include <windows.h>
diff --git a/intern/bsp/test/BSP_GhostTest/BSP_MeshDrawer.cpp b/intern/bsp/test/BSP_GhostTest/BSP_MeshDrawer.cpp
index 39b18545f62..1d3be0b9ca4 100644
--- a/intern/bsp/test/BSP_GhostTest/BSP_MeshDrawer.cpp
+++ b/intern/bsp/test/BSP_GhostTest/BSP_MeshDrawer.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "BSP_MeshDrawer.h"
#include "BSP_TMesh.h"
diff --git a/intern/bsp/test/BSP_GhostTest/BSP_PlyLoader.cpp b/intern/bsp/test/BSP_GhostTest/BSP_PlyLoader.cpp
index 07f2503effd..9c0499a7977 100644
--- a/intern/bsp/test/BSP_GhostTest/BSP_PlyLoader.cpp
+++ b/intern/bsp/test/BSP_GhostTest/BSP_PlyLoader.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "BSP_PlyLoader.h"
#include "MT_Vector3.h"
diff --git a/intern/bsp/test/BSP_GhostTest/main.cpp b/intern/bsp/test/BSP_GhostTest/main.cpp
index 409334e1720..a03d85b25e9 100644
--- a/intern/bsp/test/BSP_GhostTest/main.cpp
+++ b/intern/bsp/test/BSP_GhostTest/main.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "BSP_GhostTest3D.h"
#include "BSP_TMesh.h"
diff --git a/intern/bsp/test/BSP_GhostTest/plyfile.c b/intern/bsp/test/BSP_GhostTest/plyfile.c
index 400b0f20ee7..aa0db15a334 100644
--- a/intern/bsp/test/BSP_GhostTest/plyfile.c
+++ b/intern/bsp/test/BSP_GhostTest/plyfile.c
@@ -67,10 +67,6 @@ WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#include <string.h>
#include "ply.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
char *type_names[] = {
"invalid",
"char", "short", "int",
diff --git a/intern/container/intern/CTR_List.cpp b/intern/container/intern/CTR_List.cpp
index fdb72082604..05090db97d9 100644
--- a/intern/container/intern/CTR_List.cpp
+++ b/intern/container/intern/CTR_List.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "CTR_List.h"
diff --git a/intern/decimation/intern/LOD_EdgeCollapser.cpp b/intern/decimation/intern/LOD_EdgeCollapser.cpp
index a5efe87b8b4..353ddbf363f 100644
--- a/intern/decimation/intern/LOD_EdgeCollapser.cpp
+++ b/intern/decimation/intern/LOD_EdgeCollapser.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "LOD_EdgeCollapser.h"
#include "LOD_ManMesh2.h"
diff --git a/intern/decimation/intern/LOD_ExternNormalEditor.cpp b/intern/decimation/intern/LOD_ExternNormalEditor.cpp
index 505970d583f..7130ff2a0d6 100644
--- a/intern/decimation/intern/LOD_ExternNormalEditor.cpp
+++ b/intern/decimation/intern/LOD_ExternNormalEditor.cpp
@@ -29,10 +29,6 @@
#include "LOD_ExternNormalEditor.h"
#include <vector>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
using namespace std;
diff --git a/intern/decimation/intern/LOD_FaceNormalEditor.cpp b/intern/decimation/intern/LOD_FaceNormalEditor.cpp
index 91183cbb59f..a6175bbb0c8 100644
--- a/intern/decimation/intern/LOD_FaceNormalEditor.cpp
+++ b/intern/decimation/intern/LOD_FaceNormalEditor.cpp
@@ -29,10 +29,6 @@
// implementation of LOD_FaceNormalEditor.h
///////////////////////////////////////
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "LOD_FaceNormalEditor.h"
using namespace std;
diff --git a/intern/decimation/intern/LOD_ManMesh2.cpp b/intern/decimation/intern/LOD_ManMesh2.cpp
index 7b1b5e15035..a48c8fe0db1 100644
--- a/intern/decimation/intern/LOD_ManMesh2.cpp
+++ b/intern/decimation/intern/LOD_ManMesh2.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "LOD_ManMesh2.h"
#include "MT_assert.h"
diff --git a/intern/decimation/intern/LOD_MeshPrimitives.cpp b/intern/decimation/intern/LOD_MeshPrimitives.cpp
index f7f6448e35e..5e5a9ec9fc4 100644
--- a/intern/decimation/intern/LOD_MeshPrimitives.cpp
+++ b/intern/decimation/intern/LOD_MeshPrimitives.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "LOD_MeshPrimitives.h"
#include "MT_assert.h"
diff --git a/intern/decimation/intern/LOD_QSDecimator.cpp b/intern/decimation/intern/LOD_QSDecimator.cpp
index d19096aead1..151f06d69fc 100644
--- a/intern/decimation/intern/LOD_QSDecimator.cpp
+++ b/intern/decimation/intern/LOD_QSDecimator.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "LOD_QSDecimator.h"
#include "LOD_ExternBufferEditor.h"
diff --git a/intern/decimation/intern/LOD_QuadricEditor.cpp b/intern/decimation/intern/LOD_QuadricEditor.cpp
index 27bf946ef73..7eb7f24ece4 100644
--- a/intern/decimation/intern/LOD_QuadricEditor.cpp
+++ b/intern/decimation/intern/LOD_QuadricEditor.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "LOD_QuadricEditor.h"
#include "LOD_ExternNormalEditor.h"
diff --git a/intern/decimation/intern/LOD_decimation.cpp b/intern/decimation/intern/LOD_decimation.cpp
index 12d558d5189..69fb018df98 100644
--- a/intern/decimation/intern/LOD_decimation.cpp
+++ b/intern/decimation/intern/LOD_decimation.cpp
@@ -27,10 +27,6 @@
*/
// implementation of external c api
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "../extern/LOD_decimation.h"
#include "LOD_DecimationClass.h"
diff --git a/intern/elbeem/CMakeLists.txt b/intern/elbeem/CMakeLists.txt
index f0c71e067fc..e45a210bd88 100644
--- a/intern/elbeem/CMakeLists.txt
+++ b/intern/elbeem/CMakeLists.txt
@@ -24,7 +24,7 @@
#
# ***** END GPL LICENSE BLOCK *****
-SET(INC ${ZLIB_INC} ${PNG_INC} extern)
+SET(INC ${PNG_INC} ${ZLIB_INC} extern)
FILE(GLOB SRC intern/*.cpp)
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index ba62bcb8e4b..1a7627c9099 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -24,57 +24,68 @@
#
# ***** END GPL LICENSE BLOCK *****
-SET(INC . ../string ../../extern/glew/include ../../source/blender/imbuf ../../source/blender/makesdna)
+SET(INC
+ .
+ ../string
+ ../../extern/glew/include
+ ../../source/blender/imbuf
+ ../../source/blender/makesdna
+)
-FILE(GLOB SRC intern/*.cpp intern/*.mm)
+SET(SRC
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_Buttons.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_CallbackEventConsumer.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_C-api.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManager.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_EventManager.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_EventPrinter.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_ISystem.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_ModifierKeys.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_NDOFManager.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_Path-api.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_Rect.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_System.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_TimerManager.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_Window.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowManager.cpp
+)
IF(APPLE)
IF(WITH_COCOA)
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCarbon.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCarbon.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCarbon.cpp")
+ SET(SRC ${SRC}
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCocoa.mm
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCocoa.mm
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCocoa.mm
+ )
ELSE(WITH_COCOA)
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCocoa.mm")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCocoa.mm")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCocoa.mm")
+ SET(SRC ${SRC}
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCarbon.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCarbon.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCarbon.cpp
+ )
ENDIF(WITH_COCOA)
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerWin32.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemWin32.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowWin32.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DropTargetWin32.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerX11.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemX11.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowX11.cpp")
IF(WITH_QUICKTIME)
ADD_DEFINITIONS(-DWITH_QUICKTIME)
ENDIF(WITH_QUICKTIME)
-ELSE(APPLE)
- IF(WIN32)
- SET(INC ${INC} ${WINTAB_INC})
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCarbon.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCarbon.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCarbon.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCocoa.mm")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCocoa.mm")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCocoa.mm")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerX11.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemX11.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowX11.cpp")
- ELSE(WIN32)
- SET(INC ${INC} ${X11_X11_INCLUDE_PATH})
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerWin32.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DropTargetWin32.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemWin32.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowWin32.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCarbon.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCarbon.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCarbon.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCocoa.mm")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCocoa.mm")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCocoa.mm")
- ENDIF(WIN32)
+ELSEIF(WIN32)
+ SET(INC ${INC} ${WINTAB_INC})
+
+ SET(SRC ${SRC}
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerWin32.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemWin32.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowWin32.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DropTargetWin32.cpp
+ )
+ELSEIF(UNIX)
+ SET(INC ${INC} ${X11_X11_INCLUDE_PATH})
+
+ SET(SRC ${SRC}
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerX11.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemX11.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowX11.cpp
+ )
ENDIF(APPLE)
BLENDERLIB(bf_ghost "${SRC}" "${INC}")
-#, libtype=['core','player'], priority = [25,15] )
+
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 346fa292520..28fa72f9700 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -264,7 +264,24 @@ extern int GHOST_DispatchEvents(GHOST_SystemHandle systemhandle);
extern GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle,
GHOST_EventConsumerHandle consumerhandle);
+/***************************************************************************************
+ ** Progress bar functionality
+ ***************************************************************************************/
+/**
+ * Sets the progress bar value displayed in the window/application icon
+ * @param windowhandle The handle to the window
+ * @param progress The progress % (0.0 to 1.0)
+ */
+extern GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle, float progress);
+
+/**
+ * Hides the progress bar in the icon
+ * @param windowhandle The handle to the window
+ */
+extern GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle);
+
+
/***************************************************************************************
** N-degree of freedom device management functionality
***************************************************************************************/
@@ -819,20 +836,6 @@ extern GHOST_TUns8* GHOST_getClipboard(int selection);
*/
extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
-/**
- * Determine the base dir in which shared resources are located. It will first try to use
- * "unpack and run" path, then look for properly installed path, not including versioning.
- * @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
- */
-extern const GHOST_TUns8* GHOST_getSystemDir();
-
-/**
- * Determine the base dir in which user configuration is stored, not including versioning.
- * If needed, it will create the base directory.
- * @return Unsigned char string pointing to user dir (eg ~/.blender/).
- */
-extern const GHOST_TUns8* GHOST_getUserDir();
-
#ifdef __cplusplus
}
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index fd8641f2055..47f142e4c8a 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -331,7 +331,7 @@ public:
* @param y The y-coordinate of the cursor.
* @return Indication of success.
*/
- virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const = 0;
+ virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) = 0;
/***************************************************************************************
** Access to mouse button and keyboard states.
@@ -370,12 +370,7 @@ public:
*/
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
-
- /***************************************************************************************
- ** Determine special paths.
- ***************************************************************************************/
-
- /**
+ /**
* Determine the base dir in which shared resources are located. It will first try to use
* "unpack and run" path, then look for properly installed path, not including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
@@ -389,6 +384,11 @@ public:
*/
virtual const GHOST_TUns8* getUserDir() const = 0;
+ /**
+ * Determine the directory of the current binary
+ * @return Unsigned char string pointing to the binary dir
+ */
+ virtual const GHOST_TUns8* getBinaryDir() const = 0;
protected:
/**
* Initialize the system.
diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index a024b2b51e5..83757b17e8b 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -235,6 +235,21 @@ public:
virtual const GHOST_TabletData* GetTabletData() = 0;
/***************************************************************************************
+ ** Progress bar functionality
+ ***************************************************************************************/
+
+ /**
+ * Sets the progress bar value displayed in the window/application icon
+ * @param progress The progress %
+ */
+ virtual GHOST_TSuccess setProgressBar(float progress) = 0;
+
+ /**
+ * Hides the progress bar in the icon
+ */
+ virtual GHOST_TSuccess endProgressBar() = 0;
+
+ /***************************************************************************************
** Cursor management functionality
***************************************************************************************/
diff --git a/intern/ghost/GHOST_Path-api.h b/intern/ghost/GHOST_Path-api.h
new file mode 100644
index 00000000000..c38a4e2de88
--- /dev/null
+++ b/intern/ghost/GHOST_Path-api.h
@@ -0,0 +1,63 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2010 by Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef GHOST_PATH_API_H
+#define GHOST_PATH_API_H
+
+#include "GHOST_Types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Determine the base dir in which shared resources are located. It will first try to use
+ * "unpack and run" path, then look for properly installed path, not including versioning.
+ * @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
+ */
+extern const GHOST_TUns8* GHOST_getSystemDir();
+
+/**
+ * Determine the base dir in which user configuration is stored, not including versioning.
+ * @return Unsigned char string pointing to user dir (eg ~).
+ */
+extern const GHOST_TUns8* GHOST_getUserDir();
+
+
+/**
+ * Determine the dir in which the binary file is found.
+ * @return Unsigned char string pointing to binary dir (eg ~/usr/local/bin/).
+ */
+extern const GHOST_TUns8* GHOST_getBinaryDir();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/intern/ghost/SConscript b/intern/ghost/SConscript
index 1269c631190..65c00b16373 100644
--- a/intern/ghost/SConscript
+++ b/intern/ghost/SConscript
@@ -56,9 +56,8 @@ else:
if env['BF_GHOST_DEBUG']:
defs.append('BF_GHOST_DEBUG')
-
+
incs = '. ../string #extern/glew/include #source/blender/imbuf #source/blender/makesdna ' + env['BF_OPENGL_INC']
if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'):
incs = env['BF_WINTAB_INC'] + ' ' + incs
env.BlenderLib ('bf_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15] )
-
diff --git a/intern/ghost/intern/GHOST_Buttons.cpp b/intern/ghost/intern/GHOST_Buttons.cpp
index 01f65103766..edccb24d5a1 100644
--- a/intern/ghost/intern/GHOST_Buttons.cpp
+++ b/intern/ghost/intern/GHOST_Buttons.cpp
@@ -28,10 +28,6 @@
#include "GHOST_Buttons.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
GHOST_Buttons::GHOST_Buttons()
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 51305e82064..839d85c9617 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -37,10 +37,6 @@
#include <stdlib.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "intern/GHOST_Debug.h"
#include "GHOST_C-api.h"
#include "GHOST_ISystem.h"
@@ -252,6 +248,21 @@ GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_Eve
return system->addEventConsumer((GHOST_CallbackEventConsumer*)consumerhandle);
}
+GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle,float progress)
+{
+ GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
+
+ return window->setProgressBar(progress);
+}
+
+GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle)
+{
+ GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
+
+ return window->endProgressBar();
+}
+
+
int GHOST_OpenNDOF(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle,
GHOST_NDOFLibraryInit_fp setNdofLibraryInit,
GHOST_NDOFLibraryShutdown_fp setNdofLibraryShutdown,
@@ -854,15 +865,3 @@ void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection)
GHOST_ISystem* system = GHOST_ISystem::getSystem();
system->putClipboard(buffer, selection);
}
-
-const GHOST_TUns8* GHOST_getSystemDir()
-{
- GHOST_ISystem* system = GHOST_ISystem::getSystem();
- return system->getSystemDir();
-}
-
-const GHOST_TUns8* GHOST_getUserDir()
-{
- GHOST_ISystem* system = GHOST_ISystem::getSystem();
- return system->getUserDir();
-}
diff --git a/intern/ghost/intern/GHOST_CallbackEventConsumer.cpp b/intern/ghost/intern/GHOST_CallbackEventConsumer.cpp
index af3534fcc38..7f5ed859de1 100644
--- a/intern/ghost/intern/GHOST_CallbackEventConsumer.cpp
+++ b/intern/ghost/intern/GHOST_CallbackEventConsumer.cpp
@@ -34,10 +34,6 @@
* @date October 25, 2001
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GHOST_Debug.h"
#include "GHOST_C-api.h"
#include "GHOST_CallbackEventConsumer.h"
diff --git a/intern/ghost/intern/GHOST_DisplayManager.cpp b/intern/ghost/intern/GHOST_DisplayManager.cpp
index c65914ef1ac..eaa00732725 100644
--- a/intern/ghost/intern/GHOST_DisplayManager.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManager.cpp
@@ -32,10 +32,6 @@
* @date September 21, 2001
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GHOST_DisplayManager.h"
#include "GHOST_Debug.h"
diff --git a/intern/ghost/intern/GHOST_DisplayManagerCarbon.cpp b/intern/ghost/intern/GHOST_DisplayManagerCarbon.cpp
index 76291a2ea4c..2c92ef0e2fa 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerCarbon.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManagerCarbon.cpp
@@ -34,10 +34,6 @@
* @date September 21, 2001
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GHOST_DisplayManagerCarbon.h"
#include "GHOST_Debug.h"
diff --git a/intern/ghost/intern/GHOST_DisplayManagerWin32.cpp b/intern/ghost/intern/GHOST_DisplayManagerWin32.cpp
index 7c9a905ff43..29d15d3e4de 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerWin32.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManagerWin32.cpp
@@ -34,10 +34,6 @@
* @date September 21, 2001
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GHOST_DisplayManagerWin32.h"
#include "GHOST_Debug.h"
diff --git a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
index 0c0a0daebc7..fad3149e48c 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GHOST_DisplayManagerX11.h"
#include "GHOST_SystemX11.h"
diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.cpp b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
index c2185ae9b23..6470b406492 100644
--- a/intern/ghost/intern/GHOST_DropTargetWin32.cpp
+++ b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
@@ -110,8 +110,8 @@ ULONG __stdcall GHOST_DropTargetWin32::Release(void)
*/
HRESULT __stdcall GHOST_DropTargetWin32::DragEnter(IDataObject * pDataObject, DWORD grfKeyState, POINTL pt, DWORD * pdwEffect)
{
- // we don't know yet if we accept the drop.
- m_window->setAcceptDragOperation(false);
+ // we accept all drop by default
+ m_window->setAcceptDragOperation(true);
*pdwEffect = DROPEFFECT_NONE;
m_draggedObjectType = getGhostType(pDataObject);
diff --git a/intern/ghost/intern/GHOST_EventManager.cpp b/intern/ghost/intern/GHOST_EventManager.cpp
index d9cdfe6faa2..0eeb2245cd0 100644
--- a/intern/ghost/intern/GHOST_EventManager.cpp
+++ b/intern/ghost/intern/GHOST_EventManager.cpp
@@ -38,10 +38,6 @@
#include <algorithm>
#include "GHOST_Debug.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
GHOST_EventManager::GHOST_EventManager()
{
diff --git a/intern/ghost/intern/GHOST_EventPrinter.cpp b/intern/ghost/intern/GHOST_EventPrinter.cpp
index 9bb1532c947..645a33ab8c5 100644
--- a/intern/ghost/intern/GHOST_EventPrinter.cpp
+++ b/intern/ghost/intern/GHOST_EventPrinter.cpp
@@ -36,10 +36,6 @@
#include "GHOST_EventDragnDrop.h"
#include "GHOST_Debug.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
bool GHOST_EventPrinter::processEvent(GHOST_IEvent* event)
{
diff --git a/intern/ghost/intern/GHOST_ISystem.cpp b/intern/ghost/intern/GHOST_ISystem.cpp
index 1a8bf3d3e84..eecf3c51c19 100644
--- a/intern/ghost/intern/GHOST_ISystem.cpp
+++ b/intern/ghost/intern/GHOST_ISystem.cpp
@@ -34,10 +34,6 @@
* @date May 7, 2001
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GHOST_ISystem.h"
#ifdef WIN32
diff --git a/intern/ghost/intern/GHOST_ModifierKeys.cpp b/intern/ghost/intern/GHOST_ModifierKeys.cpp
index 75bd22cada1..ed884966cb3 100644
--- a/intern/ghost/intern/GHOST_ModifierKeys.cpp
+++ b/intern/ghost/intern/GHOST_ModifierKeys.cpp
@@ -34,10 +34,6 @@
* @date May 31, 2001
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GHOST_ModifierKeys.h"
diff --git a/intern/ghost/intern/GHOST_Path-api.cpp b/intern/ghost/intern/GHOST_Path-api.cpp
new file mode 100644
index 00000000000..b2b7c68e998
--- /dev/null
+++ b/intern/ghost/intern/GHOST_Path-api.cpp
@@ -0,0 +1,50 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2010 by Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "intern/GHOST_Debug.h"
+#include "GHOST_Path-api.h"
+#include "GHOST_ISystem.h"
+
+const GHOST_TUns8* GHOST_getSystemDir()
+{
+ GHOST_ISystem* system = GHOST_ISystem::getSystem();
+ return system ? system->getSystemDir() : NULL;
+}
+
+const GHOST_TUns8* GHOST_getUserDir()
+{
+ GHOST_ISystem* system = GHOST_ISystem::getSystem();
+ return system ? system->getUserDir() : NULL; /* will be NULL in background mode */
+}
+
+const GHOST_TUns8* GHOST_getBinaryDir()
+{
+ GHOST_ISystem* system = GHOST_ISystem::getSystem();
+ return system ? system->getBinaryDir() : NULL; /* will be NULL in background mode */
+}
diff --git a/intern/ghost/intern/GHOST_Rect.cpp b/intern/ghost/intern/GHOST_Rect.cpp
index bb42d89425d..aa6491cf5e5 100644
--- a/intern/ghost/intern/GHOST_Rect.cpp
+++ b/intern/ghost/intern/GHOST_Rect.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GHOST_Rect.h"
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp
index dc7d1ddfb91..c89534e01c5 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -34,10 +34,6 @@
* @date May 7, 2001
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GHOST_System.h"
#include <time.h>
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index d6c6a356323..a18670738fe 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -297,7 +297,7 @@ public:
*/
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
- /**
+ /**
* Determine the base dir in which shared resources are located. It will first try to use
* "unpack and run" path, then look for properly installed path, not including versioning.
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
@@ -311,6 +311,11 @@ public:
*/
virtual const GHOST_TUns8* getUserDir() const = 0;
+ /**
+ * Determine the directory of the current binary
+ * @return Unsigned char string pointing to the binary dir
+ */
+ virtual const GHOST_TUns8* getBinaryDir() const = 0;
protected:
/**
* Initialize the system.
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
index 36ea1c7fe85..ecdc03b4347 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp
@@ -531,7 +531,7 @@ GHOST_TSuccess GHOST_SystemCarbon::getCursorPosition(GHOST_TInt32& x, GHOST_TInt
}
-GHOST_TSuccess GHOST_SystemCarbon::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const
+GHOST_TSuccess GHOST_SystemCarbon::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
{
float xf=(float)x, yf=(float)y;
@@ -1215,9 +1215,10 @@ void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, bool selection) const
}
}
+
const GHOST_TUns8* GHOST_SystemCarbon::getSystemDir() const
{
- return (GHOST_TUns8*)"/Library/Application Support/Blender";
+ return (GHOST_TUns8*)"/Library/Application Support";
}
const GHOST_TUns8* GHOST_SystemCarbon::getUserDir() const
@@ -1228,9 +1229,24 @@ const GHOST_TUns8* GHOST_SystemCarbon::getUserDir() const
if (env) {
strncpy(usrPath, env, 245);
usrPath[245]=0;
- strcat(usrPath, "/Library/Application Support/Blender");
+ strcat(usrPath, "/Library/Application Support");
return (GHOST_TUns8*) usrPath;
}
else
return NULL;
}
+
+const GHOST_TUns8* GHOST_SystemCarbon::getBinaryDir() const
+{
+ CFURLRef bundleURL;
+ CFStringRef pathStr;
+ static char path[256];
+ CFBundleRef mainBundle = CFBundleGetMainBundle();
+
+ bundleURL = CFBundleCopyBundleURL(mainBundle);
+ pathStr = CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle);
+ CFStringGetCString(pathStr, path, 255, kCFStringEncodingASCII);
+ CFRelease(pathStr);
+ CFRelease(bundleURL);
+ return (GHOST_TUns8*)path;
+}
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.h b/intern/ghost/intern/GHOST_SystemCarbon.h
index 7f0870674b4..723652dc872 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.h
+++ b/intern/ghost/intern/GHOST_SystemCarbon.h
@@ -156,7 +156,7 @@ public:
* @param y The y-coordinate of the cursor.
* @return Indication of success.
*/
- virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const;
+ virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
/***************************************************************************************
** Access to mouse button and keyboard states.
@@ -190,6 +190,7 @@ public:
*/
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
+
/**
* Determine the base dir in which shared resources are located. It will first try to use
* "unpack and run" path, then look for properly installed path, not including versioning.
@@ -204,6 +205,12 @@ public:
*/
virtual const GHOST_TUns8* getUserDir() const;
+ /**
+ * Determine the directory of the current binary
+ * @return Unsigned char string pointing to the binary dir
+ */
+ virtual const GHOST_TUns8* getBinaryDir() const;
+
protected:
/**
* Initializes the system.
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index 55d317cea1f..56b4ceeedf7 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -179,8 +179,8 @@ public:
* @param y The y-coordinate of the cursor.
* @return Indication of success.
*/
- virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const;
-
+ virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
+
/***************************************************************************************
** Access to mouse button and keyboard states.
***************************************************************************************/
@@ -228,6 +228,12 @@ public:
virtual const GHOST_TUns8* getUserDir() const;
/**
+ * Determine the directory of the current binary
+ * @return Unsigned char string pointing to the binary dir
+ */
+ virtual const GHOST_TUns8* getBinaryDir() const;
+
+ /**
* Handles a window event. Called by GHOST_WindowCocoa window delegate
* @param eventType The type of window event
* @param window The window on which the event occured
@@ -272,6 +278,14 @@ protected:
*/
GHOST_TSuccess handleKeyEvent(void *eventPtr);
+ /**
+ * Performs the actual cursor position update (location in screen coordinates).
+ * @param x The x-coordinate of the cursor.
+ * @param y The y-coordinate of the cursor.
+ * @return Indication of success.
+ */
+ GHOST_TSuccess setMouseCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
+
/** Start time at initialization. */
GHOST_TUns64 m_start_time;
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index a5ee257bcd4..a3089a76ece 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+<<<<<<< .working
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
@@ -41,9 +42,41 @@
#include "GHOST_EventCursor.h"
#include "GHOST_EventWheel.h"
#include "GHOST_EventNDOF.h"
+=======
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Maarten Gribnau 05/2001
+ * Damien Plisson 09/2009
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#import <Cocoa/Cocoa.h>
+
+/*For the currently not ported to Cocoa keyboard layout functions (64bit & 10.6 compatible)*/
+#include <Carbon/Carbon.h>
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
+#include "GHOST_SystemCocoa.h"
+
+#include "GHOST_DisplayManagerCocoa.h"
+#include "GHOST_EventKey.h"
+#include "GHOST_EventButton.h"
+#include "GHOST_EventCursor.h"
+#include "GHOST_EventWheel.h"
+#include "GHOST_EventNDOF.h"
+>>>>>>> .merge-right.r30358
#include "GHOST_EventTrackpad.h"
#include "GHOST_EventDragnDrop.h"
#include "GHOST_EventString.h"
+<<<<<<< .working
#include "GHOST_TimerManager.h"
#include "GHOST_TimerTask.h"
@@ -376,6 +409,381 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar)
}
+=======
+
+#include "GHOST_TimerManager.h"
+#include "GHOST_TimerTask.h"
+#include "GHOST_WindowManager.h"
+#include "GHOST_WindowCocoa.h"
+#include "GHOST_NDOFManager.h"
+#include "AssertMacros.h"
+
+#pragma mark KeyMap, mouse converters
+#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
+/* Keycodes not defined in Tiger */
+/*
+ * Summary:
+ * Virtual keycodes
+ *
+ * Discussion:
+ * These constants are the virtual keycodes defined originally in
+ * Inside Mac Volume V, pg. V-191. They identify physical keys on a
+ * keyboard. Those constants with "ANSI" in the name are labeled
+ * according to the key position on an ANSI-standard US keyboard.
+ * For example, kVK_ANSI_A indicates the virtual keycode for the key
+ * with the letter 'A' in the US keyboard layout. Other keyboard
+ * layouts may have the 'A' key label on a different physical key;
+ * in this case, pressing 'A' will generate a different virtual
+ * keycode.
+ */
+enum {
+ kVK_ANSI_A = 0x00,
+ kVK_ANSI_S = 0x01,
+ kVK_ANSI_D = 0x02,
+ kVK_ANSI_F = 0x03,
+ kVK_ANSI_H = 0x04,
+ kVK_ANSI_G = 0x05,
+ kVK_ANSI_Z = 0x06,
+ kVK_ANSI_X = 0x07,
+ kVK_ANSI_C = 0x08,
+ kVK_ANSI_V = 0x09,
+ kVK_ANSI_B = 0x0B,
+ kVK_ANSI_Q = 0x0C,
+ kVK_ANSI_W = 0x0D,
+ kVK_ANSI_E = 0x0E,
+ kVK_ANSI_R = 0x0F,
+ kVK_ANSI_Y = 0x10,
+ kVK_ANSI_T = 0x11,
+ kVK_ANSI_1 = 0x12,
+ kVK_ANSI_2 = 0x13,
+ kVK_ANSI_3 = 0x14,
+ kVK_ANSI_4 = 0x15,
+ kVK_ANSI_6 = 0x16,
+ kVK_ANSI_5 = 0x17,
+ kVK_ANSI_Equal = 0x18,
+ kVK_ANSI_9 = 0x19,
+ kVK_ANSI_7 = 0x1A,
+ kVK_ANSI_Minus = 0x1B,
+ kVK_ANSI_8 = 0x1C,
+ kVK_ANSI_0 = 0x1D,
+ kVK_ANSI_RightBracket = 0x1E,
+ kVK_ANSI_O = 0x1F,
+ kVK_ANSI_U = 0x20,
+ kVK_ANSI_LeftBracket = 0x21,
+ kVK_ANSI_I = 0x22,
+ kVK_ANSI_P = 0x23,
+ kVK_ANSI_L = 0x25,
+ kVK_ANSI_J = 0x26,
+ kVK_ANSI_Quote = 0x27,
+ kVK_ANSI_K = 0x28,
+ kVK_ANSI_Semicolon = 0x29,
+ kVK_ANSI_Backslash = 0x2A,
+ kVK_ANSI_Comma = 0x2B,
+ kVK_ANSI_Slash = 0x2C,
+ kVK_ANSI_N = 0x2D,
+ kVK_ANSI_M = 0x2E,
+ kVK_ANSI_Period = 0x2F,
+ kVK_ANSI_Grave = 0x32,
+ kVK_ANSI_KeypadDecimal = 0x41,
+ kVK_ANSI_KeypadMultiply = 0x43,
+ kVK_ANSI_KeypadPlus = 0x45,
+ kVK_ANSI_KeypadClear = 0x47,
+ kVK_ANSI_KeypadDivide = 0x4B,
+ kVK_ANSI_KeypadEnter = 0x4C,
+ kVK_ANSI_KeypadMinus = 0x4E,
+ kVK_ANSI_KeypadEquals = 0x51,
+ kVK_ANSI_Keypad0 = 0x52,
+ kVK_ANSI_Keypad1 = 0x53,
+ kVK_ANSI_Keypad2 = 0x54,
+ kVK_ANSI_Keypad3 = 0x55,
+ kVK_ANSI_Keypad4 = 0x56,
+ kVK_ANSI_Keypad5 = 0x57,
+ kVK_ANSI_Keypad6 = 0x58,
+ kVK_ANSI_Keypad7 = 0x59,
+ kVK_ANSI_Keypad8 = 0x5B,
+ kVK_ANSI_Keypad9 = 0x5C
+};
+
+/* keycodes for keys that are independent of keyboard layout*/
+enum {
+ kVK_Return = 0x24,
+ kVK_Tab = 0x30,
+ kVK_Space = 0x31,
+ kVK_Delete = 0x33,
+ kVK_Escape = 0x35,
+ kVK_Command = 0x37,
+ kVK_Shift = 0x38,
+ kVK_CapsLock = 0x39,
+ kVK_Option = 0x3A,
+ kVK_Control = 0x3B,
+ kVK_RightShift = 0x3C,
+ kVK_RightOption = 0x3D,
+ kVK_RightControl = 0x3E,
+ kVK_Function = 0x3F,
+ kVK_F17 = 0x40,
+ kVK_VolumeUp = 0x48,
+ kVK_VolumeDown = 0x49,
+ kVK_Mute = 0x4A,
+ kVK_F18 = 0x4F,
+ kVK_F19 = 0x50,
+ kVK_F20 = 0x5A,
+ kVK_F5 = 0x60,
+ kVK_F6 = 0x61,
+ kVK_F7 = 0x62,
+ kVK_F3 = 0x63,
+ kVK_F8 = 0x64,
+ kVK_F9 = 0x65,
+ kVK_F11 = 0x67,
+ kVK_F13 = 0x69,
+ kVK_F16 = 0x6A,
+ kVK_F14 = 0x6B,
+ kVK_F10 = 0x6D,
+ kVK_F12 = 0x6F,
+ kVK_F15 = 0x71,
+ kVK_Help = 0x72,
+ kVK_Home = 0x73,
+ kVK_PageUp = 0x74,
+ kVK_ForwardDelete = 0x75,
+ kVK_F4 = 0x76,
+ kVK_End = 0x77,
+ kVK_F2 = 0x78,
+ kVK_PageDown = 0x79,
+ kVK_F1 = 0x7A,
+ kVK_LeftArrow = 0x7B,
+ kVK_RightArrow = 0x7C,
+ kVK_DownArrow = 0x7D,
+ kVK_UpArrow = 0x7E
+};
+
+/* ISO keyboards only*/
+enum {
+ kVK_ISO_Section = 0x0A
+};
+
+/* JIS keyboards only*/
+enum {
+ kVK_JIS_Yen = 0x5D,
+ kVK_JIS_Underscore = 0x5E,
+ kVK_JIS_KeypadComma = 0x5F,
+ kVK_JIS_Eisu = 0x66,
+ kVK_JIS_Kana = 0x68
+};
+#endif
+
+static GHOST_TButtonMask convertButton(int button)
+{
+ switch (button) {
+ case 0:
+ return GHOST_kButtonMaskLeft;
+ case 1:
+ return GHOST_kButtonMaskRight;
+ case 2:
+ return GHOST_kButtonMaskMiddle;
+ case 3:
+ return GHOST_kButtonMaskButton4;
+ case 4:
+ return GHOST_kButtonMaskButton5;
+ default:
+ return GHOST_kButtonMaskLeft;
+ }
+}
+
+/**
+ * Converts Mac rawkey codes (same for Cocoa & Carbon)
+ * into GHOST key codes
+ * @param rawCode The raw physical key code
+ * @param recvChar the character ignoring modifiers (except for shift)
+ * @return Ghost key code
+ */
+static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
+{
+
+ //printf("\nrecvchar %c 0x%x",recvChar,recvChar);
+ switch (rawCode) {
+ /*Physical keycodes not used due to map changes in int'l keyboards
+ case kVK_ANSI_A: return GHOST_kKeyA;
+ case kVK_ANSI_B: return GHOST_kKeyB;
+ case kVK_ANSI_C: return GHOST_kKeyC;
+ case kVK_ANSI_D: return GHOST_kKeyD;
+ case kVK_ANSI_E: return GHOST_kKeyE;
+ case kVK_ANSI_F: return GHOST_kKeyF;
+ case kVK_ANSI_G: return GHOST_kKeyG;
+ case kVK_ANSI_H: return GHOST_kKeyH;
+ case kVK_ANSI_I: return GHOST_kKeyI;
+ case kVK_ANSI_J: return GHOST_kKeyJ;
+ case kVK_ANSI_K: return GHOST_kKeyK;
+ case kVK_ANSI_L: return GHOST_kKeyL;
+ case kVK_ANSI_M: return GHOST_kKeyM;
+ case kVK_ANSI_N: return GHOST_kKeyN;
+ case kVK_ANSI_O: return GHOST_kKeyO;
+ case kVK_ANSI_P: return GHOST_kKeyP;
+ case kVK_ANSI_Q: return GHOST_kKeyQ;
+ case kVK_ANSI_R: return GHOST_kKeyR;
+ case kVK_ANSI_S: return GHOST_kKeyS;
+ case kVK_ANSI_T: return GHOST_kKeyT;
+ case kVK_ANSI_U: return GHOST_kKeyU;
+ case kVK_ANSI_V: return GHOST_kKeyV;
+ case kVK_ANSI_W: return GHOST_kKeyW;
+ case kVK_ANSI_X: return GHOST_kKeyX;
+ case kVK_ANSI_Y: return GHOST_kKeyY;
+ case kVK_ANSI_Z: return GHOST_kKeyZ;*/
+
+ /* Numbers keys mapped to handle some int'l keyboard (e.g. French)*/
+ case kVK_ISO_Section: return GHOST_kKeyUnknown;
+ case kVK_ANSI_1: return GHOST_kKey1;
+ case kVK_ANSI_2: return GHOST_kKey2;
+ case kVK_ANSI_3: return GHOST_kKey3;
+ case kVK_ANSI_4: return GHOST_kKey4;
+ case kVK_ANSI_5: return GHOST_kKey5;
+ case kVK_ANSI_6: return GHOST_kKey6;
+ case kVK_ANSI_7: return GHOST_kKey7;
+ case kVK_ANSI_8: return GHOST_kKey8;
+ case kVK_ANSI_9: return GHOST_kKey9;
+ case kVK_ANSI_0: return GHOST_kKey0;
+
+ case kVK_ANSI_Keypad0: return GHOST_kKeyNumpad0;
+ case kVK_ANSI_Keypad1: return GHOST_kKeyNumpad1;
+ case kVK_ANSI_Keypad2: return GHOST_kKeyNumpad2;
+ case kVK_ANSI_Keypad3: return GHOST_kKeyNumpad3;
+ case kVK_ANSI_Keypad4: return GHOST_kKeyNumpad4;
+ case kVK_ANSI_Keypad5: return GHOST_kKeyNumpad5;
+ case kVK_ANSI_Keypad6: return GHOST_kKeyNumpad6;
+ case kVK_ANSI_Keypad7: return GHOST_kKeyNumpad7;
+ case kVK_ANSI_Keypad8: return GHOST_kKeyNumpad8;
+ case kVK_ANSI_Keypad9: return GHOST_kKeyNumpad9;
+ case kVK_ANSI_KeypadDecimal: return GHOST_kKeyNumpadPeriod;
+ case kVK_ANSI_KeypadEnter: return GHOST_kKeyNumpadEnter;
+ case kVK_ANSI_KeypadPlus: return GHOST_kKeyNumpadPlus;
+ case kVK_ANSI_KeypadMinus: return GHOST_kKeyNumpadMinus;
+ case kVK_ANSI_KeypadMultiply: return GHOST_kKeyNumpadAsterisk;
+ case kVK_ANSI_KeypadDivide: return GHOST_kKeyNumpadSlash;
+ case kVK_ANSI_KeypadClear: return GHOST_kKeyUnknown;
+
+ case kVK_F1: return GHOST_kKeyF1;
+ case kVK_F2: return GHOST_kKeyF2;
+ case kVK_F3: return GHOST_kKeyF3;
+ case kVK_F4: return GHOST_kKeyF4;
+ case kVK_F5: return GHOST_kKeyF5;
+ case kVK_F6: return GHOST_kKeyF6;
+ case kVK_F7: return GHOST_kKeyF7;
+ case kVK_F8: return GHOST_kKeyF8;
+ case kVK_F9: return GHOST_kKeyF9;
+ case kVK_F10: return GHOST_kKeyF10;
+ case kVK_F11: return GHOST_kKeyF11;
+ case kVK_F12: return GHOST_kKeyF12;
+ case kVK_F13: return GHOST_kKeyF13;
+ case kVK_F14: return GHOST_kKeyF14;
+ case kVK_F15: return GHOST_kKeyF15;
+ case kVK_F16: return GHOST_kKeyF16;
+ case kVK_F17: return GHOST_kKeyF17;
+ case kVK_F18: return GHOST_kKeyF18;
+ case kVK_F19: return GHOST_kKeyF19;
+ case kVK_F20: return GHOST_kKeyF20;
+
+ case kVK_UpArrow: return GHOST_kKeyUpArrow;
+ case kVK_DownArrow: return GHOST_kKeyDownArrow;
+ case kVK_LeftArrow: return GHOST_kKeyLeftArrow;
+ case kVK_RightArrow: return GHOST_kKeyRightArrow;
+
+ case kVK_Return: return GHOST_kKeyEnter;
+ case kVK_Delete: return GHOST_kKeyBackSpace;
+ case kVK_ForwardDelete: return GHOST_kKeyDelete;
+ case kVK_Escape: return GHOST_kKeyEsc;
+ case kVK_Tab: return GHOST_kKeyTab;
+ case kVK_Space: return GHOST_kKeySpace;
+
+ case kVK_Home: return GHOST_kKeyHome;
+ case kVK_End: return GHOST_kKeyEnd;
+ case kVK_PageUp: return GHOST_kKeyUpPage;
+ case kVK_PageDown: return GHOST_kKeyDownPage;
+
+ /*case kVK_ANSI_Minus: return GHOST_kKeyMinus;
+ case kVK_ANSI_Equal: return GHOST_kKeyEqual;
+ case kVK_ANSI_Comma: return GHOST_kKeyComma;
+ case kVK_ANSI_Period: return GHOST_kKeyPeriod;
+ case kVK_ANSI_Slash: return GHOST_kKeySlash;
+ case kVK_ANSI_Semicolon: return GHOST_kKeySemicolon;
+ case kVK_ANSI_Quote: return GHOST_kKeyQuote;
+ case kVK_ANSI_Backslash: return GHOST_kKeyBackslash;
+ case kVK_ANSI_LeftBracket: return GHOST_kKeyLeftBracket;
+ case kVK_ANSI_RightBracket: return GHOST_kKeyRightBracket;
+ case kVK_ANSI_Grave: return GHOST_kKeyAccentGrave;*/
+
+ case kVK_VolumeUp:
+ case kVK_VolumeDown:
+ case kVK_Mute:
+ return GHOST_kKeyUnknown;
+
+ default:
+ /* alphanumerical or punctuation key that is remappable in int'l keyboards */
+ if ((recvChar >= 'A') && (recvChar <= 'Z')) {
+ return (GHOST_TKey) (recvChar - 'A' + GHOST_kKeyA);
+ } else if ((recvChar >= 'a') && (recvChar <= 'z')) {
+ return (GHOST_TKey) (recvChar - 'a' + GHOST_kKeyA);
+ } else {
+#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
+ KeyboardLayoutRef keyLayout;
+ UCKeyboardLayout *uchrData;
+
+ KLGetCurrentKeyboardLayout(&keyLayout);
+ KLGetKeyboardLayoutProperty(keyLayout, kKLuchrData, (const void **)
+ &uchrData);
+ /*get actual character value of the "remappable" keys in int'l keyboards,
+ if keyboard layout is not correctly reported (e.g. some non Apple keyboards in Tiger),
+ then fallback on using the received charactersIgnoringModifiers */
+ if (uchrData)
+ {
+ UInt32 deadKeyState=0;
+ UniCharCount actualStrLength=0;
+
+ UCKeyTranslate(uchrData, rawCode, keyAction, 0,
+ LMGetKbdType(), kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 1, &actualStrLength, &recvChar);
+
+ }
+#else
+ /* Leopard and Snow Leopard 64bit compatible API*/
+ CFDataRef uchrHandle; /*the keyboard layout*/
+ TISInputSourceRef kbdTISHandle;
+
+ kbdTISHandle = TISCopyCurrentKeyboardLayoutInputSource();
+ uchrHandle = (CFDataRef)TISGetInputSourceProperty(kbdTISHandle,kTISPropertyUnicodeKeyLayoutData);
+ CFRelease(kbdTISHandle);
+
+ /*get actual character value of the "remappable" keys in int'l keyboards,
+ if keyboard layout is not correctly reported (e.g. some non Apple keyboards in Tiger),
+ then fallback on using the received charactersIgnoringModifiers */
+ if (uchrHandle)
+ {
+ UInt32 deadKeyState=0;
+ UniCharCount actualStrLength=0;
+
+ UCKeyTranslate((UCKeyboardLayout*)CFDataGetBytePtr(uchrHandle), rawCode, keyAction, 0,
+ LMGetKbdType(), kUCKeyTranslateNoDeadKeysBit, &deadKeyState, 1, &actualStrLength, &recvChar);
+
+ }
+#endif
+ switch (recvChar) {
+ case '-': return GHOST_kKeyMinus;
+ case '=': return GHOST_kKeyEqual;
+ case ',': return GHOST_kKeyComma;
+ case '.': return GHOST_kKeyPeriod;
+ case '/': return GHOST_kKeySlash;
+ case ';': return GHOST_kKeySemicolon;
+ case '\'': return GHOST_kKeyQuote;
+ case '\\': return GHOST_kKeyBackslash;
+ case '[': return GHOST_kKeyLeftBracket;
+ case ']': return GHOST_kKeyRightBracket;
+ case '`': return GHOST_kKeyAccentGrave;
+ default:
+ return GHOST_kKeyUnknown;
+ }
+ }
+ }
+ return GHOST_kKeyUnknown;
+}
+
+
+>>>>>>> .merge-right.r30358
#pragma mark defines for 10.6 api not documented in 10.5
#ifndef MAC_OS_X_VERSION_10_6
enum {
@@ -702,6 +1110,7 @@ GHOST_IWindow* GHOST_SystemCocoa::createWindow(
top = top > contentRect.origin.y ? top : contentRect.origin.y;
window = new GHOST_WindowCocoa (this, title, left, top, width, height, state, type, stereoVisual, numOfAASamples);
+<<<<<<< .working
if (window) {
if (window->getValid()) {
@@ -745,6 +1154,53 @@ GHOST_TSuccess GHOST_SystemCocoa::endFullScreen(void)
+=======
+
+ if (window) {
+ if (window->getValid()) {
+ // Store the pointer to the window
+ GHOST_ASSERT(m_windowManager, "m_windowManager not initialized");
+ m_windowManager->addWindow(window);
+ m_windowManager->setActiveWindow(window);
+ //Need to tell window manager the new window is the active one (Cocoa does not send the event activate upon window creation)
+ pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window));
+ pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window));
+
+ }
+ else {
+ GHOST_PRINT("GHOST_SystemCocoa::createWindow(): window invalid\n");
+ delete window;
+ window = 0;
+ }
+ }
+ else {
+ GHOST_PRINT("GHOST_SystemCocoa::createWindow(): could not create window\n");
+ }
+ [pool drain];
+ return window;
+}
+
+GHOST_TSuccess GHOST_SystemCocoa::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window, const bool stereoVisual)
+{
+ GHOST_IWindow* currentWindow = m_windowManager->getActiveWindow();
+ *window = currentWindow;
+
+ if(!currentWindow) return GHOST_kFailure;
+
+ return currentWindow->setState(GHOST_kWindowStateFullScreen);
+}
+
+GHOST_TSuccess GHOST_SystemCocoa::endFullScreen(void)
+{
+ GHOST_IWindow* currentWindow = m_windowManager->getActiveWindow();
+ if(!currentWindow) return GHOST_kFailure;
+
+ return currentWindow->setState(GHOST_kWindowStateNormal);
+}
+
+
+
+>>>>>>> .merge-right.r30358
/**
* @note : returns coordinates in Cocoa screen coordinates
*/
@@ -761,10 +1217,39 @@ GHOST_TSuccess GHOST_SystemCocoa::getCursorPosition(GHOST_TInt32& x, GHOST_TInt3
/**
* @note : expect Cocoa screen coordinates
*/
+<<<<<<< .working
GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const
{
float xf=(float)x, yf=(float)y;
+=======
+GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
+{
+ GHOST_TInt32 wx,wy;
GHOST_WindowCocoa* window = (GHOST_WindowCocoa*)m_windowManager->getActiveWindow();
+ if (!window) return GHOST_kFailure;
+
+ //Cursor and mouse dissociation placed here not to interfere with continuous grab
+ // (in cont. grab setMouseCursorPosition is directly called)
+ CGAssociateMouseAndMouseCursorPosition(false);
+ setMouseCursorPosition(x, y);
+ CGAssociateMouseAndMouseCursorPosition(true);
+
+ //Force mouse move event (not pushed by Cocoa)
+ window->screenToClient(x, y, wx, wy);
+ pushEvent(new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, wx,wy));
+ m_outsideLoopEventProcessed = true;
+
+ return GHOST_kSuccess;
+}
+
+GHOST_TSuccess GHOST_SystemCocoa::setMouseCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
+{
+ float xf=(float)x, yf=(float)y;
+>>>>>>> .merge-right.r30358
+ GHOST_WindowCocoa* window = (GHOST_WindowCocoa*)m_windowManager->getActiveWindow();
+ if (!window) return GHOST_kFailure;
+
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSScreen *windowScreen = window->getScreen();
NSRect screenRect = [windowScreen frame];
@@ -777,12 +1262,22 @@ GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32
CGDisplayMoveCursorToPoint((CGDirectDisplayID)[[[windowScreen deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue], CGPointMake(xf, yf));
+<<<<<<< .working
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_SystemCocoa::getModifierKeys(GHOST_ModifierKeys& keys) const
{
+=======
+ [pool drain];
+ return GHOST_kSuccess;
+}
+
+
+GHOST_TSuccess GHOST_SystemCocoa::getModifierKeys(GHOST_ModifierKeys& keys) const
+{
+>>>>>>> .merge-right.r30358
keys.set(GHOST_kModifierKeyCommand, (m_modifierMask & NSCommandKeyMask) ? true : false);
keys.set(GHOST_kModifierKeyLeftAlt, (m_modifierMask & NSAlternateKeyMask) ? true : false);
keys.set(GHOST_kModifierKeyLeftShift, (m_modifierMask & NSShiftKeyMask) ? true : false);
@@ -1040,7 +1535,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
{
droppedStr = [droppedArray objectAtIndex:i];
- pastedTextSize = [droppedStr lengthOfBytesUsingEncoding:NSISOLatin1StringEncoding];
+ pastedTextSize = [droppedStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
temp_buff = (GHOST_TUns8*) malloc(pastedTextSize+1);
if (!temp_buff) {
@@ -1048,7 +1543,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
break;
}
- strncpy((char*)temp_buff, [droppedStr cStringUsingEncoding:NSISOLatin1StringEncoding], pastedTextSize);
+ strncpy((char*)temp_buff, [droppedStr cStringUsingEncoding:NSUTF8StringEncoding], pastedTextSize);
temp_buff[pastedTextSize] = '\0';
strArray->strings[i] = temp_buff;
@@ -1059,7 +1554,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
case GHOST_kDragnDropTypeString:
droppedStr = (NSString*)data;
- pastedTextSize = [droppedStr lengthOfBytesUsingEncoding:NSISOLatin1StringEncoding];
+ pastedTextSize = [droppedStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
temp_buff = (GHOST_TUns8*) malloc(pastedTextSize+1);
@@ -1067,7 +1562,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
return GHOST_kFailure;
}
- strncpy((char*)temp_buff, [droppedStr cStringUsingEncoding:NSISOLatin1StringEncoding], pastedTextSize);
+ strncpy((char*)temp_buff, [droppedStr cStringUsingEncoding:NSUTF8StringEncoding], pastedTextSize);
temp_buff[pastedTextSize] = '\0';
@@ -1467,7 +1962,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
//Set new cursor position
window->clientToScreen(x_mouse, y_mouse, x_cur, y_cur);
- setCursorPosition(x_cur, y_cur); /* wrap */
+ setMouseCursorPosition(x_cur, y_cur); /* wrap */
//Post event
window->getCursorGrabInitPos(x_cur, y_cur);
@@ -1573,9 +2068,15 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
charsIgnoringModifiers = [event charactersIgnoringModifiers];
if ([charsIgnoringModifiers length]>0)
keyCode = convertKey([event keyCode],
- [charsIgnoringModifiers characterAtIndex:0]);
+ [charsIgnoringModifiers characterAtIndex:0],
+ [event type] == NSKeyDown?kUCKeyActionDown:kUCKeyActionUp);
else
+<<<<<<< .working
keyCode = convertKey([event keyCode],0);
+=======
+ keyCode = convertKey([event keyCode],0,
+ [event type] == NSKeyDown?kUCKeyActionDown:kUCKeyActionUp);
+>>>>>>> .merge-right.r30358
characters = [event characters];
@@ -1595,14 +2096,28 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
if ([event type] == NSKeyDown) {
pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyDown, window, keyCode, ascii) );
+<<<<<<< .working
//printf("\nKey pressed keyCode=%u ascii=%i %c",keyCode,ascii,ascii);
} else {
+=======
+ //printf("\nKey down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii);
+ } else {
+>>>>>>> .merge-right.r30358
pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyUp, window, keyCode, ascii) );
+<<<<<<< .working
}
break;
case NSFlagsChanged:
modifiers = [event modifierFlags];
+=======
+ //printf("\nKey up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii);
+ }
+ break;
+
+ case NSFlagsChanged:
+ modifiers = [event modifierFlags];
+>>>>>>> .merge-right.r30358
if ((modifiers & NSShiftKeyMask) != (m_modifierMask & NSShiftKeyMask)) {
pushEvent( new GHOST_EventKey([event timestamp]*1000, (modifiers & NSShiftKeyMask)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftShift) );
@@ -1718,22 +2233,16 @@ const GHOST_TUns8* GHOST_SystemCocoa::getSystemDir() const
{
static GHOST_TUns8 tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSFileManager *fileManager;
NSString *basePath;
NSArray *paths;
paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSLocalDomainMask, YES);
if ([paths count] > 0)
- basePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Blender"];
- else { //Fall back to standard unix path in case of issue
- basePath = @"/usr/share/blender";
- }
-
- /* Ensure path exists, creates it if needed */
- fileManager = [NSFileManager defaultManager];
- if (![fileManager fileExistsAtPath:basePath isDirectory:NULL]) {
- [fileManager createDirectoryAtPath:basePath attributes:nil];
+ basePath = [paths objectAtIndex:0];
+ else {
+ [pool drain];
+ return NULL;
}
strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
@@ -1746,22 +2255,35 @@ const GHOST_TUns8* GHOST_SystemCocoa::getUserDir() const
{
static GHOST_TUns8 tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSFileManager *fileManager;
NSString *basePath;
NSArray *paths;
paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
if ([paths count] > 0)
- basePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Blender"];
- else { //Fall back to HOME in case of issue
- basePath = [NSHomeDirectory() stringByAppendingPathComponent:@".blender"];
+ basePath = [paths objectAtIndex:0];
+ else {
+ [pool drain];
+ return NULL;
}
+
+ strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
+
+ [pool drain];
+ return tempPath;
+}
+
+const GHOST_TUns8* GHOST_SystemCocoa::getBinaryDir() const
+{
+ static GHOST_TUns8 tempPath[512] = "";
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ NSString *basePath;
+
+ basePath = [[NSBundle mainBundle] bundlePath];
- /* Ensure path exists, creates it if needed */
- fileManager = [NSFileManager defaultManager];
- if (![fileManager fileExistsAtPath:basePath isDirectory:NULL]) {
- [fileManager createDirectoryAtPath:basePath attributes:nil];
+ if (basePath == nil) {
+ [pool drain];
+ return NULL;
}
strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index b1c5ee6e6f2..da7a0399f41 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -34,13 +34,17 @@
* @date May 7, 2001
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GHOST_SystemWin32.h"
#include "GHOST_EventDragnDrop.h"
+#define WIN32_LEAN_AND_MEAN
+#ifdef _WIN32_IE
+#undef _WIN32_IE
+#endif
+#define _WIN32_IE 0x0501
+#include <windows.h>
+#include <shlobj.h>
+
// win64 doesn't define GWL_USERDATA
#ifdef WIN32
#ifndef GWL_USERDATA
@@ -273,8 +277,10 @@ GHOST_TSuccess GHOST_SystemWin32::getCursorPosition(GHOST_TInt32& x, GHOST_TInt3
}
-GHOST_TSuccess GHOST_SystemWin32::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const
+GHOST_TSuccess GHOST_SystemWin32::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
{
+ if (!GetActiveWindow())
+ return GHOST_kFailure;
return ::SetCursorPos(x, y) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
}
@@ -1097,10 +1103,36 @@ void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
const GHOST_TUns8* GHOST_SystemWin32::getSystemDir() const
{
+ static char knownpath[MAX_PATH];
+ HRESULT hResult = SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath);
+
+ if (hResult == S_OK)
+ {
+ return (GHOST_TUns8*)knownpath;
+ }
+
return NULL;
}
const GHOST_TUns8* GHOST_SystemWin32::getUserDir() const
{
+ static char knownpath[MAX_PATH];
+ HRESULT hResult = SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath);
+
+ if (hResult == S_OK)
+ {
+ return (GHOST_TUns8*)knownpath;
+ }
+
+ return NULL;
+}
+
+const GHOST_TUns8* GHOST_SystemWin32::getBinaryDir() const
+{
+ static char fullname[MAX_PATH];
+ if(GetModuleFileName(0, fullname, MAX_PATH)) {
+ return (GHOST_TUns8*)fullname;
+ }
+
return NULL;
}
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h
index 75bb858fb49..888d9c0ab3e 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -153,7 +153,7 @@ public:
* @param y The y-coordinate of the cursor.
* @return Indication of success.
*/
- virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const;
+ virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
/***************************************************************************************
** Access to mouse button and keyboard states.
@@ -186,22 +186,27 @@ public:
* @return No return
*/
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
-
/**
* Determine the base dir in which shared resources are located. It will first try to use
* "unpack and run" path, then look for properly installed path, not including versioning.
- * @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
+ * @return Unsigned char string pointing to system dir (eg /usr/share/).
*/
virtual const GHOST_TUns8* getSystemDir() const;
/**
* Determine the base dir in which user configuration is stored, not including versioning.
* If needed, it will create the base directory.
- * @return Unsigned char string pointing to user dir (eg ~/.blender/).
+ * @return Unsigned char string pointing to user dir (eg ~/).
*/
virtual const GHOST_TUns8* getUserDir() const;
+ /**
+ * Determine the directory of the current binary
+ * @return Unsigned char string pointing to the binary dir
+ */
+ virtual const GHOST_TUns8* getBinaryDir() const;
+
/**
* Creates a drag'n'drop event and pushes it immediately onto the event queue.
* Called by GHOST_DropTargetWin32 class.
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index cbf775045fd..c9228e68e54 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -29,10 +29,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GHOST_SystemX11.h"
#include "GHOST_WindowX11.h"
#include "GHOST_WindowManager.h"
@@ -469,7 +465,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
/* could also clamp to screen bounds
* wrap with a window outside the view will fail atm */
- bounds.wrapPoint(x_new, y_new, 2); /* offset of one incase blender is at screen bounds */
+ bounds.wrapPoint(x_new, y_new, 8); /* offset of one incase blender is at screen bounds */
window->getCursorGrabAccum(x_accum, y_accum);
if(x_new != xme.x_root || y_new != xme.y_root) {
@@ -536,38 +532,43 @@ GHOST_SystemX11::processEvent(XEvent *xe)
}
case ButtonPress:
- {
- /* process wheel mouse events and break */
- if (xe->xbutton.button == 4) {
- g_event = new GHOST_EventWheel(getMilliSeconds(), window, 1);
- break;
- }
- if (xe->xbutton.button == 5) {
- g_event = new GHOST_EventWheel(getMilliSeconds(), window, -1);
- break;
- }
- }
case ButtonRelease:
{
-
XButtonEvent & xbe = xe->xbutton;
GHOST_TButtonMask gbmask = GHOST_kButtonMaskLeft;
- switch (xbe.button) {
- case Button1 : gbmask = GHOST_kButtonMaskLeft; break;
- case Button3 : gbmask = GHOST_kButtonMaskRight; break;
- /* It seems events 6 and 7 are for horizontal scrolling.
- * you can re-order button mapping like this... (swaps 6,7 with 8,9)
- * xmodmap -e "pointer = 1 2 3 4 5 8 9 6 7"
- */
- case 8 : gbmask = GHOST_kButtonMaskButton4; break; /* Button4 is the wheel */
- case 9 : gbmask = GHOST_kButtonMaskButton5; break; /* Button5 is a wheel too */
- default:
- case Button2 : gbmask = GHOST_kButtonMaskMiddle; break;
- }
-
GHOST_TEventType type = (xbe.type == ButtonPress) ?
GHOST_kEventButtonDown : GHOST_kEventButtonUp;
+
+ /* process wheel mouse events and break, only pass on press events */
+ if(xbe.button == Button4) {
+ if(xbe.type == ButtonPress)
+ g_event = new GHOST_EventWheel(getMilliSeconds(), window, 1);
+ break;
+ }
+ else if(xbe.button == Button5) {
+ if(xbe.type == ButtonPress)
+ g_event = new GHOST_EventWheel(getMilliSeconds(), window, -1);
+ break;
+ }
+ /* process rest of normal mouse buttons */
+ if(xbe.button == Button1)
+ gbmask = GHOST_kButtonMaskLeft;
+ else if(xbe.button == Button2)
+ gbmask = GHOST_kButtonMaskMiddle;
+ else if(xbe.button == Button3)
+ gbmask = GHOST_kButtonMaskRight;
+ /* It seems events 6 and 7 are for horizontal scrolling.
+ * you can re-order button mapping like this... (swaps 6,7 with 8,9)
+ * xmodmap -e "pointer = 1 2 3 4 5 8 9 6 7"
+ */
+ else if(xbe.button == 8)
+ gbmask = GHOST_kButtonMaskButton4;
+ else if(xbe.button == 9)
+ gbmask = GHOST_kButtonMaskButton5;
+ else
+ break;
+
g_event = new
GHOST_EventButton(
getMilliSeconds(),
@@ -965,7 +966,7 @@ GHOST_SystemX11::
setCursorPosition(
GHOST_TInt32 x,
GHOST_TInt32 y
-) const {
+) {
// This is a brute force move in screen coordinates
// XWarpPointer does relative moves so first determine the
@@ -1460,19 +1461,21 @@ void GHOST_SystemX11::putClipboard(GHOST_TInt8 *buffer, bool selection) const
const GHOST_TUns8* GHOST_SystemX11::getSystemDir() const
{
- return (GHOST_TUns8*)"/usr/share/blender";
+ return (GHOST_TUns8*)"/usr/share";
}
const GHOST_TUns8* GHOST_SystemX11::getUserDir() const
{
- static char path[256];
char* env = getenv("HOME");
if(env) {
- strncpy(path, env, 245);
- path[245]=0;
- strcat(path, "/.blender/");
- return (GHOST_TUns8*) path;
+ return (GHOST_TUns8*) env;
} else {
return NULL;
}
}
+
+const GHOST_TUns8* GHOST_SystemX11::getBinaryDir() const
+{
+ return NULL;
+}
+
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index 1d9959cc931..13ad4200ab8 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -158,7 +158,7 @@ public:
setCursorPosition(
GHOST_TInt32 x,
GHOST_TInt32 y
- ) const;
+ );
/**
* Returns the state of all modifier keys.
@@ -241,6 +241,12 @@ public:
const GHOST_TUns8* getUserDir() const;
/**
+ * Determine the directory of the current binary
+ * @return Unsigned char string pointing to the binary dir
+ */
+ const GHOST_TUns8* getBinaryDir() const;
+
+ /**
* Atom used for ICCCM, WM-spec and Motif.
* We only need get this atom at the start, it's relative
* to the display not the window and are public for every
diff --git a/intern/ghost/intern/GHOST_TimerManager.cpp b/intern/ghost/intern/GHOST_TimerManager.cpp
index a83e4d2edce..ec99e323d14 100644
--- a/intern/ghost/intern/GHOST_TimerManager.cpp
+++ b/intern/ghost/intern/GHOST_TimerManager.cpp
@@ -34,10 +34,6 @@
* @date May 31, 2001
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GHOST_TimerManager.h"
#include <algorithm>
diff --git a/intern/ghost/intern/GHOST_Window.cpp b/intern/ghost/intern/GHOST_Window.cpp
index b5f8050bebb..374b620c348 100644
--- a/intern/ghost/intern/GHOST_Window.cpp
+++ b/intern/ghost/intern/GHOST_Window.cpp
@@ -32,10 +32,6 @@
* @date May 10, 2001
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GHOST_Window.h"
@@ -57,6 +53,8 @@ GHOST_Window::GHOST_Window(
m_isUnsavedChanges = false;
m_canAcceptDragOperation = false;
+ m_progressBarVisible = false;
+
m_cursorGrabAccumPos[0] = 0;
m_cursorGrabAccumPos[1] = 0;
diff --git a/intern/ghost/intern/GHOST_Window.h b/intern/ghost/intern/GHOST_Window.h
index bec9cecc830..d4d53787357 100644
--- a/intern/ghost/intern/GHOST_Window.h
+++ b/intern/ghost/intern/GHOST_Window.h
@@ -192,6 +192,17 @@ public:
virtual GHOST_TSuccess getCursorGrabBounds(GHOST_Rect& bounds);
/**
+ * Sets the progress bar value displayed in the window/application icon
+ * @param progress The progress % (0.0 to 1.0)
+ */
+ virtual GHOST_TSuccess setProgressBar(float progress) {return GHOST_kFailure;};
+
+ /**
+ * Hides the progress bar in the icon
+ */
+ virtual GHOST_TSuccess endProgressBar() {return GHOST_kFailure;};
+
+ /**
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
*/
virtual void setAcceptDragOperation(bool canAccept);
@@ -313,6 +324,9 @@ protected:
/** The current shape of the cursor */
GHOST_TStandardCursor m_cursorShape;
+ /** The presence of progress indicator with the application icon */
+ bool m_progressBarVisible;
+
/** The acceptance of the "drop candidate" of the current drag'n'drop operation */
bool m_canAcceptDragOperation;
diff --git a/intern/ghost/intern/GHOST_WindowCarbon.cpp b/intern/ghost/intern/GHOST_WindowCarbon.cpp
index 65584e4cc1f..a8295ec57d3 100644
--- a/intern/ghost/intern/GHOST_WindowCarbon.cpp
+++ b/intern/ghost/intern/GHOST_WindowCarbon.cpp
@@ -34,10 +34,6 @@
* @date May 10, 2001
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GHOST_WindowCarbon.h"
#include "GHOST_Debug.h"
@@ -46,7 +42,7 @@ AGLContext GHOST_WindowCarbon::s_firstaglCtx = NULL;
const GHOST_TInt32 GHOST_WindowCarbon::s_sizeRectSize = 16;
#endif //GHOST_DRAW_CARBON_GUTTER
-static const GLint sPreferredFormatWindow[8] = {
+static const GLint sPreferredFormatWindow[10] = {
AGL_RGBA,
AGL_DOUBLEBUFFER,
AGL_ACCELERATED,
@@ -54,7 +50,7 @@ AGL_DEPTH_SIZE, 32,
AGL_NONE,
};
-static const GLint sPreferredFormatFullScreen[9] = {
+static const GLint sPreferredFormatFullScreen[11] = {
AGL_RGBA,
AGL_DOUBLEBUFFER,
AGL_ACCELERATED,
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.h b/intern/ghost/intern/GHOST_WindowCocoa.h
index 948fb5e36ee..4b492a6b0b5 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.h
+++ b/intern/ghost/intern/GHOST_WindowCocoa.h
@@ -226,6 +226,17 @@ public:
GHOST_TabletData& GetCocoaTabletData()
{ return m_tablet; }
+
+ /**
+ * Sets the progress bar value displayed in the window/application icon
+ * @param progress The progress % (0.0 to 1.0)
+ */
+ virtual GHOST_TSuccess setProgressBar(float progress);
+
+ /**
+ * Hides the progress bar icon
+ */
+ virtual GHOST_TSuccess endProgressBar();
protected:
/**
* Tries to install a rendering context in this window.
@@ -291,14 +302,6 @@ protected:
NSCursor* m_customCursor;
GHOST_TabletData m_tablet;
-
- /**
- * The width/height of the size rectangle in the lower right corner of a
- * Mac/Carbon window. This is also the height of the gutter area.
- */
-#ifdef GHOST_DRAW_CARBON_GUTTER
- static const GHOST_TInt32 s_sizeRectSize;
-#endif // GHOST_DRAW_CARBON_GUTTER
};
#endif // _GHOST_WINDOW_COCOA_H_
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index 6206388fdaa..233edfc9d65 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -167,7 +167,7 @@ extern "C" {
else if ([[draggingPBoard types] containsObject:NSStringPboardType]) m_draggedObjectType = GHOST_kDragnDropTypeString;
else return NSDragOperationNone;
- associatedWindow->setAcceptDragOperation(FALSE); //Drag operation needs to be accepted explicitly by the event manager
+ associatedWindow->setAcceptDragOperation(TRUE); //Drag operation is accepted by default
systemCocoa->handleDraggingEvent(GHOST_kEventDraggingEntered, m_draggedObjectType, associatedWindow, mouseLocation.x, mouseLocation.y, nil);
return NSDragOperationCopy;
}
@@ -348,10 +348,11 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
pixelFormatAttrsWindow[i++] = NSOpenGLPFAAccelerated;
//pixelFormatAttrsWindow[i++] = NSOpenGLPFAAllowOfflineRenderers,; // Removed to allow 10.4 builds, and 2 GPUs rendering is not used anyway
-
+
pixelFormatAttrsWindow[i++] = NSOpenGLPFADepthSize;
pixelFormatAttrsWindow[i++] = (NSOpenGLPixelFormatAttribute) 32;
+
if (stereoVisual) pixelFormatAttrsWindow[i++] = NSOpenGLPFAStereo;
if (numOfAASamples>0) {
@@ -692,12 +693,239 @@ void GHOST_WindowCocoa::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST
}
+<<<<<<< .working
+=======
+void GHOST_WindowCocoa::setTitle(const STR_String& title)
+{
+ GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setTitle(): window invalid")
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ NSString *windowTitle = [[NSString alloc] initWithUTF8String:title];
+
+ //Set associated file if applicable
+ if ([windowTitle hasPrefix:@"Blender"])
+ {
+ NSRange fileStrRange;
+ NSString *associatedFileName;
+ int len;
+
+ fileStrRange.location = [windowTitle rangeOfString:@"["].location+1;
+ len = [windowTitle rangeOfString:@"]"].location - fileStrRange.location;
+
+ if (len >0)
+ {
+ fileStrRange.length = len;
+ associatedFileName = [windowTitle substringWithRange:fileStrRange];
+ @try {
+ [m_window setRepresentedFilename:associatedFileName];
+ }
+ @catch (NSException * e) {
+ printf("\nInvalid file path given in window title");
+ }
+ [m_window setTitle:[associatedFileName lastPathComponent]];
+ }
+ else {
+ [m_window setTitle:windowTitle];
+ [m_window setRepresentedFilename:@""];
+ }
+
+ } else {
+ [m_window setTitle:windowTitle];
+ [m_window setRepresentedFilename:@""];
+ }
+
+
+ [windowTitle release];
+ [pool drain];
+}
+
+
+void GHOST_WindowCocoa::getTitle(STR_String& title) const
+{
+ GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::getTitle(): window invalid")
+
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ NSString *windowTitle = [m_window title];
+
+ if (windowTitle != nil) {
+ title = [windowTitle UTF8String];
+ }
+
+ [pool drain];
+}
+
+
+void GHOST_WindowCocoa::getWindowBounds(GHOST_Rect& bounds) const
+{
+ NSRect rect;
+ GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::getWindowBounds(): window invalid")
+
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ NSRect screenSize = [[m_window screen] visibleFrame];
+
+ rect = [m_window frame];
+
+ bounds.m_b = screenSize.size.height - (rect.origin.y -screenSize.origin.y);
+ bounds.m_l = rect.origin.x -screenSize.origin.x;
+ bounds.m_r = rect.origin.x-screenSize.origin.x + rect.size.width;
+ bounds.m_t = screenSize.size.height - (rect.origin.y + rect.size.height -screenSize.origin.y);
+
+ [pool drain];
+}
+
+
+void GHOST_WindowCocoa::getClientBounds(GHOST_Rect& bounds) const
+{
+ NSRect rect;
+ GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::getClientBounds(): window invalid")
+
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ if (!m_fullScreen)
+ {
+ NSRect screenSize = [[m_window screen] visibleFrame];
+
+ //Max window contents as screen size (excluding title bar...)
+ NSRect contentRect = [CocoaWindow contentRectForFrameRect:screenSize
+ styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)];
+
+ rect = [m_window contentRectForFrameRect:[m_window frame]];
+
+ bounds.m_b = contentRect.size.height - (rect.origin.y -contentRect.origin.y);
+ bounds.m_l = rect.origin.x -contentRect.origin.x;
+ bounds.m_r = rect.origin.x-contentRect.origin.x + rect.size.width;
+ bounds.m_t = contentRect.size.height - (rect.origin.y + rect.size.height -contentRect.origin.y);
+ }
+ else {
+ NSRect screenSize = [[m_window screen] frame];
+
+ bounds.m_b = screenSize.origin.y + screenSize.size.height;
+ bounds.m_l = screenSize.origin.x;
+ bounds.m_r = screenSize.origin.x + screenSize.size.width;
+ bounds.m_t = screenSize.origin.y;
+ }
+ [pool drain];
+}
+
+
+GHOST_TSuccess GHOST_WindowCocoa::setClientWidth(GHOST_TUns32 width)
+{
+ GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientWidth(): window invalid")
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ GHOST_Rect cBnds, wBnds;
+ getClientBounds(cBnds);
+ if (((GHOST_TUns32)cBnds.getWidth()) != width) {
+ NSSize size;
+ size.width=width;
+ size.height=cBnds.getHeight();
+ [m_window setContentSize:size];
+ }
+ [pool drain];
+ return GHOST_kSuccess;
+}
+
+
+GHOST_TSuccess GHOST_WindowCocoa::setClientHeight(GHOST_TUns32 height)
+{
+ GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientHeight(): window invalid")
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ GHOST_Rect cBnds, wBnds;
+ getClientBounds(cBnds);
+ if (((GHOST_TUns32)cBnds.getHeight()) != height) {
+ NSSize size;
+ size.width=cBnds.getWidth();
+ size.height=height;
+ [m_window setContentSize:size];
+ }
+ [pool drain];
+ return GHOST_kSuccess;
+}
+
+
+GHOST_TSuccess GHOST_WindowCocoa::setClientSize(GHOST_TUns32 width, GHOST_TUns32 height)
+{
+ GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientSize(): window invalid")
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ GHOST_Rect cBnds, wBnds;
+ getClientBounds(cBnds);
+ if ((((GHOST_TUns32)cBnds.getWidth()) != width) ||
+ (((GHOST_TUns32)cBnds.getHeight()) != height)) {
+ NSSize size;
+ size.width=width;
+ size.height=height;
+ [m_window setContentSize:size];
+ }
+ [pool drain];
+ return GHOST_kSuccess;
+}
+
+
+GHOST_TWindowState GHOST_WindowCocoa::getState() const
+{
+ GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::getState(): window invalid")
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ GHOST_TWindowState state;
+ if (m_fullScreen) {
+ state = GHOST_kWindowStateFullScreen;
+ }
+ else if ([m_window isMiniaturized]) {
+ state = GHOST_kWindowStateMinimized;
+ }
+ else if ([m_window isZoomed]) {
+ state = GHOST_kWindowStateMaximized;
+ }
+ else {
+ state = GHOST_kWindowStateNormal;
+ }
+ [pool drain];
+ return state;
+}
+
+
+void GHOST_WindowCocoa::screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
+{
+ GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::screenToClient(): window invalid")
+
+ NSPoint screenCoord;
+ NSPoint baseCoord;
+
+ screenCoord.x = inX;
+ screenCoord.y = inY;
+
+ baseCoord = [m_window convertScreenToBase:screenCoord];
+
+ outX = baseCoord.x;
+ outY = baseCoord.y;
+}
+
+
+void GHOST_WindowCocoa::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
+{
+ GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::clientToScreen(): window invalid")
+
+ NSPoint screenCoord;
+ NSPoint baseCoord;
+
+ baseCoord.x = inX;
+ baseCoord.y = inY;
+
+ screenCoord = [m_window convertBaseToScreen:baseCoord];
+
+ outX = screenCoord.x;
+ outY = screenCoord.y;
+}
+
+
+>>>>>>> .merge-right.r30358
NSScreen* GHOST_WindowCocoa::getScreen()
{
return [m_window screen];
}
+<<<<<<< .working
/**
* @note Fullscreen switch is not actual fullscreen with display capture. As this capture removes all OS X window manager features.
* Instead, the menu bar and the dock are hidden, and the window is made borderless and enlarged.
@@ -733,7 +961,45 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state)
//Make window borderless and enlarge it
[m_window setStyleMask:NSBorderlessWindowMask];
[m_window setFrame:[[m_window screen] frame] display:YES];
+=======
+/**
+ * @note Fullscreen switch is not actual fullscreen with display capture. As this capture removes all OS X window manager features.
+ * Instead, the menu bar and the dock are hidden, and the window is made borderless and enlarged.
+ * Thus, process switch, exposé, spaces, ... still work in fullscreen mode
+ */
+GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state)
+{
+ GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setState(): window invalid")
+ switch (state) {
+ case GHOST_kWindowStateMinimized:
+ [m_window miniaturize:nil];
+ break;
+ case GHOST_kWindowStateMaximized:
+ [m_window zoom:nil];
+ break;
+
+ case GHOST_kWindowStateFullScreen:
+ if (!m_fullScreen)
+ {
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ //This status change needs to be done before Cocoa call to enter fullscreen mode
+ //to give window delegate hint not to forward its deactivation to ghost wm that doesn't know view/window difference
+ m_fullScreen = true;
+
+#ifdef MAC_OS_X_VERSION_10_6
+ //10.6 provides Cocoa functions to autoshow menu bar, and to change a window style
+ //Hide menu & dock if needed
+ if ([[m_window screen] isEqual:[[NSScreen screens] objectAtIndex:0]])
+ {
+ [NSApp setPresentationOptions:(NSApplicationPresentationHideDock | NSApplicationPresentationAutoHideMenuBar)];
+ }
+ //Make window borderless and enlarge it
+ [m_window setStyleMask:NSBorderlessWindowMask];
+ [m_window setFrame:[[m_window screen] frame] display:YES];
+>>>>>>> .merge-right.r30358
[m_window makeFirstResponder:m_openGLView];
+<<<<<<< .working
#else
//With 10.5, we need to create a new window to change its style to borderless
//Hide menu & dock if needed
@@ -791,6 +1057,65 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state)
//Make window normal and resize it
[m_window setStyleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)];
[m_window setFrame:[[m_window screen] visibleFrame] display:YES];
+=======
+#else
+ //With 10.5, we need to create a new window to change its style to borderless
+ //Hide menu & dock if needed
+ if ([[m_window screen] isEqual:[[NSScreen screens] objectAtIndex:0]])
+ {
+ //Cocoa function in 10.5 does not allow to set the menu bar in auto-show mode [NSMenu setMenuBarVisible:NO];
+ //One of the very few 64bit compatible Carbon function
+ SetSystemUIMode(kUIModeAllHidden,kUIOptionAutoShowMenuBar);
+ }
+ //Create a fullscreen borderless window
+ CocoaWindow *tmpWindow = [[CocoaWindow alloc]
+ initWithContentRect:[[m_window screen] frame]
+ styleMask:NSBorderlessWindowMask
+ backing:NSBackingStoreBuffered
+ defer:YES];
+ //Copy current window parameters
+ [tmpWindow setTitle:[m_window title]];
+ [tmpWindow setRepresentedFilename:[m_window representedFilename]];
+ [tmpWindow setReleasedWhenClosed:NO];
+ [tmpWindow setAcceptsMouseMovedEvents:YES];
+ [tmpWindow setDelegate:[m_window delegate]];
+
+ //Assign the openGL view to the new window
+ [tmpWindow setContentView:m_openGLView];
+
+ //Show the new window
+ [tmpWindow makeKeyAndOrderFront:nil];
+ //Close and release old window
+ [m_window setDelegate:nil]; // To avoid the notification of "window closed" event
+ [m_window close];
+ [m_window release];
+ m_window = tmpWindow;
+#endif
+
+ //Tell WM of view new size
+ m_systemCocoa->handleWindowEvent(GHOST_kEventWindowSize, this);
+
+ [pool drain];
+ }
+ break;
+ case GHOST_kWindowStateNormal:
+ default:
+ if (m_fullScreen)
+ {
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ m_fullScreen = false;
+
+ //Exit fullscreen
+#ifdef MAC_OS_X_VERSION_10_6
+ //Show again menu & dock if needed
+ if ([[m_window screen] isEqual:[NSScreen mainScreen]])
+ {
+ [NSApp setPresentationOptions:NSApplicationPresentationDefault];
+ }
+ //Make window normal and resize it
+ [m_window setStyleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)];
+ [m_window setFrame:[[m_window screen] visibleFrame] display:YES];
+>>>>>>> .merge-right.r30358
//TODO for 10.6 only : window title is forgotten after the style change
[m_window makeFirstResponder:m_openGLView];
#else
@@ -969,6 +1294,7 @@ GHOST_TSuccess GHOST_WindowCocoa::installDrawingContext(GHOST_TDrawingContextTyp
m_openGLContext = tmpOpenGLContext;
break;
+<<<<<<< .working
case GHOST_kDrawingContextTypeNone:
success = GHOST_kSuccess;
break;
@@ -1077,7 +1403,176 @@ void GHOST_WindowCocoa::loadCursor(bool visible, GHOST_TStandardCursor cursor) c
case GHOST_kStandardCursorTopRightCorner:
case GHOST_kStandardCursorBottomRightCorner:
case GHOST_kStandardCursorBottomLeftCorner:
+=======
+ case GHOST_kDrawingContextTypeNone:
+ success = GHOST_kSuccess;
+ break;
+
+ default:
+ break;
+ }
+ [pool drain];
+ return success;
+}
+
+
+GHOST_TSuccess GHOST_WindowCocoa::removeDrawingContext()
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ switch (m_drawingContextType) {
+ case GHOST_kDrawingContextTypeOpenGL:
+ if (m_openGLContext)
+ {
+ [m_openGLView clearGLContext];
+ if (s_firstOpenGLcontext == m_openGLContext) s_firstOpenGLcontext = nil;
+ m_openGLContext = nil;
+ }
+ [pool drain];
+ return GHOST_kSuccess;
+ case GHOST_kDrawingContextTypeNone:
+ [pool drain];
+ return GHOST_kSuccess;
+ break;
+ default:
+ [pool drain];
+ return GHOST_kFailure;
+ }
+}
+
+
+GHOST_TSuccess GHOST_WindowCocoa::invalidate()
+{
+ GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::invalidate(): window invalid")
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ [m_openGLView setNeedsDisplay:YES];
+ [pool drain];
+ return GHOST_kSuccess;
+}
+
+#pragma mark Progress bar
+
+GHOST_TSuccess GHOST_WindowCocoa::setProgressBar(float progress)
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ if ((progress >=0.0) && (progress <=1.0)) {
+ NSImage* dockIcon = [[NSImage alloc] initWithSize:NSMakeSize(128,128)];
+
+ [dockIcon lockFocus];
+ NSRect progressBox = {{4, 4}, {120, 16}};
+
+ [[NSImage imageNamed:@"NSApplicationIcon"] dissolveToPoint:NSZeroPoint fraction:1.0];
+
+ // Track & Outline
+ [[NSColor blackColor] setFill];
+ NSRectFill(progressBox);
+
+ [[NSColor whiteColor] set];
+ NSFrameRect(progressBox);
+
+ // Progress fill
+ progressBox = NSInsetRect(progressBox, 1, 1);
+ [[NSColor knobColor] setFill];
+ progressBox.size.width = progressBox.size.width * progress;
+ NSRectFill(progressBox);
+
+ [dockIcon unlockFocus];
+
+ [NSApp setApplicationIconImage:dockIcon];
+ [dockIcon release];
+
+ m_progressBarVisible = true;
+ }
+
+ [pool drain];
+ return GHOST_kSuccess;
+}
+
+
+GHOST_TSuccess GHOST_WindowCocoa::endProgressBar()
+{
+ if (!m_progressBarVisible) return GHOST_kFailure;
+ m_progressBarVisible = false;
+
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ NSImage* dockIcon = [[NSImage alloc] initWithSize:NSMakeSize(128,128)];
+ [dockIcon lockFocus];
+ [[NSImage imageNamed:@"NSApplicationIcon"] dissolveToPoint:NSZeroPoint fraction:1.0];
+ [dockIcon unlockFocus];
+ [NSApp setApplicationIconImage:dockIcon];
+ [dockIcon release];
+
+ [pool drain];
+ return GHOST_kSuccess;
+}
+
+
+
+#pragma mark Cursor handling
+
+void GHOST_WindowCocoa::loadCursor(bool visible, GHOST_TStandardCursor cursor) const
+{
+ static bool systemCursorVisible = true;
+
+ NSCursor *tmpCursor =nil;
+
+ if (visible != systemCursorVisible) {
+ if (visible) {
+ [NSCursor unhide];
+ systemCursorVisible = true;
+ }
+ else {
+ [NSCursor hide];
+ systemCursorVisible = false;
+ }
+ }
+
+ if (cursor == GHOST_kStandardCursorCustom && m_customCursor) {
+ tmpCursor = m_customCursor;
+ } else {
+ switch (cursor) {
+ case GHOST_kStandardCursorDestroy:
+ tmpCursor = [NSCursor disappearingItemCursor];
+ break;
+ case GHOST_kStandardCursorText:
+ tmpCursor = [NSCursor IBeamCursor];
+ break;
+ case GHOST_kStandardCursorCrosshair:
+ tmpCursor = [NSCursor crosshairCursor];
+ break;
+ case GHOST_kStandardCursorUpDown:
+ tmpCursor = [NSCursor resizeUpDownCursor];
+ break;
+ case GHOST_kStandardCursorLeftRight:
+ tmpCursor = [NSCursor resizeLeftRightCursor];
+ break;
+ case GHOST_kStandardCursorTopSide:
+ tmpCursor = [NSCursor resizeUpCursor];
+ break;
+ case GHOST_kStandardCursorBottomSide:
+ tmpCursor = [NSCursor resizeDownCursor];
+ break;
+ case GHOST_kStandardCursorLeftSide:
+ tmpCursor = [NSCursor resizeLeftCursor];
+ break;
+ case GHOST_kStandardCursorRightSide:
+ tmpCursor = [NSCursor resizeRightCursor];
+ break;
+ case GHOST_kStandardCursorRightArrow:
+ case GHOST_kStandardCursorInfo:
+ case GHOST_kStandardCursorLeftArrow:
+ case GHOST_kStandardCursorHelp:
+ case GHOST_kStandardCursorCycle:
+ case GHOST_kStandardCursorSpray:
+ case GHOST_kStandardCursorWait:
+ case GHOST_kStandardCursorTopLeftCorner:
+ case GHOST_kStandardCursorTopRightCorner:
+ case GHOST_kStandardCursorBottomRightCorner:
+ case GHOST_kStandardCursorBottomLeftCorner:
+>>>>>>> .merge-right.r30358
case GHOST_kStandardCursorCopy:
+<<<<<<< .working
case GHOST_kStandardCursorDefault:
default:
tmpCursor = [NSCursor arrowCursor];
@@ -1100,6 +1595,32 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorVisibility(bool visible)
}
+=======
+ case GHOST_kStandardCursorDefault:
+ default:
+ tmpCursor = [NSCursor arrowCursor];
+ break;
+ };
+ }
+ [tmpCursor set];
+}
+
+
+
+GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorVisibility(bool visible)
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
+
+ if ([m_window isVisible]) {
+ loadCursor(visible, getCursorShape());
+ }
+
+ [pool drain];
+ return GHOST_kSuccess;
+}
+
+
+>>>>>>> .merge-right.r30358
GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorGrab(GHOST_TGrabCursorMode mode)
{
GHOST_TSuccess err = GHOST_kSuccess;
@@ -1142,6 +1663,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorGrab(GHOST_TGrabCursorMode mode
m_cursorGrabBounds.m_l= m_cursorGrabBounds.m_r= -1; /* disable */
}
return err;
+<<<<<<< .working
}
GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorShape(GHOST_TStandardCursor shape)
@@ -1205,6 +1727,74 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
samplesPerPixel:2
hasAlpha:YES
isPlanar:YES
+=======
+}
+
+GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorShape(GHOST_TStandardCursor shape)
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ if (m_customCursor) {
+ [m_customCursor release];
+ m_customCursor = nil;
+ }
+
+ if ([m_window isVisible]) {
+ loadCursor(getCursorVisibility(), shape);
+ }
+
+ [pool drain];
+ return GHOST_kSuccess;
+}
+
+/** Reverse the bits in a GHOST_TUns8
+static GHOST_TUns8 uns8ReverseBits(GHOST_TUns8 ch)
+{
+ ch= ((ch>>1)&0x55) | ((ch<<1)&0xAA);
+ ch= ((ch>>2)&0x33) | ((ch<<2)&0xCC);
+ ch= ((ch>>4)&0x0F) | ((ch<<4)&0xF0);
+ return ch;
+}
+*/
+
+
+/** Reverse the bits in a GHOST_TUns16 */
+static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
+{
+ shrt= ((shrt>>1)&0x5555) | ((shrt<<1)&0xAAAA);
+ shrt= ((shrt>>2)&0x3333) | ((shrt<<2)&0xCCCC);
+ shrt= ((shrt>>4)&0x0F0F) | ((shrt<<4)&0xF0F0);
+ shrt= ((shrt>>8)&0x00FF) | ((shrt<<8)&0xFF00);
+ return shrt;
+}
+
+GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
+ int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color)
+{
+ int y,nbUns16;
+ NSPoint hotSpotPoint;
+ NSBitmapImageRep *cursorImageRep;
+ NSImage *cursorImage;
+ NSSize imSize;
+ GHOST_TUns16 *cursorBitmap;
+
+
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ if (m_customCursor) {
+ [m_customCursor release];
+ m_customCursor = nil;
+ }
+
+
+ cursorImageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil
+ pixelsWide:sizex
+ pixelsHigh:sizey
+ bitsPerSample:1
+ samplesPerPixel:2
+ hasAlpha:YES
+ isPlanar:YES
+>>>>>>> .merge-right.r30358
colorSpaceName:NSDeviceWhiteColorSpace
bytesPerRow:(sizex/8 + (sizex%8 >0 ?1:0))
bitsPerPixel:1];
diff --git a/intern/ghost/intern/GHOST_WindowManager.cpp b/intern/ghost/intern/GHOST_WindowManager.cpp
index c43307c9513..1ac357ac97f 100644
--- a/intern/ghost/intern/GHOST_WindowManager.cpp
+++ b/intern/ghost/intern/GHOST_WindowManager.cpp
@@ -34,10 +34,6 @@
* @date May 11, 2001
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GHOST_WindowManager.h"
#include <algorithm>
#include "GHOST_Debug.h"
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 4aeccd7fe2a..1366aebf9e7 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -34,10 +34,6 @@
* @date May 10, 2001
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include <string.h>
#include "GHOST_WindowWin32.h"
#include "GHOST_SystemWin32.h"
@@ -68,6 +64,7 @@
LPCSTR GHOST_WindowWin32::s_windowClassName = "GHOST_WindowClass";
const int GHOST_WindowWin32::s_maxTitleLength = 128;
HGLRC GHOST_WindowWin32::s_firsthGLRc = NULL;
+HDC GHOST_WindowWin32::s_firstHDC = NULL;
static int WeightPixelFormat(PIXELFORMATDESCRIPTOR& pfd);
static int EnumPixelFormats(HDC hdc);
@@ -138,6 +135,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(
m_top(top),
m_width(width),
m_height(height),
+ m_normal_state(GHOST_kWindowStateNormal),
m_stereo(stereoVisual),
m_nextWindow(NULL)
{
@@ -158,11 +156,16 @@ GHOST_WindowWin32::GHOST_WindowWin32(
width = tw;
left = rect.left;
}
+ else if(left < rect.left)
+ left = rect.left;
+
if(th < height)
{
height = th;
top = rect.top;
}
+ else if(top < rect.top)
+ top = rect.top;
m_hWnd = ::CreateWindow(
s_windowClassName, // pointer to registered class name
@@ -201,6 +204,10 @@ GHOST_WindowWin32::GHOST_WindowWin32(
// Store the device context
m_hDC = ::GetDC(m_hWnd);
+ if(!s_firstHDC) {
+ s_firstHDC = m_hDC;
+ }
+
// Show the window
int nCmdShow;
switch (state) {
@@ -307,10 +314,11 @@ GHOST_WindowWin32::~GHOST_WindowWin32()
m_customCursor = NULL;
}
+ ::wglMakeCurrent(NULL, NULL);
m_multisampleEnabled = GHOST_kFailure;
m_multisample = 0;
setDrawingContextType(GHOST_kDrawingContextTypeNone);
- if (m_hDC) {
+ if (m_hDC && m_hDC != s_firstHDC) {
::ReleaseDC(m_hWnd, m_hDC);
m_hDC = 0;
}
@@ -481,9 +489,13 @@ void GHOST_WindowWin32::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST
GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
{
+ GHOST_TWindowState curstate = getState();
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
::GetWindowPlacement(m_hWnd, &wp);
+
+ if (state == GHOST_kWindowStateNormal)
+ state = m_normal_state;
switch (state) {
case GHOST_kWindowStateMinimized:
wp.showCmd = SW_SHOWMINIMIZED;
@@ -494,6 +506,8 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW);
break;
case GHOST_kWindowStateFullScreen:
+ if (curstate != state && curstate != GHOST_kWindowStateMinimized)
+ m_normal_state = curstate;
wp.showCmd = SW_SHOWMAXIMIZED;
wp.ptMaxPosition.x = 0;
wp.ptMaxPosition.y = 0;
@@ -636,6 +650,7 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp
m_hGlRc = ::wglCreateContext(m_hDC);
if (m_hGlRc) {
if (s_firsthGLRc) {
+ ::wglCopyContext(s_firsthGLRc, m_hGlRc, GL_ALL_ATTRIB_BITS);
wglShareLists(s_firsthGLRc, m_hGlRc);
} else {
s_firsthGLRc = m_hGlRc;
@@ -1078,7 +1093,7 @@ static int WeightPixelFormat(PIXELFORMATDESCRIPTOR& pfd) {
!(pfd.dwFlags & PFD_DRAW_TO_WINDOW) ||
!(pfd.dwFlags & PFD_DOUBLEBUFFER) || /* Blender _needs_ this */
( pfd.cDepthBits <= 8 ) ||
- !(pfd.iPixelType == PFD_TYPE_RGBA) )
+ !(pfd.iPixelType == PFD_TYPE_RGBA))
return 0;
weight = 1; /* it's usable */
diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h
index 5e1f708f61c..a4d31f87ffa 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.h
+++ b/intern/ghost/intern/GHOST_WindowWin32.h
@@ -315,6 +315,8 @@ protected:
HGLRC m_hGlRc;
/** The first created OpenGL context (for sharing display lists) */
static HGLRC s_firsthGLRc;
+ /** The first created device context handle. */
+ static HDC s_firstHDC;
/** Flag for if window has captured the mouse */
bool m_hasMouseCaptured;
/** Count of number of pressed buttons */
@@ -351,6 +353,7 @@ protected:
GHOST_TInt32 m_top;
GHOST_TUns32 m_width;
GHOST_TUns32 m_height;
+ GHOST_TWindowState m_normal_state;
bool m_stereo;
/** The GHOST_System passes this to wm if this window is being replaced */
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 9be278706a8..60e12ff78df 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -57,6 +57,9 @@ typedef struct {
#define MWM_HINTS_DECORATIONS (1L << 1)
+
+// #define GHOST_X11_GRAB
+
/*
* A Client can't change the window property, that is
* the work of the window manager. In case, we send
@@ -159,6 +162,7 @@ GHOST_WindowX11(
GHOST_Window(title,left,top,width,height,state,type,stereoVisual,numOfAASamples),
m_context(NULL),
m_display(display),
+ m_normal_state(GHOST_kWindowStateNormal),
m_system (system),
m_valid_setup (false),
m_invalid_window(false),
@@ -1036,6 +1040,9 @@ GHOST_TSuccess GHOST_WindowX11::setState(GHOST_TWindowState state)
is_motif_full = motifIsFullScreen();
+ if (state == GHOST_kWindowStateNormal)
+ state = m_normal_state;
+
if (state == GHOST_kWindowStateNormal) {
if (is_max == True)
netwmMaximized(False);
@@ -1055,6 +1062,8 @@ GHOST_TSuccess GHOST_WindowX11::setState(GHOST_TWindowState state)
if (cur_state == GHOST_kWindowStateMinimized)
return (GHOST_kFailure);
+ m_normal_state = cur_state;
+
if (is_max == True)
netwmMaximized(False);
if (is_full == False)
@@ -1436,7 +1445,9 @@ setWindowCursorGrab(
setWindowCursorVisibility(false);
}
+#ifdef GHOST_X11_GRAB
XGrabPointer(m_display, m_window, False, ButtonPressMask| ButtonReleaseMask|PointerMotionMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
+#endif
}
else {
if (m_cursorGrab==GHOST_kGrabHide) {
@@ -1454,7 +1465,9 @@ setWindowCursorGrab(
/* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */
setCursorGrabAccum(0, 0);
m_cursorGrabBounds.m_l= m_cursorGrabBounds.m_r= -1; /* disable */
+#ifdef GHOST_X11_GRAB
XUngrabPointer(m_display, CurrentTime);
+#endif
}
XFlush(m_display);
diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h
index f2420c4c493..2f45378117d 100644
--- a/intern/ghost/intern/GHOST_WindowX11.h
+++ b/intern/ghost/intern/GHOST_WindowX11.h
@@ -327,6 +327,7 @@ private :
Window m_window;
Display *m_display;
XVisualInfo *m_visual;
+ GHOST_TWindowState m_normal_state;
/** The first created OpenGL context (for sharing display lists) */
static GLXContext s_firstContext;
diff --git a/intern/ghost/intern/Makefile b/intern/ghost/intern/Makefile
index 23d27e61590..2f5e088f4fe 100644
--- a/intern/ghost/intern/Makefile
+++ b/intern/ghost/intern/Makefile
@@ -38,7 +38,7 @@ CCSRCS += GHOST_EventManager.cpp GHOST_EventPrinter.cpp GHOST_WindowManager.cpp
CCSRCS += GHOST_ISystem.cpp GHOST_ModifierKeys.cpp GHOST_TimerManager.cpp
CCSRCS += GHOST_Rect.cpp GHOST_DisplayManager.cpp GHOST_C-api.cpp
CCSRCS += GHOST_CallbackEventConsumer.cpp
-CCSRCS += GHOST_NDOFManager.cpp
+CCSRCS += GHOST_NDOFManager.cpp GHOST_Path-api.cpp
ifeq ($(OS),$(findstring $(OS), "darwin"))
ifeq ($(WITH_COCOA), true)
diff --git a/intern/ghost/make/msvc_9_0/ghost.vcproj b/intern/ghost/make/msvc_9_0/ghost.vcproj
index 05a103791f1..b51e14275c9 100644
--- a/intern/ghost/make/msvc_9_0/ghost.vcproj
+++ b/intern/ghost/make/msvc_9_0/ghost.vcproj
@@ -44,7 +44,7 @@
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\lib\windows\wintab\INCLUDE;..\..\..\..\..\build\msvc_9\extern\glew\include"
+ AdditionalIncludeDirectories="..\..;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\lib\windows\wintab\INCLUDE;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\blender\imbuf;..\..\..\..\source\blender\makesdna"
PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
StringPooling="true"
RuntimeLibrary="0"
@@ -197,7 +197,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\lib\windows\wintab\INCLUDE;..\..\..\..\..\build\msvc_9\extern\glew\include"
+ AdditionalIncludeDirectories="..\..;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\lib\windows\wintab\INCLUDE;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\blender\imbuf;..\..\..\..\source\blender\makesdna"
PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
StringPooling="true"
RuntimeLibrary="2"
@@ -273,7 +273,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\..;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\lib\windows\wintab\INCLUDE;..\..\..\..\..\build\msvc_9\extern\glew\include"
+ AdditionalIncludeDirectories="..\..;..\..\..\..\..\build\msvc_9\intern\string\include;..\..\..\..\..\lib\windows\wintab\INCLUDE;..\..\..\..\..\build\msvc_9\extern\glew\include;..\..\..\..\source\blender\imbuf;..\..\..\..\source\blender\makesdna"
PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -469,6 +469,10 @@
>
</File>
<File
+ RelativePath="..\..\GHOST_Path-api.h"
+ >
+ </File>
+ <File
RelativePath="..\..\GHOST_Rect.h"
>
</File>
@@ -526,6 +530,10 @@
>
</File>
<File
+ RelativePath="..\..\intern\GHOST_Path-api.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\intern\GHOST_Rect.cpp"
>
</File>
diff --git a/intern/ghost/test/gears/GHOST_C-Test.c b/intern/ghost/test/gears/GHOST_C-Test.c
index b57e38b4688..e8e818abca7 100644
--- a/intern/ghost/test/gears/GHOST_C-Test.c
+++ b/intern/ghost/test/gears/GHOST_C-Test.c
@@ -45,10 +45,6 @@
#define FALSE 0
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GHOST_C-api.h"
#if defined(WIN32) || defined(__APPLE__)
diff --git a/intern/ghost/test/gears/GHOST_Test.cpp b/intern/ghost/test/gears/GHOST_Test.cpp
index 92e7f4997bc..6e269e1cede 100644
--- a/intern/ghost/test/gears/GHOST_Test.cpp
+++ b/intern/ghost/test/gears/GHOST_Test.cpp
@@ -41,10 +41,6 @@
#include <iostream>
#include <math.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#if defined(WIN32) || defined(__APPLE__)
#ifdef WIN32
#include <windows.h>
diff --git a/intern/ghost/test/multitest/Basic.c b/intern/ghost/test/multitest/Basic.c
index be463b39bd5..1510c47f28a 100644
--- a/intern/ghost/test/multitest/Basic.c
+++ b/intern/ghost/test/multitest/Basic.c
@@ -28,10 +28,6 @@
#include "Basic.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
int min_i(int a, int b) {
return (a<b)?a:b;
}
diff --git a/intern/ghost/test/multitest/EventToBuf.c b/intern/ghost/test/multitest/EventToBuf.c
index 0c855c36ded..1dbaad35994 100644
--- a/intern/ghost/test/multitest/EventToBuf.c
+++ b/intern/ghost/test/multitest/EventToBuf.c
@@ -30,10 +30,6 @@
#include <stdio.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MEM_guardedalloc.h"
#include "GHOST_C-api.h"
diff --git a/intern/ghost/test/multitest/MultiTest.c b/intern/ghost/test/multitest/MultiTest.c
index cc28ec23986..848601b2cc7 100644
--- a/intern/ghost/test/multitest/MultiTest.c
+++ b/intern/ghost/test/multitest/MultiTest.c
@@ -39,10 +39,6 @@
#include "GL.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MEM_guardedalloc.h"
#include "GHOST_C-api.h"
diff --git a/intern/ghost/test/multitest/ScrollBar.c b/intern/ghost/test/multitest/ScrollBar.c
index 34219be1bed..7574a5c85f1 100644
--- a/intern/ghost/test/multitest/ScrollBar.c
+++ b/intern/ghost/test/multitest/ScrollBar.c
@@ -30,10 +30,6 @@
#include <math.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MEM_guardedalloc.h"
#include "Basic.h"
diff --git a/intern/ghost/test/multitest/Util.c b/intern/ghost/test/multitest/Util.c
index 0bc152f6543..abc4c2651e4 100644
--- a/intern/ghost/test/multitest/Util.c
+++ b/intern/ghost/test/multitest/Util.c
@@ -32,10 +32,6 @@
#include <stdarg.h>
#include <stdio.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MEM_guardedalloc.h"
#include "Util.h"
diff --git a/intern/ghost/test/multitest/WindowData.c b/intern/ghost/test/multitest/WindowData.c
index 8d8ac8ff426..0a4c2aa8d00 100644
--- a/intern/ghost/test/multitest/WindowData.c
+++ b/intern/ghost/test/multitest/WindowData.c
@@ -28,10 +28,6 @@
#include <stdlib.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MEM_guardedalloc.h"
#include "GHOST_C-api.h"
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h
index 1d001ea6074..8c5caa6f359 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -66,7 +66,7 @@ extern "C" {
/** Returns the lenght of the allocated memory segment pointed at
* by vmemh. If the pointer was not previously allocated by this
* module, the result is undefined.*/
- int MEM_allocN_len(void *vmemh);
+ size_t MEM_allocN_len(void *vmemh);
/**
* Release memory previously allocatred by this module.
@@ -93,23 +93,23 @@ extern "C" {
* allocated block, the old one is freed. this is not as optimized
* as a system realloc but just makes a new allocation and copies
* over from existing memory. */
- void *MEM_reallocN(void *vmemh, unsigned int len);
+ void *MEM_reallocN(void *vmemh, size_t len);
/**
* Allocate a block of memory of size len, with tag name str. The
* memory is cleared. The name must be static, because only a
* pointer to it is stored ! */
- void *MEM_callocN(unsigned int len, const char * str);
+ void *MEM_callocN(size_t len, const char * str);
/** Allocate a block of memory of size len, with tag name str. The
* name must be a static, because only a pointer to it is stored !
* */
- void *MEM_mallocN(unsigned int len, const char * str);
+ void *MEM_mallocN(size_t len, const char * str);
/** Same as callocN, clears memory and uses mmap (disk cached) if supported.
Can be free'd with MEM_freeN as usual.
* */
- void *MEM_mapallocN(unsigned int len, const char * str);
+ void *MEM_mapallocN(size_t len, const char * str);
/** Print a list of the names and sizes of all allocated memory
* blocks. as a python dict for easy investigation */
@@ -150,16 +150,15 @@ extern "C" {
/********* Internal structs. They're only here for the MEM_OVERHEAD macro.*********/
-/* --------------------------------------------------------------------- */
-/* Data definition */
-/* --------------------------------------------------------------------- */
+/*BMESH_TODO/XXX: note to self, don't merge this into trunk*/
+
/* all memory chunks are put in linked lists */
typedef struct localLink
{
struct localLink *next,*prev;
} localLink;
-typedef struct localListBase
+typedef struct localListBase
{
void *first, *last;
} localListBase;
@@ -167,12 +166,15 @@ typedef struct localListBase
/* note: keep this struct aligned (e.g., irix/gcc) - Hos */
typedef struct MemHead {
int tag1;
- int len;
+ size_t len;
struct MemHead *next,*prev;
const char * name;
const char * nextname;
int tag2;
int mmap; /* if true, memory was mmapped */
+#ifdef DEBUG_MEMCOUNTER
+ int _count;
+#endif
} MemHead;
typedef struct MemTail {
@@ -186,6 +188,12 @@ typedef struct MemTail {
#define MEM_OVERHEAD (sizeof(MemHead) + sizeof(MemTail) + MEM_OVERHEADBIAS)
+/*reset the peak memory statistic to zero*/
+void MEM_reset_peak_memory(void);
+
+/*get the peak memory usage in bytes, including mmap allocations*/
+uintptr_t MEM_get_peak_memory(void);
+
#ifdef __cplusplus
}
#endif
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index 42f5443aef2..0a0c9485a39 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -36,19 +36,30 @@
#include <stdlib.h>
#include <string.h> /* memcpy */
#include <stdarg.h>
+#include <sys/types.h>
+/* Blame Microsoft for LLP64 and no inttypes.h, quick workaround needed: */
+#if defined(WIN64)
+#define SIZET_FORMAT "%I64u"
+#define SIZET_ARG(a) ((unsigned long long)(a))
+#else
+#define SIZET_FORMAT "%lu"
+#define SIZET_ARG(a) ((unsigned long)(a))
+#endif
/* mmap exception */
#if defined(WIN32)
-#include <sys/types.h>
#include "mmap_win.h"
#else
-#include <sys/types.h>
#include <sys/mman.h>
#endif
#include "MEM_guardedalloc.h"
/* --------------------------------------------------------------------- */
+/* Data definition */
+/* --------------------------------------------------------------------- */
+
+/* --------------------------------------------------------------------- */
/* local functions */
/* --------------------------------------------------------------------- */
@@ -82,7 +93,7 @@ static const char *check_memlist(MemHead *memh);
static volatile int totblock= 0;
-static volatile uintptr_t mem_in_use= 0, mmap_in_use= 0;
+static volatile uintptr_t mem_in_use= 0, mmap_in_use= 0, peak_mem = 0;
static volatile struct localListBase _membase;
static volatile struct localListBase *membase = &_membase;
@@ -164,7 +175,7 @@ void MEM_set_memory_debug(void)
malloc_debug_memset= 1;
}
-int MEM_allocN_len(void *vmemh)
+size_t MEM_allocN_len(void *vmemh)
{
if (vmemh) {
MemHead *memh= vmemh;
@@ -175,36 +186,36 @@ int MEM_allocN_len(void *vmemh)
return 0;
}
-void *MEM_reallocN(void *vmemh, unsigned int len)
+void *MEM_reallocN(void *vmemh, size_t len)
{
void *newp= NULL;
if (vmemh) {
MemHead *memh= vmemh;
memh--;
+
+ if(memh->mmap)
+ newp= MEM_mapallocN(len, "dupli_mapalloc");
+ else
+ newp= MEM_mallocN(len, "dupli_alloc");
- newp= MEM_mallocN(len, memh->name);
- if(newp) {
- if(len < memh->len)
- memcpy(newp, vmemh, len);
- else
- memcpy(newp, vmemh, memh->len);
- }
+ if (newp == NULL) return NULL;
- MEM_freeN(vmemh);
+ memcpy(newp, vmemh, len<=memh->len ? len : memh->len);
}
return newp;
}
+
void *MEM_dupallocN(void *vmemh)
{
void *newp= NULL;
-
+
if (vmemh) {
MemHead *memh= vmemh;
memh--;
-
+
if(memh->mmap)
newp= MEM_mapallocN(memh->len, "dupli_mapalloc");
else
@@ -218,7 +229,7 @@ void *MEM_dupallocN(void *vmemh)
return newp;
}
-static void make_memhead_header(MemHead *memh, unsigned int len, const char *str)
+static void make_memhead_header(MemHead *memh, size_t len, const char *str)
{
MemTail *memt;
@@ -238,9 +249,11 @@ static void make_memhead_header(MemHead *memh, unsigned int len, const char *str
totblock++;
mem_in_use += len;
+
+ peak_mem = mem_in_use > peak_mem ? mem_in_use : peak_mem;
}
-void *MEM_mallocN(unsigned int len, const char *str)
+void *MEM_mallocN(size_t len, const char *str)
{
MemHead *memh;
@@ -258,11 +271,11 @@ void *MEM_mallocN(unsigned int len, const char *str)
return (++memh);
}
mem_unlock_thread();
- print_error("Malloc returns nill: len=%d in %s, total %u\n",len, str, mem_in_use);
+ print_error("Malloc returns null: len=" SIZET_FORMAT " in %s, total %u\n", SIZET_ARG(len), str, mem_in_use);
return NULL;
}
-void *MEM_callocN(unsigned int len, const char *str)
+void *MEM_callocN(size_t len, const char *str)
{
MemHead *memh;
@@ -278,12 +291,12 @@ void *MEM_callocN(unsigned int len, const char *str)
return (++memh);
}
mem_unlock_thread();
- print_error("Calloc returns nill: len=%d in %s, total %u\n",len, str, mem_in_use);
+ print_error("Calloc returns null: len=" SIZET_FORMAT " in %s, total %u\n", SIZET_ARG(len), str, mem_in_use);
return 0;
}
/* note; mmap returns zero'd memory */
-void *MEM_mapallocN(unsigned int len, const char *str)
+void *MEM_mapallocN(size_t len, const char *str)
{
MemHead *memh;
@@ -311,12 +324,13 @@ void *MEM_mapallocN(unsigned int len, const char *str)
make_memhead_header(memh, len, str);
memh->mmap= 1;
mmap_in_use += len;
+ peak_mem = mmap_in_use > peak_mem ? mmap_in_use : peak_mem;
mem_unlock_thread();
return (++memh);
}
else {
mem_unlock_thread();
- print_error("Mapalloc returns nill, fallback to regular malloc: len=%d in %s, total %u\n",len, str, mmap_in_use);
+ print_error("Mapalloc returns null, fallback to regular malloc: len=" SIZET_FORMAT " in %s, total %u\n", SIZET_ARG(len), str, mmap_in_use);
return MEM_callocN(len, str);
}
}
@@ -399,12 +413,17 @@ void MEM_printmemlist_stats()
/* sort by length and print */
qsort(printblock, totpb, sizeof(MemPrintBlock), compare_len);
printf("\ntotal memory len: %.3f MB\n", (double)mem_in_use/(double)(1024*1024));
+ printf(" ITEMS TOTAL-MiB AVERAGE-KiB TYPE\n");
for(a=0, pb=printblock; a<totpb; a++, pb++)
- printf("%s items: %d, len: %.3f MB\n", pb->name, pb->items, (double)pb->len/(double)(1024*1024));
+ printf("%6d (%8.3f %8.3f) %s\n", pb->items, (double)pb->len/(double)(1024*1024), (double)pb->len/1024.0/(double)pb->items, pb->name);
free(printblock);
mem_unlock_thread();
+
+#if 0 /* GLIBC only */
+ malloc_stats();
+#endif
}
/* Prints in python syntax for easy */
@@ -423,9 +442,13 @@ static void MEM_printmemlist_internal( int pydict )
}
while(membl) {
if (pydict) {
- fprintf(stderr, "{'len':%i, 'name':'''%s''', 'pointer':'%p'},\\\n", membl->len, membl->name, membl+1);
+ fprintf(stderr, "{'len':" SIZET_FORMAT ", 'name':'''%s''', 'pointer':'%p'},\\\n", SIZET_ARG(membl->len), membl->name, membl+1);
} else {
- print_error("%s len: %d %p\n",membl->name,membl->len, membl+1);
+#ifdef DEBUG_MEMCOUNTER
+ print_error("%s len: " SIZET_FORMAT " %p, count: %d\n", membl->name, SIZET_ARG(membl->len), membl+1, membl->_count);
+#else
+ print_error("%s len: " SIZET_FORMAT " %p\n", membl->name, SIZET_ARG(membl->len), membl+1);
+#endif
}
if(membl->next)
membl= MEMNEXT(membl->next);
@@ -745,6 +768,24 @@ static const char *check_memlist(MemHead *memh)
return(name);
}
+uintptr_t MEM_get_peak_memory(void)
+{
+ uintptr_t _peak_mem;
+
+ mem_lock_thread();
+ _peak_mem = peak_mem;
+ mem_unlock_thread();
+
+ return _peak_mem;
+}
+
+void MEM_reset_peak_memory(void)
+{
+ mem_lock_thread();
+ peak_mem = 0;
+ mem_unlock_thread();
+}
+
uintptr_t MEM_get_memory_in_use(void)
{
uintptr_t _mem_in_use;
diff --git a/intern/guardedalloc/test/simpletest/memtest.c b/intern/guardedalloc/test/simpletest/memtest.c
index 51f1f491894..98f943f0d7d 100644
--- a/intern/guardedalloc/test/simpletest/memtest.c
+++ b/intern/guardedalloc/test/simpletest/memtest.c
@@ -43,10 +43,6 @@
#include <stdlib.h>
#include "MEM_guardedalloc.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
static void mem_error_cb(const char *errorStr)
{
fprintf(stderr, "%s", errorStr);
diff --git a/intern/iksolver/intern/IK_QSegment.cpp b/intern/iksolver/intern/IK_QSegment.cpp
index 50364f3627f..5de5846cb61 100644
--- a/intern/iksolver/intern/IK_QSegment.cpp
+++ b/intern/iksolver/intern/IK_QSegment.cpp
@@ -28,9 +28,6 @@
*/
#include "IK_QSegment.h"
-#ifdef WIN32
-#define _USE_MATH_DEFINES
-#endif
#include <cmath>
// Utility functions
@@ -372,8 +369,8 @@ void IK_QSphericalSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax)
return;
if (axis == 1) {
- lmin = MT_clamp(lmin, -M_PI, M_PI);
- lmax = MT_clamp(lmax, -M_PI, M_PI);
+ lmin = MT_clamp(lmin, -MT_PI, MT_PI);
+ lmax = MT_clamp(lmax, -MT_PI, MT_PI);
m_min_y = lmin;
m_max_y = lmax;
@@ -382,8 +379,8 @@ void IK_QSphericalSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax)
}
else {
// clamp and convert to axis angle parameters
- lmin = MT_clamp(lmin, -M_PI, M_PI);
- lmax = MT_clamp(lmax, -M_PI, M_PI);
+ lmin = MT_clamp(lmin, -MT_PI, MT_PI);
+ lmax = MT_clamp(lmax, -MT_PI, MT_PI);
lmin = sin(lmin*0.5);
lmax = sin(lmax*0.5);
@@ -615,8 +612,8 @@ void IK_QRevoluteSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax)
return;
// clamp and convert to axis angle parameters
- lmin = MT_clamp(lmin, -M_PI, M_PI);
- lmax = MT_clamp(lmax, -M_PI, M_PI);
+ lmin = MT_clamp(lmin, -MT_PI, MT_PI);
+ lmax = MT_clamp(lmax, -MT_PI, MT_PI);
m_min = lmin;
m_max = lmax;
@@ -754,8 +751,8 @@ void IK_QSwingSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax)
return;
// clamp and convert to axis angle parameters
- lmin = MT_clamp(lmin, -M_PI, M_PI);
- lmax = MT_clamp(lmax, -M_PI, M_PI);
+ lmin = MT_clamp(lmin, -MT_PI, MT_PI);
+ lmax = MT_clamp(lmax, -MT_PI, MT_PI);
lmin = sin(lmin*0.5);
lmax = sin(lmax*0.5);
@@ -900,8 +897,8 @@ void IK_QElbowSegment::SetLimit(int axis, MT_Scalar lmin, MT_Scalar lmax)
return;
// clamp and convert to axis angle parameters
- lmin = MT_clamp(lmin, -M_PI, M_PI);
- lmax = MT_clamp(lmax, -M_PI, M_PI);
+ lmin = MT_clamp(lmin, -MT_PI, MT_PI);
+ lmax = MT_clamp(lmax, -MT_PI, MT_PI);
lmin = lmin;
lmax = lmax;
diff --git a/intern/iksolver/intern/TNT/svd.h b/intern/iksolver/intern/TNT/svd.h
index 9ca51fa2650..9ae289474a9 100644
--- a/intern/iksolver/intern/TNT/svd.h
+++ b/intern/iksolver/intern/TNT/svd.h
@@ -349,8 +349,9 @@ void SVD(MaTRiX &A, MaTRiX &U, VecToR &s, MaTRiX &V, VecToR &work1, VecToR &work
for (j = k; j < p-1; j++) {
typename MaTRiX::value_type t = hypot(f,g);
- typename MaTRiX::value_type cs = f/t;
- typename MaTRiX::value_type sn = g/t;
+ /* division by zero checks added to avoid NaN (brecht) */
+ typename MaTRiX::value_type cs = (t == 0.0f)? 0.0f: f/t;
+ typename MaTRiX::value_type sn = (t == 0.0f)? 0.0f: g/t;
if (j != k) {
e[j-1] = t;
}
@@ -366,8 +367,9 @@ void SVD(MaTRiX &A, MaTRiX &U, VecToR &s, MaTRiX &V, VecToR &work1, VecToR &work
}
t = hypot(f,g);
- cs = f/t;
- sn = g/t;
+ /* division by zero checks added to avoid NaN (brecht) */
+ cs = (t == 0.0f)? 0.0f: f/t;
+ sn = (t == 0.0f)? 0.0f: g/t;
s[j] = t;
f = cs*e[j] + sn*s[j+1];
s[j+1] = -sn*e[j] + cs*s[j+1];
diff --git a/intern/iksolver/test/ik_glut_test/common/GlutDrawer.cpp b/intern/iksolver/test/ik_glut_test/common/GlutDrawer.cpp
index 7b87c69928f..1882038163d 100644
--- a/intern/iksolver/test/ik_glut_test/common/GlutDrawer.cpp
+++ b/intern/iksolver/test/ik_glut_test/common/GlutDrawer.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GlutDrawer.h"
#include "MT_assert.h"
diff --git a/intern/iksolver/test/ik_glut_test/common/GlutKeyboardManager.cpp b/intern/iksolver/test/ik_glut_test/common/GlutKeyboardManager.cpp
index 9412dc25e42..c7c592204e8 100644
--- a/intern/iksolver/test/ik_glut_test/common/GlutKeyboardManager.cpp
+++ b/intern/iksolver/test/ik_glut_test/common/GlutKeyboardManager.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GlutKeyboardManager.h"
#include "MT_assert.h"
diff --git a/intern/iksolver/test/ik_glut_test/common/GlutMouseManager.cpp b/intern/iksolver/test/ik_glut_test/common/GlutMouseManager.cpp
index 79187a7fd1b..98e36af5c79 100644
--- a/intern/iksolver/test/ik_glut_test/common/GlutMouseManager.cpp
+++ b/intern/iksolver/test/ik_glut_test/common/GlutMouseManager.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "GlutMouseManager.h"
#include "MT_assert.h"
diff --git a/intern/iksolver/test/ik_glut_test/intern/main.cpp b/intern/iksolver/test/ik_glut_test/intern/main.cpp
index f323648dbd7..f2e91ee9c31 100644
--- a/intern/iksolver/test/ik_glut_test/intern/main.cpp
+++ b/intern/iksolver/test/ik_glut_test/intern/main.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MEM_SmartPtr.h"
#ifdef USE_QUATERNIONS
diff --git a/intern/itasc/Armature.cpp b/intern/itasc/Armature.cpp
index 7776b6aa3b6..46d114e6c3f 100644
--- a/intern/itasc/Armature.cpp
+++ b/intern/itasc/Armature.cpp
@@ -340,11 +340,6 @@ int Armature::addLimitConstraint(const std::string& segment_name, unsigned int d
}
if ((joint.getNDof() == 1 && dof > 0) || (joint.getNDof() == 2 && dof > 1))
return -1;
- if (joint.getType() < Joint::TransX || joint.getType() == Joint::Swing) {
- // for rotation joint, the limit is given in degree, convert to radian
- _min *= KDL::deg2rad;
- _max *= KDL::deg2rad;
- }
Joint_struct& p_joint = m_joints[segment_it->second.q_nr+dof];
p_joint.min = _min;
p_joint.max = _max;
diff --git a/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp b/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp
index 5b8fc7f37e8..50700e39203 100644
--- a/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp
+++ b/intern/memutil/intern/MEM_CacheLimiterC-Api.cpp
@@ -20,10 +20,6 @@
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MEM_CacheLimiter.h"
#include "MEM_CacheLimiterC-Api.h"
diff --git a/intern/memutil/intern/MEM_RefCountedC-Api.cpp b/intern/memutil/intern/MEM_RefCountedC-Api.cpp
index f990c8d71ee..3c04d3c4531 100644
--- a/intern/memutil/intern/MEM_RefCountedC-Api.cpp
+++ b/intern/memutil/intern/MEM_RefCountedC-Api.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MEM_RefCountedC-Api.h"
#include "MEM_RefCounted.h"
diff --git a/intern/moto/intern/MT_CmMatrix4x4.cpp b/intern/moto/intern/MT_CmMatrix4x4.cpp
index ff3693cd7d5..e8342f93dd8 100644
--- a/intern/moto/intern/MT_CmMatrix4x4.cpp
+++ b/intern/moto/intern/MT_CmMatrix4x4.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MT_CmMatrix4x4.h"
#include "MT_Vector3.h"
#include "MT_Point3.h"
diff --git a/intern/moto/intern/MT_Matrix3x3.cpp b/intern/moto/intern/MT_Matrix3x3.cpp
index 80bc65fea47..a186ed22296 100644
--- a/intern/moto/intern/MT_Matrix3x3.cpp
+++ b/intern/moto/intern/MT_Matrix3x3.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MT_Matrix3x3.h"
diff --git a/intern/moto/intern/MT_Matrix4x4.cpp b/intern/moto/intern/MT_Matrix4x4.cpp
index 257be4728e8..bab67224cd6 100644
--- a/intern/moto/intern/MT_Matrix4x4.cpp
+++ b/intern/moto/intern/MT_Matrix4x4.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MT_Matrix4x4.h"
diff --git a/intern/moto/intern/MT_Plane3.cpp b/intern/moto/intern/MT_Plane3.cpp
index 0889ede1682..ea64b5c0457 100644
--- a/intern/moto/intern/MT_Plane3.cpp
+++ b/intern/moto/intern/MT_Plane3.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#ifndef GEN_INLINED
#include "MT_Plane3.h"
#include "MT_Plane3.inl"
diff --git a/intern/moto/intern/MT_Point3.cpp b/intern/moto/intern/MT_Point3.cpp
index 8ebeda0098d..882709718fb 100644
--- a/intern/moto/intern/MT_Point3.cpp
+++ b/intern/moto/intern/MT_Point3.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MT_Point3.h"
diff --git a/intern/moto/intern/MT_Quaternion.cpp b/intern/moto/intern/MT_Quaternion.cpp
index 4ed3a9e15c6..c613d72eb5d 100644
--- a/intern/moto/intern/MT_Quaternion.cpp
+++ b/intern/moto/intern/MT_Quaternion.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MT_Quaternion.h"
diff --git a/intern/moto/intern/MT_Transform.cpp b/intern/moto/intern/MT_Transform.cpp
index 986a5c24df0..9d0b371eab2 100644
--- a/intern/moto/intern/MT_Transform.cpp
+++ b/intern/moto/intern/MT_Transform.cpp
@@ -47,10 +47,6 @@
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MT_Transform.h"
void MT_Transform::setValue(const float *m) {
diff --git a/intern/moto/intern/MT_Vector2.cpp b/intern/moto/intern/MT_Vector2.cpp
index 54d15f4087c..f7674a1a753 100644
--- a/intern/moto/intern/MT_Vector2.cpp
+++ b/intern/moto/intern/MT_Vector2.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MT_Vector2.h"
diff --git a/intern/moto/intern/MT_Vector3.cpp b/intern/moto/intern/MT_Vector3.cpp
index 5283f1c9e93..da5bd23ce00 100644
--- a/intern/moto/intern/MT_Vector3.cpp
+++ b/intern/moto/intern/MT_Vector3.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MT_Vector3.h"
diff --git a/intern/moto/intern/MT_Vector4.cpp b/intern/moto/intern/MT_Vector4.cpp
index 9625c3ef53d..d3cea173a64 100644
--- a/intern/moto/intern/MT_Vector4.cpp
+++ b/intern/moto/intern/MT_Vector4.cpp
@@ -26,10 +26,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MT_Vector4.h"
diff --git a/intern/moto/intern/MT_random.cpp b/intern/moto/intern/MT_random.cpp
index aae64391734..b7389497b49 100644
--- a/intern/moto/intern/MT_random.cpp
+++ b/intern/moto/intern/MT_random.cpp
@@ -55,10 +55,6 @@
/* When you use this, send an email to: matumoto@math.keio.ac.jp */
/* with an appropriate reference to your work. */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "MT_random.h"
/* Period parameters */
diff --git a/intern/smoke/CMakeLists.txt b/intern/smoke/CMakeLists.txt
index 1ab323fe70d..8579c76b322 100644
--- a/intern/smoke/CMakeLists.txt
+++ b/intern/smoke/CMakeLists.txt
@@ -24,7 +24,7 @@
#
# ***** END GPL LICENSE BLOCK *****
-SET(INC ${ZLIB_INC} ${PNG_INC} intern ../../extern/bullet2/src ../memutil ../guardealloc)
+SET(INC ${PNG_INC} ${ZLIB_INC} intern ../../extern/bullet2/src ../memutil ../guardealloc)
FILE(GLOB SRC intern/*.cpp)
diff --git a/intern/string/STR_String.h b/intern/string/STR_String.h
index 19875c27fa4..b24dea1d3c9 100644
--- a/intern/string/STR_String.h
+++ b/intern/string/STR_String.h
@@ -202,8 +202,8 @@ protected:
#ifdef WITH_CXX_GUARDEDALLOC
public:
- void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "CXX:STR_String"); }
- void operator delete( void *mem ) { MEM_freeN(mem); }
+ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "CXX:STR_String"); }
+ void operator delete(void *mem) { MEM_freeN(mem); }
#endif
};