Revision: 14200
          http://sourceforge.net/p/skim-app/code/14200
Author:   hofman
Date:     2024-04-10 15:41:28 +0000 (Wed, 10 Apr 2024)
Log Message:
-----------
ignore closed snapshot windows to decide whether to animate fullscreen 
transition ourselves

Modified Paths:
--------------
    trunk/SKMainWindowController_FullScreen.m

Modified: trunk/SKMainWindowController_FullScreen.m
===================================================================
--- trunk/SKMainWindowController_FullScreen.m   2024-04-09 21:25:58 UTC (rev 
14199)
+++ trunk/SKMainWindowController_FullScreen.m   2024-04-10 15:41:28 UTC (rev 
14200)
@@ -76,8 +76,6 @@
 #define TABGROUP_KEY                @"tabGroup"
 #define TABINDEX_KEY                @"tabIndex"
 
-#define WINDOW_KEY @"window"
-
 #define SKAutoHideToolbarInFullScreenKey @"SKAutoHideToolbarInFullScreen"
 #define SKResizablePresentationKey @"SKResizablePresentation"
 
@@ -611,6 +609,16 @@
             [(animate ? (id)[view animator] : (id)view) setAlphaValue:alpha];
 }
 
+static inline NSArray *openWindows(NSWindowController *windowController) {
+    NSMutableArray *openWindows = [NSMutableArray array];
+    for (NSWindowController *wc in [[windowController document] 
windowControllers]) {
+        NSWindow *window = [wc window];
+        if ([window isVisible])
+            [openWindows addObject:window];
+    }
+    return openWindows;
+}
+
 - (void)windowWillEnterFullScreen:(NSNotification *)notification {
     mwcFlags.isSwitchingFullScreen = 1;
     interactionMode = SKFullScreenMode;
@@ -633,7 +641,7 @@
 }
 
 - (NSArray *)customWindowsToEnterFullScreenForWindow:(NSWindow *)window {
-    NSArray *windows = [[[self document] windowControllers] 
valueForKey:WINDOW_KEY];
+    NSArray *windows = openWindows(self);
     if ([[NSWorkspace sharedWorkspace] 
accessibilityDisplayShouldReduceMotion]) {
         animationWindow = [[SKAnimatedBorderlessWindow alloc] 
initWithContentRect:[window frame]];
         windows = [windows arrayByAddingObject:animationWindow];
@@ -724,7 +732,7 @@
 }
 
 - (NSArray *)customWindowsToExitFullScreenForWindow:(NSWindow *)window {
-    NSArray *windows = [[[self document] windowControllers] 
valueForKey:WINDOW_KEY];
+    NSArray *windows = openWindows(self);
     if ([[NSWorkspace sharedWorkspace] 
accessibilityDisplayShouldReduceMotion]) {
         animationWindow = [[SKAnimatedBorderlessWindow alloc] 
initWithContentRect:[window frame]];
         windows = [windows arrayByAddingObject:animationWindow];
@@ -813,7 +821,7 @@
                 aSelector == 
@selector(window:startCustomAnimationToEnterFullScreenWithDuration:) ||
                 aSelector == 
@selector(customWindowsToExitFullScreenForWindow:) ||
                 aSelector == 
@selector(window:startCustomAnimationToExitFullScreenWithDuration:)) &&
-               [[[self document] windowControllers] count] == 1)
+               [openWindows(self) count] == 1)
         return NO;
     else
         return YES;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to