Revision: 15324
http://sourceforge.net/p/skim-app/code/15324
Author: hofman
Date: 2025-05-29 17:09:53 +0000 (Thu, 29 May 2025)
Log Message:
-----------
Update display settings for full screen switching when the window changes its
fullscreen style mask
Modified Paths:
--------------
trunk/SKMainWindow.h
trunk/SKMainWindow.m
trunk/SKMainWindowController.h
trunk/SKMainWindowController_FullScreen.m
Modified: trunk/SKMainWindow.h
===================================================================
--- trunk/SKMainWindow.h 2025-05-29 15:51:07 UTC (rev 15323)
+++ trunk/SKMainWindow.h 2025-05-29 17:09:53 UTC (rev 15324)
@@ -49,6 +49,7 @@
@protocol SKMainWindowDelegate <NSWindowDelegate>
@optional
- (void)window:(NSWindow *)window willSendEvent:(NSEvent *)event;
+- (void)window:(NSWindow *)window willBecomeFullScreen:(BOOL)fullScreen;
@end
@interface SKMainWindow : NSWindow {
Modified: trunk/SKMainWindow.m
===================================================================
--- trunk/SKMainWindow.m 2025-05-29 15:51:07 UTC (rev 15323)
+++ trunk/SKMainWindow.m 2025-05-29 17:09:53 UTC (rev 15324)
@@ -68,6 +68,13 @@
[self setFrame:frameRect display:YES];
}
+- (void)setStyleMask:(NSWindowStyleMask)styleMask {
+ if ((styleMask & NSWindowStyleMaskFullScreen) != ([self styleMask] &
NSWindowStyleMaskFullScreen) && [[self delegate]
respondsToSelector:@selector(window:willBecomeFullScreen:)]) {
+ [[self delegate] window:self willBecomeFullScreen:0 != (styleMask &
NSWindowStyleMaskFullScreen)];
+ }
+ [super setStyleMask:styleMask];
+}
+
- (void)sendEvent:(NSEvent *)theEvent {
if ([theEvent type] == NSEventTypeLeftMouseDown || [theEvent type] ==
NSEventTypeRightMouseDown || [theEvent type] == NSEventTypeKeyDown) {
if ([[self delegate]
respondsToSelector:@selector(window:willSendEvent:)])
Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h 2025-05-29 15:51:07 UTC (rev 15323)
+++ trunk/SKMainWindowController.h 2025-05-29 17:09:53 UTC (rev 15324)
@@ -196,6 +196,7 @@
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 15:51:07 UTC (rev
15323)
+++ trunk/SKMainWindowController_FullScreen.m 2025-05-29 17:09:53 UTC (rev
15324)
@@ -554,19 +554,38 @@
return openWindows;
}
+- (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];
+ } 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]];
+ }
+}
+
- (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]);
[savedNormalSetup setObject:frameString forKey:MAINWINDOWFRAME_KEY];
- 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];
[self forceSubwindowsOnTop:YES];
}
@@ -597,6 +616,7 @@
[self displayStaticContentForWindowOrdered:NSWindowBelow];
[(SKMainWindow *)window setDisableConstrainedFrame:YES];
[window setFrame:frame display:YES];
+ [self window:window willBecomeFullScreen:YES];
setAlphaValueOfTitleBarControls(window, 0.0, NO);
[(SKMainWindow *)window setDisableConstrainedFrame:NO];
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
@@ -610,6 +630,7 @@
}];
} else {
[(SKMainWindow *)window setDisableConstrainedFrame:YES];
+ [self window:window willBecomeFullScreen:YES];
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
[context setDuration:duration - 0.02];
if (@available(macOS 12.0, *))
@@ -633,17 +654,14 @@
}
[touchBarController interactionModeChanged];
mwcFlags.isSwitchingFullScreen = 0;
+ mwcFlags.didUpdateFullScreenDisplay = 0;
}
- (void)windowDidFailToEnterFullScreen:(NSWindow *)window {
if (interactionMode == SKFullScreenMode) {
interactionMode = SKNormalMode;
- NSColor *backgroundColor = [PDFView defaultBackgroundColor];
- NSDictionary *fullScreenSetup = [[NSUserDefaults standardUserDefaults]
dictionaryForKey:SKDefaultFullScreenPDFDisplaySettingsKey];
- [pdfView setBackgroundColor:backgroundColor];
- [secondaryPdfView setBackgroundColor:backgroundColor];
- if ([[pdfView document] isLocked] == NO && [fullScreenSetup count])
- [self applyPDFSettings:savedNormalSetup rewind:YES];
+ if (mwcFlags.didUpdateFullScreenDisplay)
+ [self window:window willBecomeFullScreen:NO];
}
if ([[pdfView document] isLocked] == NO || [savedNormalSetup count] == 1)
[savedNormalSetup removeAllObjects];
@@ -651,20 +669,13 @@
savedNormalWindow = nil;
interactionMode = SKNormalMode;
mwcFlags.isSwitchingFullScreen = 0;
+ mwcFlags.didUpdateFullScreenDisplay = 0;
}
- (void)windowWillExitFullScreen:(NSNotification *)notification {
mwcFlags.isSwitchingFullScreen = 1;
+ mwcFlags.didUpdateFullScreenDisplay = 0;
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]];
}
- (NSArray *)customWindowsToExitFullScreenForWindow:(NSWindow *)window {
@@ -725,6 +736,7 @@
[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
@@ -738,15 +750,12 @@
- (void)windowDidFailToExitFullScreen:(NSWindow *)window {
if (interactionMode == SKNormalMode) {
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];
+ if (mwcFlags.didUpdateFullScreenDisplay)
+ [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
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit