Module: wine Branch: master Commit: 3eee56668ae20c3356ad296eb934f5faa3ebaf6d URL: http://source.winehq.org/git/wine.git/?a=commit;h=3eee56668ae20c3356ad296eb9...
Author: Ken Thomases ken@codeweavers.com Date: Tue May 7 03:00:52 2013 -0500
winemac: Mouse drags don't imply anything about z-order of target window because of implicit capture.
---
dlls/winemac.drv/cocoa_app.m | 4 +++- dlls/winemac.drv/cocoa_event.m | 3 ++- dlls/winemac.drv/macdrv_cocoa.h | 1 + dlls/winemac.drv/mouse.c | 16 ++++++++-------- 4 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index b4e15d0..52b6f2d 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -1157,12 +1157,13 @@ int macdrv_err_on; - (void) handleMouseMove:(NSEvent*)anEvent { WineWindow* targetWindow; + BOOL drag = [anEvent type] != NSMouseMoved;
/* Because of the way -[NSWindow setAcceptsMouseMovedEvents:] works, the event indicates its window is the main window, even if the cursor is over a different window. Find the actual WineWindow that is under the cursor and post the event as being for that window. */ - if ([anEvent type] == NSMouseMoved) + if (!drag) { CGPoint cgpoint = CGEventGetLocation([anEvent CGEvent]); NSPoint point = [self flippedMouseLocation:NSPointFromCGPoint(cgpoint)]; @@ -1276,6 +1277,7 @@ int macdrv_err_on; if (event->type == MOUSE_MOVED_ABSOLUTE || event->mouse_moved.x || event->mouse_moved.y) { event->mouse_moved.time_ms = [self ticksForEventTime:[anEvent timestamp]]; + event->mouse_moved.drag = drag;
[targetWindow.queue postEvent:event]; } diff --git a/dlls/winemac.drv/cocoa_event.m b/dlls/winemac.drv/cocoa_event.m index 7c41d26..8d997d0 100644 --- a/dlls/winemac.drv/cocoa_event.m +++ b/dlls/winemac.drv/cocoa_event.m @@ -162,7 +162,8 @@ static NSString* const WineEventQueueThreadDictionaryKey = @"WineEventQueueThrea (lastEvent = [events lastObject]) && (lastEvent->event->type == MOUSE_MOVED || lastEvent->event->type == MOUSE_MOVED_ABSOLUTE) && - lastEvent->event->window == event->event->window) + lastEvent->event->window == event->event->window && + lastEvent->event->mouse_moved.drag == event->event->mouse_moved.drag) { if (event->event->type == MOUSE_MOVED) { diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index 39f229d..eb3ed88 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -227,6 +227,7 @@ typedef struct macdrv_event { struct { int x; int y; + int drag; unsigned long time_ms; } mouse_moved; struct { diff --git a/dlls/winemac.drv/mouse.c b/dlls/winemac.drv/mouse.c index da3cc31..248684d 100644 --- a/dlls/winemac.drv/mouse.c +++ b/dlls/winemac.drv/mouse.c @@ -134,14 +134,14 @@ static const CFStringRef cocoa_cursor_names[] = * Update the various window states on a mouse event. */ static void send_mouse_input(HWND hwnd, UINT flags, int x, int y, - DWORD mouse_data, unsigned long time) + DWORD mouse_data, BOOL drag, unsigned long time) { INPUT input; HWND top_level_hwnd;
top_level_hwnd = GetAncestor(hwnd, GA_ROOT);
- if ((flags & MOUSEEVENTF_MOVE) && (flags & MOUSEEVENTF_ABSOLUTE)) + if ((flags & MOUSEEVENTF_MOVE) && (flags & MOUSEEVENTF_ABSOLUTE) && !drag) { RECT rect;
@@ -854,7 +854,7 @@ void macdrv_mouse_button(HWND hwnd, const macdrv_event *event)
send_mouse_input(hwnd, flags | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, event->mouse_button.x, event->mouse_button.y, - data, event->mouse_button.time_ms); + data, FALSE, event->mouse_button.time_ms); }
@@ -867,16 +867,16 @@ void macdrv_mouse_moved(HWND hwnd, const macdrv_event *event) { UINT flags = MOUSEEVENTF_MOVE;
- TRACE("win %p/%p %s (%d,%d) time %lu (%lu ticks ago)\n", hwnd, event->window, + TRACE("win %p/%p %s (%d,%d) drag %d time %lu (%lu ticks ago)\n", hwnd, event->window, (event->type == MOUSE_MOVED) ? "relative" : "absolute", - event->mouse_moved.x, event->mouse_moved.y, + event->mouse_moved.x, event->mouse_moved.y, event->mouse_moved.drag, event->mouse_moved.time_ms, (GetTickCount() - event->mouse_moved.time_ms));
if (event->type == MOUSE_MOVED_ABSOLUTE) flags |= MOUSEEVENTF_ABSOLUTE;
send_mouse_input(hwnd, flags, event->mouse_moved.x, event->mouse_moved.y, - 0, event->mouse_moved.time_ms); + 0, event->mouse_moved.drag, event->mouse_moved.time_ms); }
@@ -894,8 +894,8 @@ void macdrv_mouse_scroll(HWND hwnd, const macdrv_event *event)
send_mouse_input(hwnd, MOUSEEVENTF_WHEEL | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, event->mouse_scroll.x, event->mouse_scroll.y, - event->mouse_scroll.y_scroll, event->mouse_scroll.time_ms); + event->mouse_scroll.y_scroll, FALSE, event->mouse_scroll.time_ms); send_mouse_input(hwnd, MOUSEEVENTF_HWHEEL | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, event->mouse_scroll.x, event->mouse_scroll.y, - event->mouse_scroll.x_scroll, event->mouse_scroll.time_ms); + event->mouse_scroll.x_scroll, FALSE, event->mouse_scroll.time_ms); }