Corrected bug #1437. Corrected the cast of two short values from an lParam. lParam...
authorDavid Rolland <rold2007@yahoo.com>
Sun, 6 Apr 2014 09:32:01 +0000 (21:32 +1200)
committerDavid Rolland <rold2007@yahoo.com>
Wed, 9 Apr 2014 06:24:21 +0000 (18:24 +1200)
The Microsoft documentation specifies NOT to use LOWORD and HIWORD macros to extract the x/y positions as it won't work correctly with multiple monitors. See http://msdn.microsoft.com/en-us/library/windows/desktop/ms645607(v=vs.85).aspx.

modules/highgui/src/window_w32.cpp

index 59d66b1..48f3aab 100644 (file)
@@ -52,6 +52,7 @@
 #include <string.h>
 #include <stdio.h>
 #include <assert.h>
+#include <windowsx.h>
 
 #ifdef HAVE_OPENGL
 #include <memory>
@@ -1459,8 +1460,8 @@ static LRESULT CALLBACK HighGUIProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
             if( uMsg == WM_LBUTTONUP || uMsg == WM_RBUTTONUP || uMsg == WM_MBUTTONUP )
                 ReleaseCapture();
 
-            pt.x = LOWORD( lParam );
-            pt.y = HIWORD( lParam );
+            pt.x = GET_X_LPARAM( lParam );
+            pt.y = GET_Y_LPARAM( lParam );
 
             GetClientRect( window->hwnd, &rect );
             icvGetBitmapData( window, &size, 0, 0 );