Commit 5cf64084 authored by Chip Davis's avatar Chip Davis Committed by Alexandre Julliard

winemac.drv: Also stop dragging if we receive a mouse up event.

We rely on AppKit-internal events to know when a window is being dragged. In Catalina, AppKit stopped sending the "drag ended" event when no drag actually took place, though it still sends "drag started" events when the title bar is clicked. Ironically, this caused us to think the window was still being dragged. In that case, waiting for the mouse button to come back up should allow us to determine when the drag should end. Signed-off-by: 's avatarChip Davis <cdavis@codeweavers.com> Signed-off-by: 's avatarKen Thomases <ken@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 153db6a7
......@@ -1577,6 +1577,34 @@ static NSString* WineLocalizedString(unsigned int stringID)
}
}
- (void) handleWindowDrag:(NSEvent*)anEvent begin:(BOOL)begin
{
WineWindow* window = (WineWindow*)[anEvent window];
if ([window isKindOfClass:[WineWindow class]])
{
macdrv_event* event;
int eventType;
if (begin)
{
[windowsBeingDragged addObject:window];
eventType = WINDOW_DRAG_BEGIN;
}
else
{
[windowsBeingDragged removeObject:window];
eventType = WINDOW_DRAG_END;
}
[self updateCursorClippingState];
event = macdrv_create_event(eventType, window);
if (eventType == WINDOW_DRAG_BEGIN)
event->window_drag_begin.no_activate = [NSEvent wine_commandKeyDown];
[window.queue postEvent:event];
macdrv_release_event(event);
}
}
- (void) handleMouseMove:(NSEvent*)anEvent
{
WineWindow* targetWindow;
......@@ -1731,6 +1759,9 @@ static NSString* WineLocalizedString(unsigned int stringID)
WineWindow* windowBroughtForward = nil;
BOOL process = FALSE;
if (type == NSLeftMouseUp && [windowsBeingDragged count])
[self handleWindowDrag:theEvent begin:NO];
if ([window isKindOfClass:[WineWindow class]] &&
type == NSLeftMouseDown &&
![theEvent wine_commandKeyDown])
......@@ -2083,32 +2114,7 @@ static NSString* WineLocalizedString(unsigned int stringID)
// "a window is being dragged" and "a window is no longer being
// dragged", respectively.
if (subtype == 20 || subtype == 21)
{
WineWindow* window = (WineWindow*)[anEvent window];
if ([window isKindOfClass:[WineWindow class]])
{
macdrv_event* event;
int eventType;
if (subtype == 20)
{
[windowsBeingDragged addObject:window];
eventType = WINDOW_DRAG_BEGIN;
}
else
{
[windowsBeingDragged removeObject:window];
eventType = WINDOW_DRAG_END;
}
[self updateCursorClippingState];
event = macdrv_create_event(eventType, window);
if (eventType == WINDOW_DRAG_BEGIN)
event->window_drag_begin.no_activate = [NSEvent wine_commandKeyDown];
[window.queue postEvent:event];
macdrv_release_event(event);
}
}
[self handleWindowDrag:anEvent begin:(subtype == 20)];
}
return ret;
......
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