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

This commit is contained in:
Adi Shavit 2014-01-16 11:09:25 +02:00
parent e45cf2173f
commit 24333569aa
2 changed files with 7 additions and 11 deletions

View File

@ -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,

View File

@ -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 );