From ea9d94cf280bec54f6917789d56768a64646e0f7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 6 Aug 2014 05:39:41 +1000 Subject: Spelling --- intern/ghost/CMakeLists.txt | 2 +- intern/ghost/intern/GHOST_System.h | 2 +- intern/ghost/test/gears/GHOST_Test.cpp | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'intern/ghost') diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index beca24fc5e9..cfa2f54f53e 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -129,7 +129,7 @@ if(WITH_HEADLESS OR WITH_GHOST_SDL) endif() - # ack, this is still system dependant + # ack, this is still system dependent if(APPLE) list(APPEND SRC intern/GHOST_SystemPathsCocoa.mm diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h index 57aa0a31c94..ec0022f0a7d 100644 --- a/intern/ghost/intern/GHOST_System.h +++ b/intern/ghost/intern/GHOST_System.h @@ -333,7 +333,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/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; -- cgit v1.2.3 From e3ed13cbd47098ccc1815ed0c010e814a5e18bcc Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 7 Aug 2014 13:51:05 +0200 Subject: Cleanup: Remove special code for Visual Studio 2008. Goodbye VC2008, it has been a pleasure (more or less) :D SCons / CMake cleaenup will follow. Differential Revision: https://developer.blender.org/D715 --- intern/ghost/intern/GHOST_WindowWin32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'intern/ghost') diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index a9fa7fe747c..8e7e824186c 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -183,7 +183,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 -- cgit v1.2.3 From 57c4871146269a34522ad50c43cb55fe773f3bdf Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 8 Aug 2014 00:20:43 +0600 Subject: Tweaks to the recent wrapper on windows - Forgot to handle command line arguments - Because of the fact we need to be able to use stdout and stderr we need to use regular console application for the wrapper. - Because of using regular application for the wrapper we need to check forparent PID in the isStartedFromCommandPrompt(). I really hope it's not gonna to become any more complicated. --- intern/ghost/intern/GHOST_SystemWin32.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'intern/ghost') diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 91ac8545018..bc2a210fb1e 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -46,6 +46,7 @@ #include #include +#include #include "utfconv.h" @@ -1383,6 +1384,30 @@ 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 isStartedFromCommandPrompt() { HWND hwnd = GetConsoleWindow(); @@ -1392,7 +1417,10 @@ static bool isStartedFromCommandPrompt() GetWindowThreadProcessId(hwnd, &pid); - if (pid == GetCurrentProcessId()) + /* Because we're starting from a wrapper we need to comare with + * parent process ID. + */ + if (pid == GetParentProcessID()) return true; } -- cgit v1.2.3 From 028fd29eeb092b6ed0625ed4d59b8100ae69596f Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Mon, 11 Aug 2014 10:39:59 +0200 Subject: Pie Menus C code backend. This commit merges the code in the pie-menu branch. As per decisions taken the last few days, there are no pie menus included and there will be an official add-on including overrides of some keys with pie menus. However, people will now be able to use the new code in python. Full Documentation is in http://wiki.blender.org/index.php/Dev:Ref/ Thanks: Campbell Barton, Dalai Felinto and Ton Roosendaal for the code review and design comments Jonathan Williamson, Pawel Lyczkowski, Pablo Vazquez among others for suggestions during the development. Special Thanks to Sean Olson, for his support, suggestions, testing and merciless bugging so that I would finish the pie menu code. Without him we wouldn't be here. Also to the rest of the developers of the original python add-on, Patrick Moore and Dan Eicher and finally to Matt Ebb, who did the research and first implementation and whose code I used to get started. --- intern/ghost/intern/GHOST_SystemX11.cpp | 10 ++++++++++ intern/ghost/intern/GHOST_SystemX11.h | 4 ++++ 2 files changed, 14 insertions(+) (limited to 'intern/ghost') diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index e347661ebc6..6d948b2135f 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -525,6 +525,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; diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h index 1f95e4b1ce2..a21300e36f0 100644 --- a/intern/ghost/intern/GHOST_SystemX11.h +++ b/intern/ghost/intern/GHOST_SystemX11.h @@ -356,6 +356,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 -- cgit v1.2.3 From afe8a4040f4838fd957a82582766f6bae76163d0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 12 Aug 2014 08:21:02 +1000 Subject: Fix uninitialized memory use --- intern/ghost/intern/GHOST_SystemX11.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'intern/ghost') diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 6d948b2135f..fb56824d801 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -140,6 +140,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; -- cgit v1.2.3 From d124bd1cd42eaaf8f69cb895b0112773dafaf96a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 12 Aug 2014 10:31:07 +1000 Subject: Spelling --- intern/ghost/GHOST_C-api.h | 2 +- intern/ghost/intern/GHOST_DisplayManager.h | 2 +- intern/ghost/intern/GHOST_DropTargetWin32.cpp | 2 +- intern/ghost/intern/GHOST_SystemX11.cpp | 4 ++-- intern/ghost/intern/GHOST_TimerManager.h | 2 +- intern/ghost/intern/GHOST_WindowX11.cpp | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'intern/ghost') diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index 9b623077b28..7428acee17e 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -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. */ diff --git a/intern/ghost/intern/GHOST_DisplayManager.h b/intern/ghost/intern/GHOST_DisplayManager.h index 7dc0cf2ca04..f3c1da90b75 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 diplay 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_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_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index fb56824d801..16ebdc377ea 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -245,7 +245,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); } @@ -1251,7 +1251,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_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_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 9f835f9c030..86c940b7396 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -55,7 +55,7 @@ #include #include -/* For obscure full screen mode stuuf +/* For obscure full screen mode stuff * lifted verbatim from blut. */ typedef struct { @@ -186,7 +186,7 @@ GHOST_WindowX11( m_visible_cursor(None) { - /* Set up the minimum atrributes that we require and see if + /* Set up the minimum attributes that we require and see if * X can find us a visual matching those requirements. */ int attributes[40], i, samples; -- cgit v1.2.3 From 0fc4289c39bd2412abe83adb30751bf43a571973 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 12 Aug 2014 16:40:23 +0600 Subject: Console detection now works reliably when starting blender-app directly --- intern/ghost/intern/GHOST_SystemWin32.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'intern/ghost') diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index bc2a210fb1e..3be6f0d0e06 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -1408,19 +1408,41 @@ static DWORD GetParentProcessID(void) 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; + } + } - /* Because we're starting from a wrapper we need to comare with + /* When we're starting from a wrapper we need to comare with * parent process ID. */ - if (pid == GetParentProcessID()) + if (pid == (start_from_launcher ? ppid : GetCurrentProcessId())) return true; } -- cgit v1.2.3 From 794277f8b6ca5f48eb994560d201e210e1eabaf1 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 12 Aug 2014 16:51:37 +0600 Subject: Stupid MSVC replaces tabs to spaces spontaneously :S --- intern/ghost/intern/GHOST_SystemWin32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'intern/ghost') diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 3be6f0d0e06..cad2aab0040 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -1428,7 +1428,7 @@ static bool isStartedFromCommandPrompt() if (hwnd) { DWORD pid = (DWORD)-1; DWORD ppid = GetParentProcessID(); - char parent_name[MAX_PATH]; + char parent_name[MAX_PATH]; bool start_from_launcher = false; GetWindowThreadProcessId(hwnd, &pid); -- cgit v1.2.3 From dfd9bfd3a8ac8fef72d5547cdb7b0612f6ed6265 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Aug 2014 08:38:16 +1000 Subject: Spelling --- intern/ghost/intern/GHOST_SystemWin32.cpp | 4 +--- intern/ghost/intern/GHOST_WindowX11.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'intern/ghost') diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index cad2aab0040..ca2768ec161 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -1439,9 +1439,7 @@ static bool isStartedFromCommandPrompt() } } - /* When we're starting from a wrapper we need to comare with - * parent process ID. - */ + /* 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_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h index afe21b0ffce..faaa05efe82 100644 --- a/intern/ghost/intern/GHOST_WindowX11.h +++ b/intern/ghost/intern/GHOST_WindowX11.h @@ -279,7 +279,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( -- cgit v1.2.3 From 7df4fc5eafdecf79579e4559b3db7ddeff4af880 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Aug 2014 09:33:46 +1000 Subject: Spelling --- intern/ghost/intern/GHOST_DisplayManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'intern/ghost') diff --git a/intern/ghost/intern/GHOST_DisplayManager.h b/intern/ghost/intern/GHOST_DisplayManager.h index f3c1da90b75..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 against 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. -- cgit v1.2.3 From 2eebe611e42c149aeafcf5bcd18c7a477c813e38 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 13 Aug 2014 13:44:26 +0600 Subject: Fix T40717: Screen does not update while scrolling or zooming with touchpad on a laptop This is rather workaround solution for now, which seems to work and it's not that huge to maintain (one liner apart from the comment). Idea is to make sure PeekMessage peeks the message when window proc receives WM_MOUSEWHEEL (some touchpad drivers seems to swallow the messages making it so PeekMessage doesn't get anything). --- intern/ghost/intern/GHOST_SystemWin32.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'intern/ghost') diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index ca2768ec161..8cfd2856231 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -115,6 +115,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 @@ -1053,6 +1064,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, * until it finds a window that processes it. */ 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 -- cgit v1.2.3 From 3bbba7d2b13c4fffe69d566ec91a7ae53c340d36 Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Wed, 13 Aug 2014 15:27:41 +0200 Subject: OSX: add a fix for lion_fs loosing handles after calling fs from key shortcut, also reenabled lion_fs for OSX >= 10.9 again --- intern/ghost/intern/GHOST_SystemCocoa.mm | 4 ++-- intern/ghost/intern/GHOST_WindowCocoa.mm | 17 ++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'intern/ghost') diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 2e372d7c995..3bef63a2cee 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -736,10 +736,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_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index 41be2801146..f9b8899fbe5 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -728,15 +728,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]; } -- cgit v1.2.3 From fc2b6a2b9d749c7a05c48ee2a423570eb3b9f3b6 Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Wed, 13 Aug 2014 15:32:35 +0200 Subject: OSX: fix paranthesis in last commit --- intern/ghost/intern/GHOST_SystemCocoa.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'intern/ghost') diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 3bef63a2cee..6fefb6a1de6 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -739,7 +739,7 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent) // 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) || [event modifierFlags] & NSAlternateKeyMask)) + if ([event type] == NSKeyUp && (([event modifierFlags] & NSCommandKeyMask) || ([event modifierFlags] & NSAlternateKeyMask))) handleKeyEvent(event); [NSApp sendEvent:event]; -- cgit v1.2.3 From 88ee650263cb8f0670a9d3837f43325009b55115 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 16 Aug 2014 10:51:07 +1000 Subject: Comments --- intern/ghost/GHOST_C-api.h | 6 +-- intern/ghost/GHOST_ISystem.h | 68 +++++++++++++++---------------- intern/ghost/GHOST_IWindow.h | 13 +++--- intern/ghost/GHOST_Rect.h | 2 +- intern/ghost/intern/GHOST_DropTargetX11.h | 2 +- intern/ghost/intern/GHOST_System.h | 6 +-- intern/ghost/intern/GHOST_SystemX11.cpp | 2 +- intern/ghost/intern/GHOST_WindowManager.h | 2 +- 8 files changed, 47 insertions(+), 54 deletions(-) (limited to 'intern/ghost') diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index 7428acee17e..c877a3b8fad 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 @@ -751,7 +751,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) */ @@ -845,7 +845,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 - * GLUT. + * GLUT. * GLUT was used in Blender 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 : - *
    - *
  • 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.
  • - *
+ * + * - 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: - *
    - *
  • OSX Cocoa.
  • - *
  • OSX Carbon.
  • - *
  • Windows.
  • - *
  • X11.
  • - *
  • SDL1.3 (experimental).
  • - *
  • NULL (headless mode).
  • - *
+ * + * - 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: - *
    - *
  • The C-API. For programs written in C.
  • - *
  • The C++-API. For programs written in C++.
  • - *
- * 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: - *
    - *
  • GHOST_IEvent.h
  • - *
  • GHOST_IEventConsumer.h
  • - *
  • GHOST_ISystem.h
  • - *
  • GHOST_ITimerTask.h
  • - *
  • GHOST_IWindow.h
  • - *
  • GHOST_Rect.h
  • - *
  • GHOST_Types.h
  • - *
+ * + * - 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 35577075263..c6befff6871 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: - *
    - *
  • The screen coordinate system. The origin of the screen is located in the - * upper left corner of the screen.
  • - *
  • The client rectangle coordinate system. The client rectangle of a window - * is the area that is drawable by the application (excluding title bars etc.). - *
  • - *
+ * + * - The screen coordinate system. The origin of the screen is located in the + * upper left corner of the screen. + * - 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/intern/GHOST_DropTargetX11.h b/intern/ghost/intern/GHOST_DropTargetX11.h index 9ac45ba8dfe..4670c2e5b4b 100644 --- a/intern/ghost/intern/GHOST_DropTargetX11.h +++ b/intern/ghost/intern/GHOST_DropTargetX11.h @@ -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_System.h b/intern/ghost/intern/GHOST_System.h index ec0022f0a7d..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 diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 16ebdc377ea..f797d8074e1 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -670,7 +670,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) { 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; -- cgit v1.2.3 From bba80ed7afa8ccea14310f35f767749f5d04207e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Aug 2014 12:18:40 +1000 Subject: Cleanup --- intern/ghost/intern/GHOST_DropTargetX11.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'intern/ghost') diff --git a/intern/ghost/intern/GHOST_DropTargetX11.h b/intern/ghost/intern/GHOST_DropTargetX11.h index 4670c2e5b4b..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); -- cgit v1.2.3 From adb08def613d32185e52fc063f034afa66b62513 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 18 Aug 2014 20:49:35 +0600 Subject: Fix T39630: Mouse Wheel doesn't detect Multi Window Focus --- intern/ghost/intern/GHOST_SystemWin32.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'intern/ghost') diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 8cfd2856231..3b95373f800 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include "utfconv.h" @@ -1056,6 +1057,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. @@ -1063,12 +1065,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. -- cgit v1.2.3 From d93c07d987d12489b36e6f53a235cf575df6b8d0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 21 Aug 2014 00:10:57 +1000 Subject: Cleanup --- intern/ghost/intern/GHOST_NDOFManager3Dconnexion.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'intern/ghost') 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) -- cgit v1.2.3 From 3f2cf6da6f53f1969755dd26b92ab19719e6f00a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 27 Aug 2014 18:57:53 +1000 Subject: Cleanup: remove _DEBUG define usage --- intern/ghost/intern/GHOST_DisplayManagerX11.cpp | 4 ++-- intern/ghost/intern/GHOST_SystemPathsWin32.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'intern/ghost') 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_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 #include "utfconv.h" -#if defined(__MINGW32__) || defined(__CYGWIN__) +#ifdef __MINGW32__ #if !defined(SHARD_PIDL) #define SHARD_PIDL 0x00000001L -- cgit v1.2.3