Small fixes: typo, spacing and using ::ScreenToClient() instead of ::GetWindowRect()

pull/2122/head
Adi Shavit 11 years ago
parent e45cf2173f
commit 24333569aa
  1. 6
      modules/highgui/include/opencv2/highgui.hpp
  2. 12
      modules/highgui/src/window_w32.cpp

@ -76,9 +76,9 @@ enum { EVENT_MOUSEMOVE = 0,
EVENT_MBUTTONUP = 6, EVENT_MBUTTONUP = 6,
EVENT_LBUTTONDBLCLK = 7, EVENT_LBUTTONDBLCLK = 7,
EVENT_RBUTTONDBLCLK = 8, EVENT_RBUTTONDBLCLK = 8,
EVENT_MBUTTONDBLCLK =9, EVENT_MBUTTONDBLCLK = 9,
EVENT_MOUSEWHEEL =10, EVENT_MOUSEWHEEL = 10,
EVENT_MOUSEHWHEEL =11 EVENT_MOUSEHWHEEL = 11
}; };
enum { EVENT_FLAG_LBUTTON = 1, enum { EVENT_FLAG_LBUTTON = 1,

@ -40,7 +40,7 @@
//M*/ //M*/
#include "precomp.hpp" #include "precomp.hpp"
#include <windowsx.h> // required for GET_X_LPARAM() and GET_Y_LPARAM() marco #include <windowsx.h> // required for GET_X_LPARAM() and GET_Y_LPARAM() macros
#if defined WIN32 || defined _WIN32 #if defined WIN32 || defined _WIN32
@ -1395,13 +1395,9 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
flags |= (delta << 16); flags |= (delta << 16);
POINT pt; POINT pt;
{ pt.x = GET_X_LPARAM( lParam );
// since The coordinates are relative to screen so get screen size. pt.y = GET_Y_LPARAM( lParam );
RECT windowRect; ::ScreenToClient(hwnd, &pt); // Convert screen coordinates to client coordinates.
::GetWindowRect( window->hwnd, &windowRect );
pt.x = GET_X_LPARAM( lParam ) - windowRect.left;
pt.y = GET_Y_LPARAM( lParam ) - windowRect.top;
}
RECT rect; RECT rect;
GetClientRect( window->hwnd, &rect ); GetClientRect( window->hwnd, &rect );

Loading…
Cancel
Save