Revision: 15261
          http://sourceforge.net/p/skim-app/code/15261
Author:   hofman
Date:     2025-05-23 14:53:35 +0000 (Fri, 23 May 2025)
Log Message:
-----------
move normal window to tab after presentation in showNormalWindow method

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

Modified: trunk/SKMainWindowController_FullScreen.m
===================================================================
--- trunk/SKMainWindowController_FullScreen.m   2025-05-23 14:35:30 UTC (rev 
15260)
+++ trunk/SKMainWindowController_FullScreen.m   2025-05-23 14:53:35 UTC (rev 
15261)
@@ -215,13 +215,15 @@
 }
 
 - (void)showNormalWindow {
-    NSWindow *presentationWindow = [self window];
+    NSWindowTabGroup *tabGroup = [savedNormalSetup objectForKey:TABGROUP_KEY];
+    BOOL moveToTab = [[tabGroup windows] count] > 0;
+    NSScreen *presentationScreen = [[self window] screen];
     
     [self setWindow:mainWindow];
     [mainWindow setAlphaValue:0.0];
     [mainWindow setAnimationBehavior:NSWindowAnimationBehaviorNone];
     [mainWindow setLevel:NSNormalWindowLevel];
-    if (NSPointInRect(SKCenterPoint([mainWindow frame]), [[presentationWindow 
screen] frame]) && [[[savedNormalSetup objectForKey:TABGROUP_KEY] windows] 
count] == 0) {
+    if (NSPointInRect(SKCenterPoint([mainWindow frame]), [presentationScreen 
frame]) && moveToTab == NO) {
         NSWindowCollectionBehavior collectionBehavior = [mainWindow 
collectionBehavior];
         // trick to make sure the main window shows up in the same space as 
the fullscreen window
         [mainWindow setCollectionBehavior:collectionBehavior | 
NSWindowCollectionBehaviorMoveToActiveSpace];
@@ -238,6 +240,12 @@
     [mainWindow makeKeyWindow];
     [NSApp updatePresentationOptionsForWindow:mainWindow];
     [mainWindow setAnimationBehavior:NSWindowAnimationBehaviorDefault];
+
+    if (moveToTab) {
+        NSUInteger tabIndex = [[savedNormalSetup objectForKey:TABINDEX_KEY] 
unsignedIntegerValue];
+        [mainWindow setAlphaValue:1.0];
+        [tabGroup insertWindow:mainWindow atIndex:MIN(tabIndex, [[tabGroup 
windows] count])];
+    }
 }
 
 - (void)displayStaticContentForWindow:(NSWindow *)window {
@@ -482,29 +490,20 @@
     
     [touchBarController interactionModeChanged];
     
-    [self showNormalWindow];
-    
     [NSApp removeWindowsItem:presentationWindow];
     [presentationWindow setLevel:NSPopUpMenuWindowLevel];
     
-    BOOL noFadeIn = NSContainsRect([presentationWindow frame], [mainWindow 
frame]);
-    if (noFadeIn)
-        [mainWindow setAlphaValue:1.0];
+    [self showNormalWindow];
     
-    NSWindowTabGroup *tabGroup = [savedNormalSetup objectForKey:TABGROUP_KEY];
-    if ([[tabGroup windows] count]) {
-        NSUInteger tabIndex = [[savedNormalSetup objectForKey:TABINDEX_KEY] 
unsignedIntegerValue];
-        noFadeIn = YES;
+    [savedNormalSetup removeAllObjects];
+    
+    if (NSContainsRect([presentationWindow frame], [mainWindow frame]))
         [mainWindow setAlphaValue:1.0];
-        [tabGroup insertWindow:mainWindow atIndex:MIN(tabIndex, [[tabGroup 
windows] count])];
-    }
     
-    [savedNormalSetup removeAllObjects];
-    
     [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
             [context setDuration:PRESENTATION_DURATION];
             [context setTimingFunction:[CAMediaTimingFunction 
functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
-            if (noFadeIn == NO)
+            if ([mainWindow alphaValue] < 1.0)
                 [[mainWindow animator] setAlphaValue:1.0];
             [[presentationWindow animator] setAlphaValue:0.0];
             [[[presentationPreview window] animator] setAlphaValue:0.0];

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



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to