Ken Thomases : winemac: For SetCursorPos(), reset positions of pending mouse button and scroll events.
Alexandre Julliard
julliard at winehq.org
Fri Apr 26 11:21:21 CDT 2013
Module: wine
Branch: master
Commit: 51129752bc0ef5c4b2f90c1af09ed2c63d79e119
URL: http://source.winehq.org/git/wine.git/?a=commit;h=51129752bc0ef5c4b2f90c1af09ed2c63d79e119
Author: Ken Thomases <ken at codeweavers.com>
Date: Fri Apr 26 04:06:12 2013 -0500
winemac: For SetCursorPos(), reset positions of pending mouse button and scroll events.
They are effectively deemed to have happened after the SetCursorPos().
---
dlls/winemac.drv/cocoa_app.m | 3 ++-
dlls/winemac.drv/cocoa_event.h | 2 ++
dlls/winemac.drv/cocoa_event.m | 23 +++++++++++++++++++++++
3 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index cde93d8..7a304a8 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -1032,8 +1032,8 @@ int macdrv_err_on;
{
[self clipCursorLocation:&pos];
+ ret = [self warpCursorTo:&pos from:NULL];
synthesizedLocation = pos;
- ret = [self warpCursorTo:&synthesizedLocation from:NULL];
if (ret)
{
// We want to discard mouse-move events that have already been
@@ -1076,6 +1076,7 @@ int macdrv_err_on;
[queue discardEventsMatchingMask:event_mask_for_type(MOUSE_MOVED) |
event_mask_for_type(MOUSE_MOVED_ABSOLUTE)
forWindow:nil];
+ [queue resetMouseEventPositions:pos];
}
[eventQueuesLock unlock];
}
diff --git a/dlls/winemac.drv/cocoa_event.h b/dlls/winemac.drv/cocoa_event.h
index c1afc73..4e6bf84 100644
--- a/dlls/winemac.drv/cocoa_event.h
+++ b/dlls/winemac.drv/cocoa_event.h
@@ -42,6 +42,8 @@
- (BOOL) query:(macdrv_query*)query timeout:(NSTimeInterval)timeout processEvents:(BOOL)processEvents;
- (BOOL) query:(macdrv_query*)query timeout:(NSTimeInterval)timeout;
+ - (void) resetMouseEventPositions:(CGPoint)pos;
+
@end
void OnMainThread(dispatch_block_t block);
diff --git a/dlls/winemac.drv/cocoa_event.m b/dlls/winemac.drv/cocoa_event.m
index 1cbd5fb..7c41d26 100644
--- a/dlls/winemac.drv/cocoa_event.m
+++ b/dlls/winemac.drv/cocoa_event.m
@@ -280,6 +280,29 @@ static NSString* const WineEventQueueThreadDictionaryKey = @"WineEventQueueThrea
return [self query:query timeout:timeout processEvents:FALSE];
}
+ - (void) resetMouseEventPositions:(CGPoint)pos
+ {
+ MacDrvEvent* event;
+
+ [eventsLock lock];
+
+ for (event in events)
+ {
+ if (event->event->type == MOUSE_BUTTON)
+ {
+ event->event->mouse_button.x = pos.x;
+ event->event->mouse_button.y = pos.y;
+ }
+ else if (event->event->type == MOUSE_SCROLL)
+ {
+ event->event->mouse_scroll.x = pos.x;
+ event->event->mouse_scroll.y = pos.y;
+ }
+ }
+
+ [eventsLock unlock];
+ }
+
/***********************************************************************
* OnMainThread
More information about the wine-cvs
mailing list