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

This commit is contained in:
Ken Thomases 2013-05-07 03:00:52 -05:00 committed by Alexandre Julliard
parent 3e3d982185
commit 3eee56668a
4 changed files with 14 additions and 10 deletions

View file

@ -1157,12 +1157,13 @@ - (BOOL) stopClippingCursor
- (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 @@ - (void) handleMouseMove:(NSEvent*)anEvent
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];
}

View file

@ -162,7 +162,8 @@ - (void) postEventObject:(MacDrvEvent*)event
(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)
{

View file

@ -227,6 +227,7 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display,
struct {
int x;
int y;
int drag;
unsigned long time_ms;
} mouse_moved;
struct {

View file

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