From 5ebb83ad4eba70e034ef8ee03fdddbe72b10a648 Mon Sep 17 00:00:00 2001 From: Ken Thomases Date: Mon, 24 Apr 2017 13:07:13 -0500 Subject: [PATCH] winemac: Defer ordering a window out if it's in the process of entering or exiting Cocoa full-screen mode. Cocoa doesn't handle the window being ordered out or closed during the animation well and leaves a ghost window around. Signed-off-by: Ken Thomases Signed-off-by: Alexandre Julliard --- dlls/winemac.drv/cocoa_window.h | 1 + dlls/winemac.drv/cocoa_window.m | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/dlls/winemac.drv/cocoa_window.h b/dlls/winemac.drv/cocoa_window.h index b4cc018414f..f9c3902dc36 100644 --- a/dlls/winemac.drv/cocoa_window.h +++ b/dlls/winemac.drv/cocoa_window.h @@ -33,6 +33,7 @@ @interface WineWindow : NSPanel BOOL maximized; BOOL fullscreen; BOOL pendingMinimize; + BOOL pendingOrderOut; BOOL savedVisibleState; BOOL drawnSinceShown; WineWindow* latentParentWindow; diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index 0823aee7178..7fa432a35d5 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -1614,6 +1614,7 @@ - (void) orderBelow:(WineWindow*)prev orAbove:(WineWindow*)next activate:(BOOL)a [self checkWineDisplayLink]; needAdjustWindowLevels = TRUE; } + pendingOrderOut = FALSE; if ([self becameEligibleParentOrChild]) needAdjustWindowLevels = TRUE; @@ -1649,6 +1650,21 @@ - (void) doOrderOut BOOL wasVisible = [self isVisible]; BOOL wasOnActiveSpace = [self isOnActiveSpace]; + if (enteringFullScreen || exitingFullScreen) + { + pendingOrderOut = TRUE; + [queue discardEventsMatchingMask:event_mask_for_type(WINDOW_BROUGHT_FORWARD) | + event_mask_for_type(WINDOW_GOT_FOCUS) | + event_mask_for_type(WINDOW_LOST_FOCUS) | + event_mask_for_type(WINDOW_MAXIMIZE_REQUESTED) | + event_mask_for_type(WINDOW_MINIMIZE_REQUESTED) | + event_mask_for_type(WINDOW_RESTORE_REQUESTED) + forWindow:self]; + return; + } + + pendingOrderOut = FALSE; + if ([self isMiniaturized]) pendingMinimize = TRUE; @@ -2707,6 +2723,8 @@ - (void) windowDidEnterFullScreen:(NSNotification*)notification { enteringFullScreen = FALSE; enteredFullScreenTime = [[NSProcessInfo processInfo] systemUptime]; + if (pendingOrderOut) + [self doOrderOut]; } - (void) windowDidExitFullScreen:(NSNotification*)notification @@ -2714,18 +2732,24 @@ - (void) windowDidExitFullScreen:(NSNotification*)notification exitingFullScreen = FALSE; [self setFrameAndWineFrame:nonFullscreenFrame]; [self windowDidResize:nil]; + if (pendingOrderOut) + [self doOrderOut]; } - (void) windowDidFailToEnterFullScreen:(NSWindow*)window { enteringFullScreen = FALSE; enteredFullScreenTime = 0; + if (pendingOrderOut) + [self doOrderOut]; } - (void) windowDidFailToExitFullScreen:(NSWindow*)window { exitingFullScreen = FALSE; [self windowDidResize:nil]; + if (pendingOrderOut) + [self doOrderOut]; } - (void)windowDidMiniaturize:(NSNotification *)notification