diff options
author | Mike Erwin <significant.bit@gmail.com> | 2010-07-25 14:09:17 +0400 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2010-07-25 14:09:17 +0400 |
commit | ad623ddd82678d400bcb41545e65c53a315d00a9 (patch) | |
tree | ad4fcbd52785882f7c42182b255cabf3c7498f57 /intern/ghost | |
parent | b0193772dae9cbb9a52cd18355393b16a6e5001c (diff) | |
parent | 61a09d96b1c10decb732f77a50421101e43cf401 (diff) |
merged 29285:30707 from trunk
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/CMakeLists.txt | 4 | ||||
-rw-r--r-- | intern/ghost/GHOST_C-api.h | 14 | ||||
-rw-r--r-- | intern/ghost/GHOST_ISystem.h | 12 | ||||
-rw-r--r-- | intern/ghost/GHOST_Path-api.h | 63 | ||||
-rw-r--r-- | intern/ghost/SConscript | 3 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_C-api.cpp | 12 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_EventDragnDrop.h | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_Path-api.cpp | 50 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_System.h | 7 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.h | 10 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.mm | 59 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.cpp | 31 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.h | 13 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemX11.cpp | 20 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemX11.h | 6 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCocoa.mm | 7 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWin32.cpp | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowX11.cpp | 7 | ||||
-rw-r--r-- | intern/ghost/intern/Makefile | 2 | ||||
-rw-r--r-- | intern/ghost/make/msvc_9_0/ghost.vcproj | 8 |
20 files changed, 254 insertions, 78 deletions
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index fa630ce26f0..c262ea8aadd 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -42,6 +42,7 @@ SET(SRC ${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 @@ -84,6 +85,9 @@ ELSEIF(UNIX) ${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}") diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index a80a56207e7..6110b31a95a 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -822,20 +822,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 6f0adeb05b7..ab974508145 100644 --- a/intern/ghost/GHOST_ISystem.h +++ b/intern/ghost/GHOST_ISystem.h @@ -363,12 +363,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/). @@ -382,6 +377,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_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_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index 9c278f40282..60c9a860a2e 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -849,15 +849,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_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_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_System.h b/intern/ghost/intern/GHOST_System.h index 5940894ad27..0f140a66d72 100644 --- a/intern/ghost/intern/GHOST_System.h +++ b/intern/ghost/intern/GHOST_System.h @@ -284,7 +284,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/). @@ -298,6 +298,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_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h index 08cb5037981..97b9cb2804d 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, @@ -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); diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 3ab69ac3f64..b8eee5ed7e0 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -808,8 +808,12 @@ GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 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)); @@ -1611,7 +1615,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) //Normal cursor operation: send mouse position in window 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 warp_dx = 0; warp_dy = 0; } // END cursor grab mode @@ -1848,26 +1852,20 @@ 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]); - + [pool drain]; return tempPath; } @@ -1876,22 +1874,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; } - /* Ensure path exists, creates it if needed */ - fileManager = [NSFileManager defaultManager]; - if (![fileManager fileExistsAtPath:basePath isDirectory:NULL]) { - [fileManager createDirectoryAtPath:basePath attributes:nil]; + 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]; + + 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 1363e4f604b..cada3f68975 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -38,6 +38,9 @@ #include <stdio.h> // for debug [mce] +#include <shlobj.h> + + // win64 doesn't define GWL_USERDATA #ifdef WIN32 #ifndef GWL_USERDATA @@ -255,6 +258,8 @@ GHOST_TSuccess GHOST_SystemWin32::getCursorPosition(GHOST_TInt32& x, GHOST_TInt3 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; } @@ -1287,10 +1292,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 abf6886deea..9febe7779bc 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.h +++ b/intern/ghost/intern/GHOST_SystemWin32.h @@ -191,22 +191,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. @@ -214,7 +219,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 a70162a5039..e658df3ce95 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -67,6 +67,10 @@ #include <stdio.h> // for fprintf only #include <cstdlib> // for exit +#ifndef PREFIX +# define PREFIX "/usr/local" +#endif + // [mce] these are for communication with the plugin typedef struct NDOFPlatformInfo { Display *display; @@ -465,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) { @@ -1483,19 +1487,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 d00f83aa8ea..e4b02d192e8 100644 --- a/intern/ghost/intern/GHOST_SystemX11.h +++ b/intern/ghost/intern/GHOST_SystemX11.h @@ -243,6 +243,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_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index abcb8bcd5cc..a97f7621bb0 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -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 diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 757d9d962fd..bf250938af1 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -1102,7 +1102,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_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index b3b1c8ae0f7..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 @@ -1442,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) { @@ -1460,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/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>
|