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:
authorAntony Riakiotakis <kalast@gmail.com>2014-09-01 17:37:21 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-09-01 17:38:22 +0400
commitf0653c3d3f1b24b45e6f1c5ac659bf130b58af3f (patch)
tree82721843c274829a1441ad7291809545955db90c /intern/ghost
parenta8d2a6faf3beaf8363bd71c65c59e0ed1a1e7b5c (diff)
parent575cbf0172508eb9d846f1c62027a9c0f4fddd34 (diff)
Merge branch 'master' into soc-2014-viewport_context
Also fix scons issues with SDL. There is still a linking problem somewhere but i expect this is an issue in master as well. Conflicts: intern/cycles/SConscript intern/ghost/CMakeLists.txt intern/ghost/intern/GHOST_WindowX11.cpp source/blender/nodes/CMakeLists.txt
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/GHOST_C-api.h8
-rw-r--r--intern/ghost/GHOST_ISystem.h68
-rw-r--r--intern/ghost/GHOST_IWindow.h13
-rw-r--r--intern/ghost/GHOST_Rect.h2
-rw-r--r--intern/ghost/SConscript20
-rw-r--r--intern/ghost/intern/GHOST_DisplayManager.h2
-rw-r--r--intern/ghost/intern/GHOST_DisplayManagerX11.cpp4
-rw-r--r--intern/ghost/intern/GHOST_DropTargetWin32.cpp2
-rw-r--r--intern/ghost/intern/GHOST_DropTargetX11.h4
-rw-r--r--intern/ghost/intern/GHOST_NDOFManager3Dconnexion.c4
-rw-r--r--intern/ghost/intern/GHOST_System.h8
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm4
-rw-r--r--intern/ghost/intern/GHOST_SystemPathsWin32.cpp2
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp85
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp18
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.h4
-rw-r--r--intern/ghost/intern/GHOST_TimerManager.h2
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm17
-rw-r--r--intern/ghost/intern/GHOST_WindowManager.h2
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.cpp2
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp2
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.h2
-rw-r--r--intern/ghost/test/gears/GHOST_Test.cpp3
23 files changed, 192 insertions, 86 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 28b5fdd9edd..7b47f0526a2 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -151,7 +151,7 @@ extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
/**
* Returns the dimensions of all displays combine
* (the current workspace).
- * No need to worrky about overlapping monitors.
+ * No need to worry about overlapping monitors.
* \param systemhandle The handle to the system
* \param width A pointer the width gets put in
* \param height A pointer the height gets put in
@@ -401,7 +401,7 @@ extern GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
* do this automatically.
* \param windowhandle The handle to the window
* \param mode The new grab state of the cursor.
- * \param bounds The grab ragion (optional) - left,top,right,bottom
+ * \param bounds The grab region (optional) - left,top,right,bottom
* \param mouse_ungrab_xy XY for new mouse location (optional) - x,y
* \return Indication of success.
*/
@@ -759,7 +759,7 @@ extern GHOST_TSuccess GHOST_IsEmptyRectangle(GHOST_RectangleHandle rectanglehand
/**
* Returns whether this rectangle is valid.
- * Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b. Thus, emapty rectangles are valid.
+ * Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b. Thus, empty rectangles are valid.
* \param rectanglehandle The handle to the rectangle
* \return intean value (true == valid rectangle)
*/
@@ -853,7 +853,7 @@ extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_RectangleHandle anotherrectanglehandle);
/**
- * Return the data from the clipboad
+ * Return the data from the clipboard
* \param selection Boolean to return the selection instead, X11 only feature.
* \return clipboard data
*/
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 137926b033c..19f36319949 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -48,7 +48,7 @@ class GHOST_IEventConsumer;
*
* GHOST is yet another acronym. It stands for "Generic Handy Operating System
* Toolkit". It has been created to replace the OpenGL utility tool kit
- * <a href="http://www.opengl.org/developers/documentation/glut.html">GLUT</a>.
+ * <a href="http://www.opengl.org/resources/libraries/glut/">GLUT</a>.
* GLUT was used in <a href="http://www.blender3d.com">Blender</a> until the
* point that Blender needed to be ported to Apple's Mac OSX. Blender needed a
* number of modifications in GLUT to work but the GLUT sources for OSX were
@@ -60,31 +60,29 @@ class GHOST_IEventConsumer;
* In short: everything that Blender needed from GLUT to run on all it's supported
* operating systems and some extra's.
* This includes :
- * <ul>
- * <li> Time(r) management.</li>
- * <li> Display/window management (windows are only created on the main display).
- * <li> Event management.</li>
- * <li> Cursor shape management (no custom cursors for now).</li>
- * <li> Access to the state of the mouse buttons and the keyboard.</li>
- * <li> Menus for windows with events generated when they are accessed (this is
- * work in progress).</li>
- * <li> Video mode switching.</li>
- * <li> Copy/Paste buffers.</li>
- * <li> System paths.</li>
- * </ul>
+ *
+ * - Time(r) management.
+ * - Display/window management (windows are only created on the main display).
+ * - Event management.
+ * - Cursor shape management (no custom cursors for now).
+ * - Access to the state of the mouse buttons and the keyboard.
+ * - Menus for windows with events generated when they are accessed (this is
+ * work in progress).
+ * - Video mode switching.
+ * - Copy/Paste buffers.
+ * - System paths.
+ *
* Font management has been moved to a separate library.
*
* \section platforms Platforms
*
* GHOST supports the following platforms:
- * <ul>
- * <li> OSX Cocoa.</li>
- * <li> OSX Carbon.</li>
- * <li> Windows.</li>
- * <li> X11.</li>
- * <li> SDL1.3 (experimental).</li>
- * <li> NULL (headless mode).</li>
- * </ul>
+ *
+ * - OSX Cocoa.
+ * - Windows.
+ * - X11.
+ * - SDL2 (experimental).
+ * - NULL (headless mode).
*
* \section Building GHOST
*
@@ -92,23 +90,23 @@ class GHOST_IEventConsumer;
*
* \section interface Interface
* GHOST has two programming interfaces:
- * <ul>
- * <li>The C-API. For programs written in C.</li>
- * <li>The C++-API. For programs written in C++.</li>
- * </ul>
- * GHOST itself is writtem in C++ and the C-API is a wrapper around the C++
+ *
+ * - The C-API. For programs written in C.
+ * - The C++-API. For programs written in C++.
+ *
+ * GHOST itself is written in C++ and the C-API is a wrapper around the C++
* API.
*
* \subsection cplusplus_api The C++ API consists of the following files:
- * <ul>
- * <li>GHOST_IEvent.h</li>
- * <li>GHOST_IEventConsumer.h</li>
- * <li>GHOST_ISystem.h</li>
- * <li>GHOST_ITimerTask.h</li>
- * <li>GHOST_IWindow.h</li>
- * <li>GHOST_Rect.h</li>
- * <li>GHOST_Types.h</li>
- * </ul>
+ *
+ * - GHOST_IEvent.h
+ * - GHOST_IEventConsumer.h
+ * - GHOST_ISystem.h
+ * - GHOST_ITimerTask.h
+ * - GHOST_IWindow.h
+ * - GHOST_Rect.h
+ * - GHOST_Types.h
+ *
* For an example of using the C++-API, have a look at the GHOST_C-Test.cpp
* program in the ?/ghost/test/gears/ directory.
*
diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index 37406066fc7..71dc193a81b 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -46,13 +46,12 @@
* \see GHOST_ISystem#createWindow
*
* There are two coordinate systems:
- * <ul>
- * <li>The screen coordinate system. The origin of the screen is located in the
- * upper left corner of the screen.</li>
- * <li>The client rectangle coordinate system. The client rectangle of a window
- * is the area that is drawable by the application (excluding title bars etc.).
- * </li>
- * </ul>
+ *
+ * - The screen coordinate system. The origin of the screen is located in the
+ * upper left corner of the screen.</li>
+ * - The client rectangle coordinate system. The client rectangle of a window
+ * is the area that is drawable by the application (excluding title bars etc.).
+ *
* \author Maarten Gribnau
* \date May 31, 2001
*/
diff --git a/intern/ghost/GHOST_Rect.h b/intern/ghost/GHOST_Rect.h
index a055b6f7f0d..c2ea8db0a66 100644
--- a/intern/ghost/GHOST_Rect.h
+++ b/intern/ghost/GHOST_Rect.h
@@ -102,7 +102,7 @@ public:
/**
* Returns whether this rectangle is valid.
- * Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b. Thus, emapty rectangles are valid.
+ * Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b. Thus, empty rectangles are valid.
* \return boolean value (true==valid rectangle)
*/
virtual inline bool isValid() const;
diff --git a/intern/ghost/SConscript b/intern/ghost/SConscript
index e8550753a70..5a4572c164d 100644
--- a/intern/ghost/SConscript
+++ b/intern/ghost/SConscript
@@ -36,16 +36,17 @@ sources = env.Glob('intern/*.cpp')
sources2 = env.Glob('intern/GHOST_NDOFManager3Dconnexion.c')
if window_system == 'darwin':
sources += env.Glob('intern/*.mm')
+ #remove, will be readded below if needed.
+ sources.remove('intern' + os.sep + 'GHOST_ContextCGL.mm')
if not env['WITH_BF_GL_EGL']:
sources.remove('intern' + os.sep + 'GHOST_ContextEGL.cpp')
# seems cleaner to remove these now then add back the one that is needed
-sources.remove('intern' + os.sep + 'GHOST_ContextCGL.mm')
sources.remove('intern' + os.sep + 'GHOST_ContextGLX.cpp')
sources.remove('intern' + os.sep + 'GHOST_ContextWGL.cpp')
-pf = ['GHOST_DisplayManager', 'GHOST_System', 'GHOST_SystemPaths', 'GHOST_Window', 'GHOST_DropTarget', 'GHOST_NDOFManager']
+pf = ['GHOST_DisplayManager', 'GHOST_System', 'GHOST_SystemPaths', 'GHOST_Window', 'GHOST_DropTarget', 'GHOST_NDOFManager', 'GHOST_Context']
defs = env['BF_GL_DEFINITIONS']
@@ -75,6 +76,10 @@ elif window_system in ('linux', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'f
for f in pf:
try:
sources.remove('intern' + os.sep + f + 'Win32.cpp')
+ except ValueError:
+ pass
+
+ try:
sources.remove('intern' + os.sep + f + 'SDL.cpp')
except ValueError:
pass
@@ -108,6 +113,10 @@ elif window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64
for f in pf:
try:
sources.remove('intern' + os.sep + f + 'X11.cpp')
+ except ValueError:
+ pass
+
+ try:
sources.remove('intern' + os.sep + f + 'SDL.cpp')
except ValueError:
pass
@@ -121,7 +130,14 @@ elif window_system == 'darwin':
for f in pf:
try:
sources.remove('intern' + os.sep + f + 'Win32.cpp')
+ except ValueError:
+ pass
+
+ try:
sources.remove('intern' + os.sep + f + 'X11.cpp')
+ except ValueError:
+ pass
+ try:
sources.remove('intern' + os.sep + f + 'SDL.cpp')
except ValueError:
pass
diff --git a/intern/ghost/intern/GHOST_DisplayManager.h b/intern/ghost/intern/GHOST_DisplayManager.h
index 7dc0cf2ca04..afdb11543e9 100644
--- a/intern/ghost/intern/GHOST_DisplayManager.h
+++ b/intern/ghost/intern/GHOST_DisplayManager.h
@@ -100,7 +100,7 @@ public:
/**
* Changes the current setting for this display device.
- * The setting given to this method is matched againts the available diplay settings.
+ * The setting given to this method is matched against the available display settings.
* The best match is activated (@see findMatch()).
* \param display The index of the display to query with 0 <= display < getNumDisplays().
* \param setting The setting of the display device to be matched and activated.
diff --git a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
index a5457891ec3..24289e6b006 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManagerX11.cpp
@@ -194,7 +194,7 @@ setCurrentDisplaySetting(
fprintf(stderr, "Error: XF86VidMode extension missing!\n");
return GHOST_kFailure;
}
-# ifdef _DEBUG
+# ifdef DEBUG
printf("Using XFree86-VidModeExtension Version %d.%d\n",
majorVersion, minorVersion);
# endif
@@ -240,7 +240,7 @@ setCurrentDisplaySetting(
}
if (best_fit != -1) {
-# ifdef _DEBUG
+# ifdef DEBUG
printf("Switching to video mode %dx%d %dx%d %d\n",
vidmodes[best_fit]->hdisplay, vidmodes[best_fit]->vdisplay,
vidmodes[best_fit]->htotal, vidmodes[best_fit]->vtotal,
diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.cpp b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
index 1aaf939e996..fd9abce96b7 100644
--- a/intern/ghost/intern/GHOST_DropTargetWin32.cpp
+++ b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
@@ -186,7 +186,7 @@ DWORD GHOST_DropTargetWin32::allowedDropEffect(DWORD dwAllowed)
GHOST_TDragnDropTypes GHOST_DropTargetWin32::getGhostType(IDataObject *pDataObject)
{
/* Text
- * Note: Unicode text is aviable as CF_TEXT too, the system can do the
+ * Note: Unicode text is available as CF_TEXT too, the system can do the
* conversion, but we do the conversion ourself with WC_NO_BEST_FIT_CHARS.
*/
FORMATETC fmtetc = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
diff --git a/intern/ghost/intern/GHOST_DropTargetX11.h b/intern/ghost/intern/GHOST_DropTargetX11.h
index 9ac45ba8dfe..e2968844ff0 100644
--- a/intern/ghost/intern/GHOST_DropTargetX11.h
+++ b/intern/ghost/intern/GHOST_DropTargetX11.h
@@ -78,7 +78,7 @@ private:
void Initialize(void);
/**
- * Uninitiailize XDND and all related X atoms
+ * Uninitialize XDND and all related X atoms
*/
void Uninitialize(void);
@@ -101,7 +101,7 @@ private:
/**
* Fully decode file URL (i.e. converts "file:///a%20b/test" to "/a b/test")
* \param fileUrl - file path URL to be fully decoded
- * \return decoded file path (resutl shold be free-d)
+ * \return decoded file path (resutl should be free-d)
*/
char *FileUrlDecode(char *fileUrl);
diff --git a/intern/ghost/intern/GHOST_NDOFManager3Dconnexion.c b/intern/ghost/intern/GHOST_NDOFManager3Dconnexion.c
index 9df9a56f8b8..01e301f927e 100644
--- a/intern/ghost/intern/GHOST_NDOFManager3Dconnexion.c
+++ b/intern/ghost/intern/GHOST_NDOFManager3Dconnexion.c
@@ -30,14 +30,14 @@
/* It is to be noted that these implementations are linked in as
* 'extern "C"' calls from GHOST_NDOFManagerCocoa.
-
+ *
* This is done in order to
* preserve weak linking capability (which as of clang-3.3 and xcode5
* breaks weak linking when there is name mangling of c++ libraries.)
*
* We need to have the weak linked file as pure C. Therefore we build a
* compiled bridge from the real weak linked calls and the calls within C++
-
+ *
*/
OSErr GHOST_NDOFManager3Dconnexion_available(void)
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 57aa0a31c94..79230b0f505 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -250,27 +250,23 @@ public:
virtual GHOST_TSuccess pushEvent(GHOST_IEvent *event);
/**
- * Returns the timer manager.
* \return The timer manager.
*/
inline virtual GHOST_TimerManager *getTimerManager() const;
/**
- * Returns a pointer to our event manager.
* \return A pointer to our event manager.
*/
virtual inline GHOST_EventManager *getEventManager() const;
/**
- * Returns a pointer to our window manager.
* \return A pointer to our window manager.
*/
virtual inline GHOST_WindowManager *getWindowManager() const;
#ifdef WITH_INPUT_NDOF
/**
- * Returns a pointer to our n-degree of freedeom manager.
- * \return A pointer to our n-degree of freedeom manager.
+ * \return A pointer to our n-degree of freedom manager.
*/
virtual inline GHOST_NDOFManager *getNDOFManager() const;
#endif
@@ -333,7 +329,7 @@ protected:
virtual GHOST_TSuccess createFullScreenWindow(GHOST_Window **window, const GHOST_DisplaySetting &settings,
const bool stereoVisual, const GHOST_TUns16 numOfAASamples = 0);
- /** The display manager (platform dependant). */
+ /** The display manager (platform dependent). */
GHOST_DisplayManager *m_displayManager;
/** The timer manager. */
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 1d4c6d5e10b..a2e26574530 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -700,10 +700,10 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
handleKeyEvent(event);
}
else {
- // For some reason NSApp is swallowing the key up events when command
+ // For some reason NSApp is swallowing the key up events when modifier
// key is pressed, even if there seems to be no apparent reason to do
// so, as a workaround we always handle these up events.
- if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask))
+ if ([event type] == NSKeyUp && (([event modifierFlags] & NSCommandKeyMask) || ([event modifierFlags] & NSAlternateKeyMask)))
handleKeyEvent(event);
[NSApp sendEvent:event];
diff --git a/intern/ghost/intern/GHOST_SystemPathsWin32.cpp b/intern/ghost/intern/GHOST_SystemPathsWin32.cpp
index 3a313c792d0..2bd380050f1 100644
--- a/intern/ghost/intern/GHOST_SystemPathsWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemPathsWin32.cpp
@@ -37,7 +37,7 @@
#include <shlobj.h>
#include "utfconv.h"
-#if defined(__MINGW32__) || defined(__CYGWIN__)
+#ifdef __MINGW32__
#if !defined(SHARD_PIDL)
#define SHARD_PIDL 0x00000001L
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index ea5c655a3e2..0767ad5a8f9 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -46,6 +46,8 @@
#include <shlobj.h>
#include <tlhelp32.h>
+#include <Psapi.h>
+#include <windowsx.h>
#include "utfconv.h"
@@ -114,6 +116,17 @@
#define VK_MEDIA_PLAY_PAUSE 0xB3
#endif // VK_MEDIA_PLAY_PAUSE
+/* Workaround for some laptop touchpads, some of which seems to
+ * have driver issues which makes it so window function receives
+ * the message, but PeekMessage doesn't pick those messages for
+ * some reason.
+ *
+ * We send a dummy WM_USER message to force PeekMessage to receive
+ * something, making it so blender's window manager sees the new
+ * messages coming in.
+ */
+#define BROKEN_PEEK_TOUCHPAD
+
static void initRawInput()
{
#ifdef WITH_INPUT_NDOF
@@ -1036,6 +1049,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
event = processCursorEvent(GHOST_kEventCursorMove, window);
break;
case WM_MOUSEWHEEL:
+ {
/* The WM_MOUSEWHEEL message is sent to the focus window
* when the mouse wheel is rotated. The DefWindowProc
* function propagates the message to the window's parent.
@@ -1043,8 +1057,28 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
* since DefWindowProc propagates it up the parent chain
* until it finds a window that processes it.
*/
- event = processWheelEvent(window, wParam, lParam);
+
+ /* Get the winow under the mouse and send event to it's queue. */
+ POINT mouse_pos = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
+ HWND mouse_hwnd = WindowFromPoint(mouse_pos);
+ GHOST_WindowWin32 *mouse_window = (GHOST_WindowWin32 *)::GetWindowLongPtr(mouse_hwnd, GWLP_USERDATA);
+ if (mouse_window != NULL) {
+ event = processWheelEvent(mouse_window, wParam, lParam);
+ }
+ else {
+ /* If it happened so window under the mouse is not found (which i'm not
+ * really sure might happen), then we add event to the focused window
+ * in order to avoid some possible negative side effects.
+ * - sergey -
+ */
+ event = processWheelEvent(window, wParam, lParam);
+ }
+
+#ifdef BROKEN_PEEK_TOUCHPAD
+ PostMessage(hwnd, WM_USER, 0, 0);
+#endif
break;
+ }
case WM_SETCURSOR:
/* The WM_SETCURSOR message is sent to a window if the mouse causes the cursor
* to move within a window and mouse input is not captured.
@@ -1375,16 +1409,63 @@ void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
}
}
+static DWORD GetParentProcessID(void)
+{
+ HANDLE snapshot;
+ PROCESSENTRY32 pe32 = {0};
+ DWORD ppid = 0, pid = GetCurrentProcessId();
+ snapshot = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
+ if (snapshot == INVALID_HANDLE_VALUE) {
+ return -1;
+ }
+ pe32.dwSize = sizeof( pe32 );
+ if (!Process32First(snapshot, &pe32)) {
+ CloseHandle(snapshot);
+ return -1;
+ }
+ do {
+ if (pe32.th32ProcessID == pid) {
+ ppid = pe32.th32ParentProcessID;
+ break;
+ }
+ } while (Process32Next(snapshot, &pe32));
+ CloseHandle(snapshot);
+ return ppid;
+}
+
+static bool getProcessName(int pid, char *buffer, int max_len)
+{
+ bool result = false;
+ HANDLE handle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
+ FALSE, pid);
+ if (handle) {
+ GetModuleFileNameEx(handle, 0, buffer, max_len);
+ result = true;
+ }
+ CloseHandle(handle);
+ return result;
+}
+
static bool isStartedFromCommandPrompt()
{
HWND hwnd = GetConsoleWindow();
if (hwnd) {
DWORD pid = (DWORD)-1;
+ DWORD ppid = GetParentProcessID();
+ char parent_name[MAX_PATH];
+ bool start_from_launcher = false;
GetWindowThreadProcessId(hwnd, &pid);
+ if (getProcessName(ppid, parent_name, sizeof(parent_name))) {
+ char *filename = strrchr(parent_name, '\\');
+ if (filename != NULL) {
+ start_from_launcher = strstr(filename, "blender.exe") != NULL;
+ }
+ }
- if (pid == GetCurrentProcessId())
+ /* When we're starting from a wrapper we need to compare with parent process ID. */
+ if (pid == (start_from_launcher ? ppid : GetCurrentProcessId()))
return true;
}
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index f0d0ef22782..75a9223d6a3 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -141,6 +141,8 @@ GHOST_SystemX11(
#undef GHOST_INTERN_ATOM
m_last_warp = 0;
+ m_last_release_keycode = 0;
+ m_last_release_time = 0;
/* compute the initial time */
timeval tv;
@@ -244,7 +246,7 @@ getMainDisplayDimensions(
{
if (m_display) {
/* note, for this to work as documented,
- * we would need to use Xinerama check r54370 for code that did thia,
+ * we would need to use Xinerama check r54370 for code that did this,
* we've since removed since its not worth the extra dep - campbell */
getAllDisplayDimensions(width, height);
}
@@ -526,6 +528,16 @@ processEvents(
continue;
}
#endif
+ /* when using autorepeat, some keypress events can actually come *after* the
+ * last keyrelease. The next code takes care of that */
+ if (xevent.type == KeyRelease) {
+ m_last_release_keycode = xevent.xkey.keycode;
+ m_last_release_time = xevent.xkey.time;
+ }
+ else if (xevent.type == KeyPress) {
+ if ((xevent.xkey.keycode == m_last_release_keycode) && ((xevent.xkey.time <= m_last_release_time)))
+ continue;
+ }
processEvent(&xevent);
anyProcessed = true;
@@ -659,7 +671,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
#ifdef WITH_X11_XINPUT
/* Proximity-Out Events are not reliable, if the tablet is active - check on each event
* this adds a little overhead but only while the tablet is in use.
- * in the futire we could have a ghost call window->CheckTabletProximity()
+ * in the future we could have a ghost call window->CheckTabletProximity()
* but for now enough parts of the code are checking 'Active'
* - campbell */
if (window->GetTabletData()->Active != GHOST_kTabletModeNone) {
@@ -1240,7 +1252,7 @@ getModifierKeys(
XQueryKeymap(m_display, (char *)m_keyboard_vector);
- /* now translate key symobols into keycodes and
+ /* now translate key symbols into keycodes and
* test with vector. */
const static KeyCode shift_l = XKeysymToKeycode(m_display, XK_Shift_L);
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index 1a055725aac..be149cbb773 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -355,6 +355,10 @@ private:
* and stop accumulating all events generated before that */
Time m_last_warp;
+ /* detect autorepeat glitch */
+ unsigned int m_last_release_keycode;
+ Time m_last_release_time;
+
/**
* Return the ghost window associated with the
* X11 window xwind
diff --git a/intern/ghost/intern/GHOST_TimerManager.h b/intern/ghost/intern/GHOST_TimerManager.h
index 5a24c56ef10..b94175e9ff8 100644
--- a/intern/ghost/intern/GHOST_TimerManager.h
+++ b/intern/ghost/intern/GHOST_TimerManager.h
@@ -67,7 +67,7 @@ public:
virtual GHOST_TUns32 getNumTimers();
/**
- * Returns whther this timer task ins in our list.
+ * Returns whether this timer task ins in our list.
* \return Indication of presence.
*/
virtual bool getTimerFound(GHOST_TimerTask *timer);
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index f0aac339546..52436d38e5c 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -634,15 +634,14 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
if (state == GHOST_kWindowStateFullScreen)
setState(GHOST_kWindowStateFullScreen);
-//Using lion_fullscreen suffers from an uncovered problem when called from operator, disabled for now
-// //Starting with 10.9 (darwin 13.x.x), we always use Lion fullscreen, since it
-// //now has proper multi-monitor support for fullscreen
-// char darwin_ver[10];
-// size_t len = sizeof(darwin_ver);
-// sysctlbyname("kern.osrelease", &darwin_ver, &len, NULL, 0);
-// if(darwin_ver[0] == '1' && darwin_ver[1] >= '3') {
-// m_lionStyleFullScreen = true;
-// }
+ //Starting with 10.9 (darwin 13.x.x), we always use Lion fullscreen, since it
+ //now has proper multi-monitor support for fullscreen
+ char darwin_ver[10];
+ size_t len = sizeof(darwin_ver);
+ sysctlbyname("kern.osrelease", &darwin_ver, &len, NULL, 0);
+ if(darwin_ver[0] == '1' && darwin_ver[1] >= '3') {
+ m_lionStyleFullScreen = true;
+ }
[pool drain];
}
diff --git a/intern/ghost/intern/GHOST_WindowManager.h b/intern/ghost/intern/GHOST_WindowManager.h
index 79438c03702..8297e4d24d2 100644
--- a/intern/ghost/intern/GHOST_WindowManager.h
+++ b/intern/ghost/intern/GHOST_WindowManager.h
@@ -87,7 +87,7 @@ public:
/**
* Returns pointer to the full-screen window.
- * \return The fll-screen window (0 if not in full-screen).
+ * \return The full-screen window (NULL if not in full-screen).
*/
virtual GHOST_IWindow *getFullScreenWindow(void) const;
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 76ec050f7d7..64ea7192616 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -120,7 +120,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(
MONITORINFO monitor;
GHOST_TUns32 tw, th;
-#if !defined(_MSC_VER) || _MSC_VER < 1700
+#ifndef _MSC_VER
int cxsizeframe = GetSystemMetrics(SM_CXSIZEFRAME);
int cysizeframe = GetSystemMetrics(SM_CYSIZEFRAME);
#else
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 6ff42aaf428..97f8ae73d2d 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -60,7 +60,7 @@
#include <algorithm>
#include <string>
-/* For obscure full screen mode stuuf
+/* For obscure full screen mode stuff
* lifted verbatim from blut. */
typedef struct {
diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h
index 6a012f12769..3255751be93 100644
--- a/intern/ghost/intern/GHOST_WindowX11.h
+++ b/intern/ghost/intern/GHOST_WindowX11.h
@@ -246,7 +246,7 @@ protected:
/**
* Sets the cursor grab on the window using
* native window system calls.
- * \param warp Only used when grab is enabled, hides the mouse and allows gragging outside the screen.
+ * \param warp Only used when grab is enabled, hides the mouse and allows dragging outside the screen.
*/
GHOST_TSuccess
setWindowCursorGrab(
diff --git a/intern/ghost/test/gears/GHOST_Test.cpp b/intern/ghost/test/gears/GHOST_Test.cpp
index 78e5257be1f..a81aaa85ecf 100644
--- a/intern/ghost/test/gears/GHOST_Test.cpp
+++ b/intern/ghost/test/gears/GHOST_Test.cpp
@@ -262,7 +262,8 @@ static void View(GHOST_IWindow *window, bool stereo, int eye = 0)
window->activateDrawingContext();
GHOST_Rect bnds;
int noOfScanlines = 0, lowerScanline = 0;
- int verticalBlankingInterval = 32; // hard coded for testing purposes, display device dependant
+ /* hard coded for testing purposes, display device dependent */
+ int verticalBlankingInterval = 32;
float left, right, bottom, top;
float nearplane, farplane, zeroPlane, distance;
float eyeSeparation = 0.62f;