Revision: 15325
          http://sourceforge.net/p/skim-app/code/15325
Author:   hofman
Date:     2025-05-29 21:14:37 +0000 (Thu, 29 May 2025)
Log Message:
-----------
Update interactionMode when changing display for it, and use it to know whether 
we have done so.

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

Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h      2025-05-29 17:09:53 UTC (rev 15324)
+++ trunk/SKMainWindowController.h      2025-05-29 21:14:37 UTC (rev 15325)
@@ -196,7 +196,6 @@
         unsigned int isEditingPDF:1;
         unsigned int isEditingTable:1;
         unsigned int isSwitchingFullScreen:1;
-        unsigned int didUpdateFullScreenDisplay:1;
         unsigned int isAnimatingFindBar:1;
         unsigned int wantsPresentationOrFullScreen:1;
         unsigned int hasCropped:1;

Modified: trunk/SKMainWindowController_FullScreen.m
===================================================================
--- trunk/SKMainWindowController_FullScreen.m   2025-05-29 17:09:53 UTC (rev 
15324)
+++ trunk/SKMainWindowController_FullScreen.m   2025-05-29 21:14:37 UTC (rev 
15325)
@@ -555,33 +555,34 @@
 }
 
 - (void)window:(NSWindow *)windoww willBecomeFullScreen:(BOOL)fullScreen {
-    if (mwcFlags.didUpdateFullScreenDisplay)
-        return;
-    mwcFlags.didUpdateFullScreenDisplay = 1;
     if (fullScreen) {
-        NSColor *backgroundColor = [PDFView defaultFullScreenBackgroundColor];
-        NSDictionary *fullScreenSetup = [[NSUserDefaults standardUserDefaults] 
dictionaryForKey:SKDefaultFullScreenPDFDisplaySettingsKey];
-        [pdfView setBackgroundColor:backgroundColor];
-        [secondaryPdfView setBackgroundColor:backgroundColor];
-        if ([[pdfView document] isLocked] == NO && [fullScreenSetup count])
-            [self applyPDFSettings:fullScreenSetup rewind:YES];
+        if (interactionMode != SKFullScreenMode) {
+            interactionMode = SKFullScreenMode;
+            NSColor *backgroundColor = [PDFView 
defaultFullScreenBackgroundColor];
+            NSDictionary *fullScreenSetup = [[NSUserDefaults 
standardUserDefaults] 
dictionaryForKey:SKDefaultFullScreenPDFDisplaySettingsKey];
+            [pdfView setBackgroundColor:backgroundColor];
+            [secondaryPdfView setBackgroundColor:backgroundColor];
+            if ([[pdfView document] isLocked] == NO && [fullScreenSetup count])
+                [self applyPDFSettings:fullScreenSetup rewind:YES];
+        }
     } else {
-        NSColor *backgroundColor = [PDFView defaultBackgroundColor];
-        [pdfView setBackgroundColor:backgroundColor];
-        [secondaryPdfView setBackgroundColor:backgroundColor];
-        if ([[[NSUserDefaults standardUserDefaults] 
dictionaryForKey:SKDefaultFullScreenPDFDisplaySettingsKey] count])
-            [self applyPDFSettings:savedNormalSetup rewind:YES];
-        NSNumber *leftWidth = [savedNormalSetup 
objectForKey:LEFTSIDEPANEWIDTH_KEY];
-        NSNumber *rightWidth = [savedNormalSetup 
objectForKey:RIGHTSIDEPANEWIDTH_KEY];
-        if (leftWidth && rightWidth)
-            [self applyLeftSideWidth:[leftWidth doubleValue] 
rightSideWidth:[rightWidth doubleValue]];
+        if (interactionMode != SKNormalMode) {
+            interactionMode = SKNormalMode;
+            NSColor *backgroundColor = [PDFView defaultBackgroundColor];
+            [pdfView setBackgroundColor:backgroundColor];
+            [secondaryPdfView setBackgroundColor:backgroundColor];
+            if ([[[NSUserDefaults standardUserDefaults] 
dictionaryForKey:SKDefaultFullScreenPDFDisplaySettingsKey] count])
+                [self applyPDFSettings:savedNormalSetup rewind:YES];
+            NSNumber *leftWidth = [savedNormalSetup 
objectForKey:LEFTSIDEPANEWIDTH_KEY];
+            NSNumber *rightWidth = [savedNormalSetup 
objectForKey:RIGHTSIDEPANEWIDTH_KEY];
+            if (leftWidth && rightWidth)
+                [self applyLeftSideWidth:[leftWidth doubleValue] 
rightSideWidth:[rightWidth doubleValue]];
+        }
     }
 }
 
 - (void)windowWillEnterFullScreen:(NSNotification *)notification {
     mwcFlags.isSwitchingFullScreen = 1;
-    mwcFlags.didUpdateFullScreenDisplay = 0;
-    interactionMode = SKFullScreenMode;
     if ([[pdfView document] isLocked] == NO || [savedNormalSetup count] == 0)
         [savedNormalSetup setDictionary:[self currentPDFSettings]];
     NSString *frameString = NSStringFromRect([[self window] frame]);
@@ -654,28 +655,19 @@
     }
     [touchBarController interactionModeChanged];
     mwcFlags.isSwitchingFullScreen = 0;
-    mwcFlags.didUpdateFullScreenDisplay = 0;
 }
 
 - (void)windowDidFailToEnterFullScreen:(NSWindow *)window {
-    if (interactionMode == SKFullScreenMode) {
-        interactionMode = SKNormalMode;
-        if (mwcFlags.didUpdateFullScreenDisplay)
-            [self window:window willBecomeFullScreen:NO];
-    }
+    [self window:window willBecomeFullScreen:NO];
     if ([[pdfView document] isLocked] == NO || [savedNormalSetup count] == 1)
         [savedNormalSetup removeAllObjects];
     [self forceSubwindowsOnTop:NO];
     savedNormalWindow = nil;
-    interactionMode = SKNormalMode;
     mwcFlags.isSwitchingFullScreen = 0;
-    mwcFlags.didUpdateFullScreenDisplay = 0;
 }
 
 - (void)windowWillExitFullScreen:(NSNotification *)notification {
     mwcFlags.isSwitchingFullScreen = 1;
-    mwcFlags.didUpdateFullScreenDisplay = 0;
-    interactionMode = SKNormalMode;
 }
 
 - (NSArray *)customWindowsToExitFullScreenForWindow:(NSWindow *)window {
@@ -736,7 +728,6 @@
         [savedNormalSetup removeAllObjects];
     [self forceSubwindowsOnTop:NO];
     mwcFlags.isSwitchingFullScreen = 0;
-    mwcFlags.didUpdateFullScreenDisplay = 0;
     if (mwcFlags.wantsPresentationOrFullScreen) {
         mwcFlags.wantsPresentationOrFullScreen = 0;
         // make sure the window fully finishes full screen
@@ -748,14 +739,9 @@
 }
 
 - (void)windowDidFailToExitFullScreen:(NSWindow *)window {
-    if (interactionMode == SKNormalMode) {
-        interactionMode = SKFullScreenMode;
-        if (mwcFlags.didUpdateFullScreenDisplay)
-            [self window:window willBecomeFullScreen:YES];
-    }
+    [self window:window willBecomeFullScreen:YES];
     savedNormalWindow = nil;
     mwcFlags.isSwitchingFullScreen = 0;
-    mwcFlags.didUpdateFullScreenDisplay = 0;
     mwcFlags.wantsPresentationOrFullScreen = 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