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
diff options
context:
space:
mode:
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/CMakeLists.txt98
-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/SConscript7
-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_EventDragnDrop.h2
-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.h22
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm82
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp42
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h15
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp26
-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.mm69
-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.vcproj8
-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
52 files changed, 546 insertions, 260 deletions
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index ba62bcb8e4b..c6ffd4b1913 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -24,57 +24,71 @@
#
# ***** 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
+ )
+
+ ADD_DEFINITIONS(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
+
ENDIF(APPLE)
-BLENDERLIB(bf_ghost "${SRC}" "${INC}")
-#, libtype=['core','player'], priority = [25,15] )
+BLENDERLIB(bf_intern_ghost "${SRC}" "${INC}")
+
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..2e2e19bf01f 100644
--- a/intern/ghost/SConscript
+++ b/intern/ghost/SConscript
@@ -14,7 +14,7 @@ if window_system == 'darwin':
pf = ['GHOST_DisplayManager', 'GHOST_System', 'GHOST_Window', 'GHOST_DropTarget']
defs=['_USE_MATH_DEFINES']
-if window_system in ('linux2', 'openbsd3', 'sunos5', 'freebsd6', 'irix6', 'aix4', 'aix5'):
+if window_system in ('linux2', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'freebsd9', 'irix6', 'aix4', 'aix5'):
for f in pf:
try:
sources.remove('intern' + os.sep + f + 'Win32.cpp')
@@ -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] )
-
+env.BlenderLib ('bf_intern_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15] ) \ No newline at end of file
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_EventDragnDrop.h b/intern/ghost/intern/GHOST_EventDragnDrop.h
index ea13a33f889..1fcfddf5349 100644
--- a/intern/ghost/intern/GHOST_EventDragnDrop.h
+++ b/intern/ghost/intern/GHOST_EventDragnDrop.h
@@ -69,7 +69,7 @@ public:
* @param time The time this event was generated.
* @param type The type of this event.
* @param dataType The type of the drop candidate object
- * @param window The window where the event occured
+ * @param window The window where the event occurred
* @param x The x-coordinate of the location the cursor was at at the time of the event.
* @param y The y-coordinate of the location the cursor was at at the time of the event.
* @param data The "content" dropped in the window
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 b25f8890cf1..3ae8ec02dda 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -155,7 +155,7 @@ public:
* @param draggedObjectType The type object concerned (currently array of file names, string, TIFF image)
* @param mouseX x mouse coordinate (in cocoa base window coordinates)
* @param mouseY y mouse coordinate
- * @param window The window on which the event occured
+ * @param window The window on which the event occurred
* @return Indication whether the event was handled.
*/
GHOST_TSuccess handleDraggingEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType,
@@ -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,9 +228,15 @@ 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
+ * @param window The window on which the event occurred
* @return Indication whether the event was handled.
*/
GHOST_TSuccess handleWindowEvent(GHOST_TEventType eventType, GHOST_WindowCocoa* window);
@@ -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 b66b1e4033d..b7038a30e00 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -807,7 +807,27 @@ GHOST_TSuccess GHOST_SystemCocoa::getCursorPosition(GHOST_TInt32& x, GHOST_TInt3
/**
* @note : expect Cocoa screen coordinates
*/
-GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const
+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;
GHOST_WindowCocoa* window = (GHOST_WindowCocoa*)m_windowManager->getActiveWindow();
@@ -1090,7 +1110,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) {
@@ -1098,7 +1118,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;
@@ -1109,7 +1129,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);
@@ -1117,7 +1137,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';
@@ -1279,6 +1299,11 @@ GHOST_TUns8 GHOST_SystemCocoa::handleQuitRequest()
NSArray *windowsList = [NSApp orderedWindows];
if ([windowsList count]) {
[[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil];
+ //Handle the modifiers keyes changed state issue
+ //as recovering from the quit dialog is like application
+ //gaining focus back.
+ //Main issue fixed is Cmd modifier not being cleared
+ handleApplicationBecomeActiveEvent();
}
}
@@ -1517,7 +1542,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);
@@ -1530,7 +1555,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
NSPoint mousePos = [event locationInWindow];
pushEvent(new GHOST_EventCursor([event timestamp]*1000, GHOST_kEventCursorMove, window, mousePos.x, mousePos.y));
m_cursorDelta_x=0;
- m_cursorDelta_y=0; //Mouse motion occured between two cursor warps, so we can reset the delta counter
+ m_cursorDelta_y=0; //Mouse motion occurred between two cursor warps, so we can reset the delta counter
}
break;
}
@@ -1771,22 +1796,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]);
@@ -1799,22 +1818,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]);
- /* Ensure path exists, creates it if needed */
- fileManager = [NSFileManager defaultManager];
- if (![fileManager fileExistsAtPath:basePath isDirectory:NULL]) {
- [fileManager createDirectoryAtPath:basePath attributes:nil];
+ [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];
+
+ 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..35b8debf6b4 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.
@@ -209,7 +214,7 @@ public:
* @param draggedObjectType The type object concerned (currently array of file names, string, ?bitmap)
* @param mouseX x mouse coordinate (in window coordinates)
* @param mouseY y mouse coordinate
- * @param window The window on which the event occured
+ * @param window The window on which the event occurred
* @return Indication whether the event was handled.
*/
static GHOST_TSuccess pushDragDropEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType,GHOST_IWindow* window, int mouseX, int mouseY, void* data);
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 1b7589fc432..961a637e616 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"
@@ -71,6 +67,10 @@
#include <stdio.h> // for fprintf only
#include <cstdlib> // for exit
+#ifndef PREFIX
+# define PREFIX "/usr/local"
+#endif
+
typedef struct NDOFPlatformInfo {
Display *display;
Window window;
@@ -469,7 +469,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) {
@@ -970,7 +970,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
@@ -1465,19 +1465,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*) PREFIX "/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 cb27ee4e83e..7948e88e1ab 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 7520375c10e..a97f7621bb0 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) {
@@ -732,7 +733,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state)
#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 mainScreen]])
+ if ([[m_window screen] isEqual:[[NSScreen screens] objectAtIndex:0]])
{
[NSApp setPresentationOptions:(NSApplicationPresentationHideDock | NSApplicationPresentationAutoHideMenuBar)];
}
@@ -743,7 +744,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state)
#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 mainScreen]])
+ 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
@@ -1020,6 +1021,66 @@ GHOST_TSuccess GHOST_WindowCocoa::invalidate()
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
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 a7779400488..b51e14275c9 100644
--- a/intern/ghost/make/msvc_9_0/ghost.vcproj
+++ b/intern/ghost/make/msvc_9_0/ghost.vcproj
@@ -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"