Revision: 15303
http://sourceforge.net/p/skim-app/code/15303
Author: hofman
Date: 2025-05-26 17:21:52 +0000 (Mon, 26 May 2025)
Log Message:
-----------
Use same ivar savedWindow for normal window during presentation and animation
window during fullscreen animation
Modified Paths:
--------------
trunk/SKMainWindowController.h
trunk/SKMainWindowController.m
trunk/SKMainWindowController_FullScreen.m
Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h 2025-05-26 17:08:43 UTC (rev 15302)
+++ trunk/SKMainWindowController.h 2025-05-26 17:21:52 UTC (rev 15303)
@@ -127,9 +127,8 @@
NSArray<NSString *> *tags;
double rating;
- NSWindow *mainWindow;
+ NSWindow *savedWindow;
SKSideWindow *sideWindow;
- NSWindow *animationWindow;
SKInteractionMode interactionMode;
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2025-05-26 17:08:43 UTC (rev 15302)
+++ trunk/SKMainWindowController.m 2025-05-26 17:21:52 UTC (rev 15303)
@@ -564,7 +564,7 @@
NSString *rectString = [setup objectForKey:MAINWINDOWFRAME_KEY];
if (rectString) {
if ([self interactionMode] == SKPresentationMode)
- [mainWindow setFrame:NSRectFromString(rectString)
display:NO];
+ [savedWindow setFrame:NSRectFromString(rectString)
display:NO];
else
[[self window] setFrame:NSRectFromString(rectString)
display:YES];
}
@@ -604,7 +604,7 @@
NSArray *cropBoxes = [self changedCropBoxes];
if ([self interactionMode] == SKPresentationMode)
- [setup setObject:NSStringFromRect([mainWindow frame])
forKey:MAINWINDOWFRAME_KEY];
+ [setup setObject:NSStringFromRect([savedWindow frame])
forKey:MAINWINDOWFRAME_KEY];
else
[setup setObject:NSStringFromRect([[self window] frame])
forKey:MAINWINDOWFRAME_KEY];
[setup setObject:[NSNumber numberWithDouble:[self leftSideWidth]]
forKey:LEFTSIDEPANEWIDTH_KEY];
@@ -1638,7 +1638,7 @@
[[SKImageToolTipWindow sharedToolTipWindow] orderOut:nil];
- if (isPresentation && mwcFlags.thumbnailsUpdatedDuringPresentaton == 0 &&
fabs([[self window] backingScaleFactor] - [mainWindow backingScaleFactor]) >
0.0) {
+ if (isPresentation && mwcFlags.thumbnailsUpdatedDuringPresentaton == 0 &&
fabs([[self window] backingScaleFactor] - [savedWindow backingScaleFactor]) >
0.0) {
[self allThumbnailsNeedUpdate];
mwcFlags.thumbnailsUpdatedDuringPresentaton = 1;
}
@@ -2912,7 +2912,7 @@
CGFloat scale = [[self window] backingScaleFactor];
dispatch_queue_t queue = [thumbnail isPlaceholder] ? [[self class]
thumbnailQueue] : [[self class] utilityThumbnailQueue];
- if ([self interactionMode] == SKPresentationMode &&
mwcFlags.thumbnailsNeedUpdateAfterPresentaton == 0 && fabs([mainWindow
backingScaleFactor] - scale) > 0.0)
+ if ([self interactionMode] == SKPresentationMode &&
mwcFlags.thumbnailsNeedUpdateAfterPresentaton == 0 && fabs([savedWindow
backingScaleFactor] - scale) > 0.0)
mwcFlags.thumbnailsNeedUpdateAfterPresentaton = 1;
dispatch_async(queue, ^{
Modified: trunk/SKMainWindowController_FullScreen.m
===================================================================
--- trunk/SKMainWindowController_FullScreen.m 2025-05-26 17:08:43 UTC (rev
15302)
+++ trunk/SKMainWindowController_FullScreen.m 2025-05-26 17:21:52 UTC (rev
15303)
@@ -109,7 +109,7 @@
[leftSideController.topBar setDrawsBackground:NO];
}
- if (mwcFlags.thumbnailsUpdatedDuringPresentaton == 0 && fabs([[self
window] backingScaleFactor] - [mainWindow backingScaleFactor]) > 0.0) {
+ if (mwcFlags.thumbnailsUpdatedDuringPresentaton == 0 && fabs([[self
window] backingScaleFactor] - [savedWindow backingScaleFactor]) > 0.0) {
[self allThumbnailsNeedUpdate];
mwcFlags.thumbnailsUpdatedDuringPresentaton = 1;
}
@@ -241,9 +241,9 @@
interactionMode = SKPresentationMode;
- mainWindow = [self window];
+ savedWindow = [self window];
- NSScreen *screen = [mainWindow screen];
+ NSScreen *screen = [savedWindow screen];
if ([self presentationNotesDocument] && [self presentationNotesDocument]
!= [self document]) {
NSArray *screens = [[[[self presentationNotesDocument] mainWindow]
screen] alternateScreens];
if ([screens count] > 0 && [screens containsObject:[screen
primaryScreen]] == NO)
@@ -269,15 +269,15 @@
[self showNotesForPresentationWindow:presentationWindow];
BOOL shouldFadeOut = NO;
- if ([[mainWindow tabbedWindows] count] > 1) {
- NSUInteger tabIndex = [[mainWindow tabbedWindows]
indexOfObject:mainWindow];
- [savedNormalSetup setObject:[mainWindow tabGroup] forKey:TABGROUP_KEY];
+ if ([[savedWindow tabbedWindows] count] > 1) {
+ NSUInteger tabIndex = [[savedWindow tabbedWindows]
indexOfObject:savedWindow];
+ [savedNormalSetup setObject:[savedWindow tabGroup]
forKey:TABGROUP_KEY];
[savedNormalSetup setObject:[NSNumber
numberWithUnsignedInteger:tabIndex] forKey:TABINDEX_KEY];
- } else if (NSContainsRect([presentationWindow frame], [mainWindow frame])
== NO) {
+ } else if (NSContainsRect([presentationWindow frame], [savedWindow frame])
== NO) {
shouldFadeOut = YES;
}
- [mainWindow setDelegate:nil];
+ [savedWindow setDelegate:nil];
[self setWindow:presentationWindow];
@@ -292,7 +292,7 @@
[context setTimingFunction:[CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[[presentationWindow animator] setAlphaValue:1.0];
if (shouldFadeOut)
- [[mainWindow animator] setAlphaValue:0.0];
+ [[savedWindow animator] setAlphaValue:0.0];
[[[presentationPreview window] animator] setAlphaValue:1.0];
}
completionHandler:^{
@@ -300,8 +300,8 @@
if ([NSScreen screenForWindowHasMenuBar:presentationWindow])
[NSApp
setPresentationOptions:NSApplicationPresentationHideDock |
NSApplicationPresentationHideMenuBar];
- [mainWindow orderOutWithoutAnimation];
- [mainWindow setAlphaValue:1.0];
+ [savedWindow orderOutWithoutAnimation];
+ [savedWindow setAlphaValue:1.0];
if ([self hasOverview])
[self hideOverviewAnimating:NO];
@@ -368,7 +368,7 @@
if (mode != [pdfView extendedDisplayMode])
[pdfView setExtendedDisplayModeAndRewind:mode];
- [self setWindow:mainWindow];
+ [self setWindow:savedWindow];
if (mwcFlags.thumbnailsNeedUpdateAfterPresentaton) {
mwcFlags.thumbnailsNeedUpdateAfterPresentaton = 0;
@@ -379,20 +379,20 @@
NSWindowTabGroup *tabGroup = [savedNormalSetup objectForKey:TABGROUP_KEY];
BOOL moveToTab = [[tabGroup windows] count] > 0;
- [mainWindow setAlphaValue:0.0];
- if (NSPointInRect(SKCenterPoint([mainWindow frame]), [[presentationWindow
screen] frame]) && moveToTab == NO) {
- NSWindowCollectionBehavior collectionBehavior = [mainWindow
collectionBehavior];
+ [savedWindow setAlphaValue:0.0];
+ if (NSPointInRect(SKCenterPoint([savedWindow frame]), [[presentationWindow
screen] frame]) && moveToTab == NO) {
+ NSWindowCollectionBehavior collectionBehavior = [savedWindow
collectionBehavior];
// trick to make sure the main window shows up in the same space as
the fullscreen window
- [mainWindow setCollectionBehavior:collectionBehavior |
NSWindowCollectionBehaviorMoveToActiveSpace];
- [mainWindow orderFrontWithoutAnimation];
- dispatch_async(dispatch_get_main_queue(), ^{ [mainWindow
setCollectionBehavior:collectionBehavior]; });
+ [savedWindow setCollectionBehavior:collectionBehavior |
NSWindowCollectionBehaviorMoveToActiveSpace];
+ [savedWindow orderFrontWithoutAnimation];
+ dispatch_async(dispatch_get_main_queue(), ^{ [savedWindow
setCollectionBehavior:collectionBehavior]; });
} else {
- [mainWindow orderFrontWithoutAnimation];
+ [savedWindow orderFrontWithoutAnimation];
}
- if ([pdfView window] == mainWindow)
- [mainWindow makeFirstResponder:pdfView];
- [mainWindow setDelegate:self];
- [mainWindow makeKeyWindow];
+ if ([pdfView window] == savedWindow)
+ [savedWindow makeFirstResponder:pdfView];
+ [savedWindow setDelegate:self];
+ [savedWindow makeKeyWindow];
[NSApp removeWindowsItem:presentationWindow];
[presentationWindow setLevel:NSPopUpMenuWindowLevel];
@@ -401,10 +401,10 @@
if (moveToTab) {
NSUInteger tabIndex = [[savedNormalSetup objectForKey:TABINDEX_KEY]
unsignedIntegerValue];
- [mainWindow setAlphaValue:1.0];
- [tabGroup insertWindow:mainWindow atIndex:MIN(tabIndex, [[tabGroup
windows] count])];
- } else if (NSContainsRect([presentationWindow frame], [mainWindow frame]))
{
- [mainWindow setAlphaValue:1.0];
+ [savedWindow setAlphaValue:1.0];
+ [tabGroup insertWindow:savedWindow atIndex:MIN(tabIndex, [[tabGroup
windows] count])];
+ } else if (NSContainsRect([presentationWindow frame], [savedWindow
frame])) {
+ [savedWindow setAlphaValue:1.0];
}
[savedNormalSetup removeAllObjects];
@@ -417,8 +417,8 @@
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
[context setDuration:PRESENTATION_DURATION];
[context setTimingFunction:[CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
- if ([mainWindow alphaValue] < 1.0)
- [[mainWindow animator] setAlphaValue:1.0];
+ if ([savedWindow alphaValue] < 1.0)
+ [[savedWindow animator] setAlphaValue:1.0];
[[presentationWindow animator] setAlphaValue:0.0];
[[[presentationPreview window] animator] setAlphaValue:0.0];
}
@@ -429,7 +429,7 @@
[presentationView setPage:nil];
[presentationView setAutoScales:NO];
- mainWindow = nil;
+ savedWindow = nil;
if (presentationPreview) {
[[presentationPreview window]
setAnimationBehavior:NSWindowAnimationBehaviorNone];
@@ -494,14 +494,14 @@
}
NSImage *image = [[NSImage alloc] initWithCGImage:cgImage size:frame.size];
CGImageRelease(cgImage);
- if (animationWindow == nil)
- animationWindow = [[SKAnimatedBorderlessWindow alloc]
initWithContentRect:frame];
+ if (savedWindow == nil)
+ savedWindow = [[SKAnimatedBorderlessWindow alloc]
initWithContentRect:frame];
else
- [animationWindow setFrame:frame display:NO];
- [animationWindow addImageViewWithImage:image];
- [animationWindow setHasShadow:[window hasShadow]];
- [animationWindow setLevel:[window level]];
- [animationWindow orderWindow:NSWindowAbove relativeTo:window];
+ [savedWindow setFrame:frame display:NO];
+ [savedWindow addImageViewWithImage:image];
+ [savedWindow setHasShadow:[window hasShadow]];
+ [savedWindow setLevel:[window level]];
+ [savedWindow orderWindow:NSWindowAbove relativeTo:window];
[window setAlphaValue:0.0];
}
@@ -588,8 +588,8 @@
if ([windows count] == 1)
return nil;
if ([[NSWorkspace sharedWorkspace]
accessibilityDisplayShouldReduceMotion]) {
- animationWindow = [[SKAnimatedBorderlessWindow alloc]
initWithContentRect:[window frame]];
- windows = [windows arrayByAddingObject:animationWindow];
+ savedWindow = [[SKAnimatedBorderlessWindow alloc]
initWithContentRect:[window frame]];
+ windows = [windows arrayByAddingObject:savedWindow];
}
return windows;
}
@@ -600,11 +600,11 @@
NSRect frame = SKShrinkRect([[window screen] frame],
-fullScreenOffset(window), NSMaxYEdge);
if ([[NSUserDefaults standardUserDefaults]
boolForKey:AppleMenuBarVisibleInFullscreenKey])
frame.size.height -= [[NSApp mainMenu] menuBarHeight] ?: 24.0;
- if (animationWindow != nil) {
+ if (savedWindow != nil) {
[self displayStaticContentForWindow:window];
[(SKMainWindow *)window setDisableConstrainedFrame:YES];
[window setFrame:frame display:YES];
- [window orderWindow:NSWindowAbove relativeTo:animationWindow];
+ [window orderWindow:NSWindowAbove relativeTo:savedWindow];
setAlphaValueOfTitleBarControls(window, 0.0, NO);
[(SKMainWindow *)window setDisableConstrainedFrame:NO];
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
@@ -613,8 +613,8 @@
[[window animator] setAlphaValue:1.0];
}
completionHandler:^{
- [animationWindow orderOut:nil];
- animationWindow = nil;
+ [savedWindow orderOut:nil];
+ savedWindow = nil;
}];
} else {
[(SKMainWindow *)window setDisableConstrainedFrame:YES];
@@ -656,7 +656,7 @@
}
if ([[pdfView document] isLocked] == NO || [savedNormalSetup count] == 1)
[savedNormalSetup removeAllObjects];
- animationWindow = nil;
+ savedWindow = nil;
interactionMode = SKNormalMode;
mwcFlags.isSwitchingFullScreen = 0;
}
@@ -681,8 +681,8 @@
if ([windows count] == 1)
return nil;
if ([[NSWorkspace sharedWorkspace]
accessibilityDisplayShouldReduceMotion]) {
- animationWindow = [[SKAnimatedBorderlessWindow alloc]
initWithContentRect:[window frame]];
- windows = [windows arrayByAddingObject:animationWindow];
+ savedWindow = [[SKAnimatedBorderlessWindow alloc]
initWithContentRect:[window frame]];
+ windows = [windows arrayByAddingObject:savedWindow];
}
return windows;
}
@@ -689,13 +689,13 @@
- (void)window:(NSWindow *)window
startCustomAnimationToExitFullScreenWithDuration:(NSTimeInterval)duration {
NSRect frame = NSRectFromString([savedNormalSetup
objectForKey:MAINWINDOWFRAME_KEY]);
- if (animationWindow != nil) {
+ if (savedWindow != nil) {
[self displayStaticContentForWindow:window];
[window setStyleMask:[window styleMask] &
~NSWindowStyleMaskFullScreen];
setAlphaValueOfTitleBarControls(window, 1.0, NO);
[window setFrame:frame display:YES];
[window setLevel:NSNormalWindowLevel];
- BOOL covered = NSContainsRect([animationWindow frame], [window frame]);
+ BOOL covered = NSContainsRect([savedWindow frame], [window frame]);
if (covered)
[window setAlphaValue:1.0];
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
@@ -703,11 +703,11 @@
[context setTimingFunction:[CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
if (covered == NO)
[[window animator] setAlphaValue:1.0];
- [[animationWindow animator] setAlphaValue:0.0];
+ [[savedWindow animator] setAlphaValue:0.0];
}
completionHandler:^{
- [animationWindow orderOut:nil];
- animationWindow = nil;
+ [savedWindow orderOut:nil];
+ savedWindow = nil;
}];
} else {
NSRect startFrame = [window frame];
@@ -756,7 +756,7 @@
[self applyPDFSettings:fullScreenSetup rewind:YES];
[self forceSubwindowsOnTop:YES];
}
- animationWindow = nil;
+ savedWindow = nil;
mwcFlags.isSwitchingFullScreen = 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