mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 15:31:14 +00:00
back/win32: record deltaX and deltaY for mouse move/drag events, matching OS X
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@30007 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3fac142d1a
commit
e0f9b12412
2 changed files with 11 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
2010-03-19 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/win32/WIN32Server.m: Report deltaX and deltaY
|
||||
for mouse move events, like OS X does.
|
||||
|
||||
2010-03-19 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/win32/WIN32Server.m: Process WM_SYSKEYDOWN
|
||||
|
|
|
@ -1841,6 +1841,7 @@ process_mouse_event(WIN32Server *svr, HWND hwnd, WPARAM wParam, LPARAM lParam,
|
|||
{
|
||||
NSEvent *event;
|
||||
NSPoint eventLocation;
|
||||
static NSPoint lastLocation = {0.0, 0.0};
|
||||
unsigned int eventFlags;
|
||||
NSTimeInterval time;
|
||||
LONG ltime;
|
||||
|
@ -1915,6 +1916,8 @@ process_mouse_event(WIN32Server *svr, HWND hwnd, WPARAM wParam, LPARAM lParam,
|
|||
else if (eventType == NSMouseMoved)
|
||||
{
|
||||
NSEvent *e;
|
||||
deltaX = eventLocation.x - lastLocation.x;
|
||||
deltaY = -(eventLocation.y - lastLocation.y);
|
||||
|
||||
if (wParam & MK_LBUTTON)
|
||||
{
|
||||
|
@ -2018,14 +2021,14 @@ process_mouse_event(WIN32Server *svr, HWND hwnd, WPARAM wParam, LPARAM lParam,
|
|||
|
||||
if (eventType == NSMouseMoved) {
|
||||
static HWND lastHwnd = 0;
|
||||
static NSPoint lastLocation = {0.0, 0.0};
|
||||
if (hwnd == lastHwnd && NSEqualPoints(eventLocation, lastLocation))
|
||||
return nil; // mouse hasn't actually moved -- don't generate another event
|
||||
// record window and location of this event, to check next mouseMoved event against
|
||||
lastHwnd = hwnd;
|
||||
lastLocation = eventLocation;
|
||||
lastHwnd = hwnd;
|
||||
}
|
||||
|
||||
lastLocation = eventLocation;
|
||||
|
||||
event = [NSEvent mouseEventWithType: eventType
|
||||
location: eventLocation
|
||||
modifierFlags: eventFlags
|
||||
|
|
Loading…
Reference in a new issue