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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-08-18 18:49:35 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-08-18 18:50:57 +0400
commitadb08def613d32185e52fc063f034afa66b62513 (patch)
tree6f1df1c4817c2a327949e49da598929f21e2c76d /intern
parenteb10cda1356811d5ecbfa5cb09d8b947e0c2b194 (diff)
Fix T39630: Mouse Wheel doesn't detect Multi Window Focus
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp20
1 files changed, 19 insertions, 1 deletions
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 <shlobj.h>
#include <tlhelp32.h>
#include <Psapi.h>
+#include <windowsx.h>
#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.