Commit 3eee5666 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Mouse drags don't imply anything about z-order of target window because…

winemac: Mouse drags don't imply anything about z-order of target window because of implicit capture.
parent 3e3d9821
...@@ -1157,12 +1157,13 @@ int macdrv_err_on; ...@@ -1157,12 +1157,13 @@ int macdrv_err_on;
- (void) handleMouseMove:(NSEvent*)anEvent - (void) handleMouseMove:(NSEvent*)anEvent
{ {
WineWindow* targetWindow; WineWindow* targetWindow;
BOOL drag = [anEvent type] != NSMouseMoved;
/* Because of the way -[NSWindow setAcceptsMouseMovedEvents:] works, the /* Because of the way -[NSWindow setAcceptsMouseMovedEvents:] works, the
event indicates its window is the main window, even if the cursor is 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 over a different window. Find the actual WineWindow that is under the
cursor and post the event as being for that window. */ cursor and post the event as being for that window. */
if ([anEvent type] == NSMouseMoved) if (!drag)
{ {
CGPoint cgpoint = CGEventGetLocation([anEvent CGEvent]); CGPoint cgpoint = CGEventGetLocation([anEvent CGEvent]);
NSPoint point = [self flippedMouseLocation:NSPointFromCGPoint(cgpoint)]; NSPoint point = [self flippedMouseLocation:NSPointFromCGPoint(cgpoint)];
...@@ -1276,6 +1277,7 @@ int macdrv_err_on; ...@@ -1276,6 +1277,7 @@ int macdrv_err_on;
if (event->type == MOUSE_MOVED_ABSOLUTE || event->mouse_moved.x || event->mouse_moved.y) 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.time_ms = [self ticksForEventTime:[anEvent timestamp]];
event->mouse_moved.drag = drag;
[targetWindow.queue postEvent:event]; [targetWindow.queue postEvent:event];
} }
......
...@@ -162,7 +162,8 @@ static NSString* const WineEventQueueThreadDictionaryKey = @"WineEventQueueThrea ...@@ -162,7 +162,8 @@ static NSString* const WineEventQueueThreadDictionaryKey = @"WineEventQueueThrea
(lastEvent = [events lastObject]) && (lastEvent = [events lastObject]) &&
(lastEvent->event->type == MOUSE_MOVED || (lastEvent->event->type == MOUSE_MOVED ||
lastEvent->event->type == MOUSE_MOVED_ABSOLUTE) && 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) if (event->event->type == MOUSE_MOVED)
{ {
......
...@@ -227,6 +227,7 @@ typedef struct macdrv_event { ...@@ -227,6 +227,7 @@ typedef struct macdrv_event {
struct { struct {
int x; int x;
int y; int y;
int drag;
unsigned long time_ms; unsigned long time_ms;
} mouse_moved; } mouse_moved;
struct { struct {
......
...@@ -134,14 +134,14 @@ static const CFStringRef cocoa_cursor_names[] = ...@@ -134,14 +134,14 @@ static const CFStringRef cocoa_cursor_names[] =
* Update the various window states on a mouse event. * Update the various window states on a mouse event.
*/ */
static void send_mouse_input(HWND hwnd, UINT flags, int x, int y, 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; INPUT input;
HWND top_level_hwnd; HWND top_level_hwnd;
top_level_hwnd = GetAncestor(hwnd, GA_ROOT); top_level_hwnd = GetAncestor(hwnd, GA_ROOT);
if ((flags & MOUSEEVENTF_MOVE) && (flags & MOUSEEVENTF_ABSOLUTE)) if ((flags & MOUSEEVENTF_MOVE) && (flags & MOUSEEVENTF_ABSOLUTE) && !drag)
{ {
RECT rect; RECT rect;
...@@ -854,7 +854,7 @@ void macdrv_mouse_button(HWND hwnd, const macdrv_event *event) ...@@ -854,7 +854,7 @@ void macdrv_mouse_button(HWND hwnd, const macdrv_event *event)
send_mouse_input(hwnd, flags | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, send_mouse_input(hwnd, flags | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE,
event->mouse_button.x, event->mouse_button.y, 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) ...@@ -867,16 +867,16 @@ void macdrv_mouse_moved(HWND hwnd, const macdrv_event *event)
{ {
UINT flags = MOUSEEVENTF_MOVE; 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->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)); event->mouse_moved.time_ms, (GetTickCount() - event->mouse_moved.time_ms));
if (event->type == MOUSE_MOVED_ABSOLUTE) if (event->type == MOUSE_MOVED_ABSOLUTE)
flags |= MOUSEEVENTF_ABSOLUTE; flags |= MOUSEEVENTF_ABSOLUTE;
send_mouse_input(hwnd, flags, event->mouse_moved.x, event->mouse_moved.y, 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) ...@@ -894,8 +894,8 @@ void macdrv_mouse_scroll(HWND hwnd, const macdrv_event *event)
send_mouse_input(hwnd, MOUSEEVENTF_WHEEL | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, send_mouse_input(hwnd, MOUSEEVENTF_WHEEL | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE,
event->mouse_scroll.x, event->mouse_scroll.y, 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, send_mouse_input(hwnd, MOUSEEVENTF_HWHEEL | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE,
event->mouse_scroll.x, event->mouse_scroll.y, 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);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment