From 24333569aa8096f863b115814c10f0917630040c Mon Sep 17 00:00:00 2001 From: Adi Shavit Date: Thu, 16 Jan 2014 11:09:25 +0200 Subject: [PATCH] Small fixes: typo, spacing and using ::ScreenToClient() instead of ::GetWindowRect() --- modules/highgui/include/opencv2/highgui.hpp | 6 +++--- modules/highgui/src/window_w32.cpp | 12 ++++-------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/modules/highgui/include/opencv2/highgui.hpp b/modules/highgui/include/opencv2/highgui.hpp index 00e1ce4..0687470 100644 --- a/modules/highgui/include/opencv2/highgui.hpp +++ b/modules/highgui/include/opencv2/highgui.hpp @@ -76,9 +76,9 @@ enum { EVENT_MOUSEMOVE = 0, EVENT_MBUTTONUP = 6, EVENT_LBUTTONDBLCLK = 7, EVENT_RBUTTONDBLCLK = 8, - EVENT_MBUTTONDBLCLK =9, - EVENT_MOUSEWHEEL =10, - EVENT_MOUSEHWHEEL =11 + EVENT_MBUTTONDBLCLK = 9, + EVENT_MOUSEWHEEL = 10, + EVENT_MOUSEHWHEEL = 11 }; enum { EVENT_FLAG_LBUTTON = 1, diff --git a/modules/highgui/src/window_w32.cpp b/modules/highgui/src/window_w32.cpp index bb47047..1e665ed 100644 --- a/modules/highgui/src/window_w32.cpp +++ b/modules/highgui/src/window_w32.cpp @@ -40,7 +40,7 @@ //M*/ #include "precomp.hpp" -#include // required for GET_X_LPARAM() and GET_Y_LPARAM() marco +#include // required for GET_X_LPARAM() and GET_Y_LPARAM() macros #if defined WIN32 || defined _WIN32 @@ -1395,13 +1395,9 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) flags |= (delta << 16); POINT pt; - { - // since The coordinates are relative to screen so get screen size. - RECT windowRect; - ::GetWindowRect( window->hwnd, &windowRect ); - pt.x = GET_X_LPARAM( lParam ) - windowRect.left; - pt.y = GET_Y_LPARAM( lParam ) - windowRect.top; - } + pt.x = GET_X_LPARAM( lParam ); + pt.y = GET_Y_LPARAM( lParam ); + ::ScreenToClient(hwnd, &pt); // Convert screen coordinates to client coordinates. RECT rect; GetClientRect( window->hwnd, &rect ); -- 2.7.4