From: Brendan Shanks bshanks@codeweavers.com
--- dlls/winemac.drv/cocoa_app.h | 1 - dlls/winemac.drv/cocoa_app.m | 56 +++++++++++------------------------- 2 files changed, 17 insertions(+), 40 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_app.h b/dlls/winemac.drv/cocoa_app.h index b2b8187e0b4..9ba4d86e319 100644 --- a/dlls/winemac.drv/cocoa_app.h +++ b/dlls/winemac.drv/cocoa_app.h @@ -128,7 +128,6 @@ @interface WineApplicationController : NSObject <NSApplicationDelegate> BOOL beenActive;
NSMutableSet* windowsBeingDragged; - BOOL useDragNotifications; }
@property (nonatomic) CGEventSourceKeyboardType keyboardType; diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index 85ce592c363..500b933005a 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -191,15 +191,6 @@ - (id) init
windowsBeingDragged = [[NSMutableSet alloc] init];
- // On macOS 10.12+, use notifications to more reliably detect when windows are being dragged. - if ([NSProcessInfo instancesRespondToSelector:@selector(isOperatingSystemAtLeastVersion:)]) - { - NSOperatingSystemVersion requiredVersion = { 10, 12, 0 }; - useDragNotifications = [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:requiredVersion]; - } - else - useDragNotifications = NO; - if (!requests || !requestsManipQueue || !eventQueues || !eventQueuesLock || !keyWindows || !originalDisplayModes || !latentDisplayModes) { @@ -1844,17 +1835,6 @@ - (BOOL) handleEvent:(NSEvent*)anEvent [window postKeyEvent:anEvent]; } } - else if (!useDragNotifications && type == NSEventTypeAppKitDefined) - { - WineWindow *window = (WineWindow *)[anEvent window]; - short subtype = [anEvent subtype]; - - // These subtypes are not documented but they appear to mean - // "a window is being dragged" and "a window is no longer being - // dragged", respectively. - if ((subtype == 20 || subtype == 21) && [window isKindOfClass:[WineWindow class]]) - [self handleWindowDrag:window begin:(subtype == 20)]; - }
return ret; } @@ -1914,25 +1894,23 @@ - (void) setupObservations [windowsBeingDragged removeObject:window]; }];
- if (useDragNotifications) { - [nc addObserverForName:NSWindowWillStartDraggingNotification - object:nil - queue:[NSOperationQueue mainQueue] - usingBlock:^(NSNotification *note){ - NSWindow* window = [note object]; - if ([window isKindOfClass:[WineWindow class]]) - [self handleWindowDrag:(WineWindow *)window begin:YES]; - }]; - - [nc addObserverForName:NSWindowDidEndDraggingNotification - object:nil - queue:[NSOperationQueue mainQueue] - usingBlock:^(NSNotification *note){ - NSWindow* window = [note object]; - if ([window isKindOfClass:[WineWindow class]]) - [self handleWindowDrag:(WineWindow *)window begin:NO]; - }]; - } + [nc addObserverForName:NSWindowWillStartDraggingNotification + object:nil + queue:[NSOperationQueue mainQueue] + usingBlock:^(NSNotification *note){ + NSWindow* window = [note object]; + if ([window isKindOfClass:[WineWindow class]]) + [self handleWindowDrag:(WineWindow *)window begin:YES]; + }]; + + [nc addObserverForName:NSWindowDidEndDraggingNotification + object:nil + queue:[NSOperationQueue mainQueue] + usingBlock:^(NSNotification *note){ + NSWindow* window = [note object]; + if ([window isKindOfClass:[WineWindow class]]) + [self handleWindowDrag:(WineWindow *)window begin:NO]; + }];
[nc addObserver:self selector:@selector(keyboardSelectionDidChange)