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 <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ken Thomases 2017-04-24 13:07:13 -05:00 committed by Alexandre Julliard
parent 302593c9c0
commit 5ebb83ad4e
2 changed files with 25 additions and 0 deletions

View File

@ -33,6 +33,7 @@ @interface WineWindow : NSPanel <NSWindowDelegate>
BOOL maximized;
BOOL fullscreen;
BOOL pendingMinimize;
BOOL pendingOrderOut;
BOOL savedVisibleState;
BOOL drawnSinceShown;
WineWindow* latentParentWindow;

View File

@ -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