Ken Thomases : winemac: Defer ordering a window out if it' s in the process of entering or exiting Cocoa full-screen mode.

Alexandre Julliard julliard at winehq.org
Mon Apr 24 16:11:24 CDT 2017


Module: wine
Branch: master
Commit: 5ebb83ad4eba70e034ef8ee03fdddbe72b10a648
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5ebb83ad4eba70e034ef8ee03fdddbe72b10a648

Author: Ken Thomases <ken at codeweavers.com>
Date:   Mon Apr 24 13:07:13 2017 -0500

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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 b4cc018..f9c3902 100644
--- a/dlls/winemac.drv/cocoa_window.h
+++ b/dlls/winemac.drv/cocoa_window.h
@@ -33,6 +33,7 @@
     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 0823aee..7fa432a 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -1614,6 +1614,7 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
                 [self checkWineDisplayLink];
                 needAdjustWindowLevels = TRUE;
             }
+            pendingOrderOut = FALSE;
 
             if ([self becameEligibleParentOrChild])
                 needAdjustWindowLevels = TRUE;
@@ -1649,6 +1650,21 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
         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 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
     {
         enteringFullScreen = FALSE;
         enteredFullScreenTime = [[NSProcessInfo processInfo] systemUptime];
+        if (pendingOrderOut)
+            [self doOrderOut];
     }
 
     - (void) windowDidExitFullScreen:(NSNotification*)notification
@@ -2714,18 +2732,24 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
         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




More information about the wine-cvs mailing list