Ken Thomases : winemac: Defer minimizing hidden windows until they are shown.

Alexandre Julliard julliard at winehq.org
Tue Jun 4 15:48:35 CDT 2013


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Tue Jun  4 04:59:42 2013 -0500

winemac: Defer minimizing hidden windows until they are shown.

Minimizing invisible windows causes weird phantoms to appear in
Exposé, the Window menu, and the Dock.

---

 dlls/winemac.drv/cocoa_window.h |    1 +
 dlls/winemac.drv/cocoa_window.m |   33 +++++++++++++++++++++++++++++++--
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_window.h b/dlls/winemac.drv/cocoa_window.h
index e1af247..0f7e084 100644
--- a/dlls/winemac.drv/cocoa_window.h
+++ b/dlls/winemac.drv/cocoa_window.h
@@ -29,6 +29,7 @@
     BOOL disabled;
     BOOL noActivate;
     BOOL floating;
+    BOOL pendingMinimize;
     WineWindow* latentParentWindow;
 
     void* hwnd;
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index 2da8a08..035576e 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -636,10 +636,16 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
         }
         [self setCollectionBehavior:behavior];
 
+        pendingMinimize = FALSE;
         if (state->minimized && ![self isMiniaturized])
         {
-            ignore_windowMiniaturize = TRUE;
-            [self miniaturize:nil];
+            if ([self isVisible])
+            {
+                ignore_windowMiniaturize = TRUE;
+                [self miniaturize:nil];
+            }
+            else
+                pendingMinimize = TRUE;
         }
         else if (!state->minimized && [self isMiniaturized])
         {
@@ -754,6 +760,13 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
             if (needAdjustWindowLevels)
                 [controller adjustWindowLevels];
 
+            if (pendingMinimize)
+            {
+                ignore_windowMiniaturize = TRUE;
+                [self miniaturize:nil];
+                pendingMinimize = FALSE;
+            }
+
             NSEnableScreenUpdates();
 
             /* Cocoa may adjust the frame when the window is ordered onto the screen.
@@ -770,6 +783,8 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
 
     - (void) doOrderOut
     {
+        if ([self isMiniaturized])
+            pendingMinimize = TRUE;
         self.latentParentWindow = [self parentWindow];
         [latentParentWindow removeChildWindow:self];
         [self orderOut:nil];
@@ -948,6 +963,13 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
         [self orderFront:nil];
         [controller adjustWindowLevels];
 
+        if (pendingMinimize)
+        {
+            ignore_windowMiniaturize = TRUE;
+            [self miniaturize:nil];
+            pendingMinimize = FALSE;
+        }
+
         NSEnableScreenUpdates();
 
         causing_becomeKeyWindow = TRUE;
@@ -1057,6 +1079,13 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
             [self setLevel:[front level]];
         [self orderFront:nil];
         [controller adjustWindowLevels];
+
+        if (pendingMinimize)
+        {
+            ignore_windowMiniaturize = TRUE;
+            [self miniaturize:nil];
+            pendingMinimize = FALSE;
+        }
     }
 
     - (void) sendEvent:(NSEvent*)event




More information about the wine-cvs mailing list