Ken Thomases : winemac: Make clicking on the app' s dock icon unminimize a window if there are only minimized windows.

Alexandre Julliard julliard at winehq.org
Fri Oct 4 15:08:40 CDT 2013


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

Author: Ken Thomases <ken at codeweavers.com>
Date:   Fri Oct  4 00:17:24 2013 -0500

winemac: Make clicking on the app's dock icon unminimize a window if there are only minimized windows.

Cocoa would automatically do this for a normal app.  However, the Mac driver
makes all of its windows inherit from NSPanel and Cocoa ignores panels for
this feature.

---

 dlls/winemac.drv/cocoa_app.m |   36 +++++++++++++++++++++++++-----------
 1 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m
index 632a1bb..9d33e7f 100644
--- a/dlls/winemac.drv/cocoa_app.m
+++ b/dlls/winemac.drv/cocoa_app.m
@@ -1915,6 +1915,21 @@ int macdrv_err_on;
         }
     }
 
+    - (void) unminimizeWindowIfNoneVisible
+    {
+        if (![self frontWineWindow])
+        {
+            for (WineWindow* window in [NSApp windows])
+            {
+                if ([window isKindOfClass:[WineWindow class]] && [window isMiniaturized])
+                {
+                    [window deminiaturize:self];
+                    break;
+                }
+            }
+        }
+    }
+
 
     /*
      * ---------- NSApplicationDelegate methods ----------
@@ -1935,17 +1950,8 @@ int macdrv_err_on;
         [self updateFullscreenWindows];
         [self adjustWindowLevels:YES];
 
-        if (beenActive && ![self frontWineWindow])
-        {
-            for (WineWindow* window in [NSApp windows])
-            {
-                if ([window isKindOfClass:[WineWindow class]] && [window isMiniaturized])
-                {
-                    [window deminiaturize:self];
-                    break;
-                }
-            }
-        }
+        if (beenActive)
+            [self unminimizeWindowIfNoneVisible];
         beenActive = TRUE;
 
         // If a Wine process terminates abruptly while it has the display captured
@@ -1997,6 +2003,14 @@ int macdrv_err_on;
         [self releaseMouseCapture];
     }
 
+    - (BOOL) applicationShouldHandleReopen:(NSApplication*)theApplication hasVisibleWindows:(BOOL)flag
+    {
+        // Note that "flag" is often wrong.  WineWindows are NSPanels and NSPanels
+        // don't count as "visible windows" for this purpose.
+        [self unminimizeWindowIfNoneVisible];
+        return YES;
+    }
+
     - (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)sender
     {
         NSApplicationTerminateReply ret = NSTerminateNow;




More information about the wine-cvs mailing list