Module: wine Branch: master Commit: 5cf64084fb6f277c3453099a65a78817d5c9f1db URL: https://source.winehq.org/git/wine.git/?a=commit;h=5cf64084fb6f277c3453099a6...
Author: Chip Davis cdavis@codeweavers.com Date: Sun Nov 24 20:14:51 2019 -0600
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: Chip Davis cdavis@codeweavers.com Signed-off-by: Ken Thomases ken@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/winemac.drv/cocoa_app.m | 58 ++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 26 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index efbd657384..b5658eab08 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -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;