Revision: 15296 http://sourceforge.net/p/skim-app/code/15296 Author: hofman Date: 2025-05-26 15:25:06 +0000 (Mon, 26 May 2025) Log Message: ----------- convenience nswindow methods to show/hide windows wwithout implicit animation
Modified Paths: -------------- trunk/NSWindow_SKExtensions.h trunk/NSWindow_SKExtensions.m trunk/SKMainWindowController_FullScreen.m trunk/SKSnapshotWindowController.m Modified: trunk/NSWindow_SKExtensions.h =================================================================== --- trunk/NSWindow_SKExtensions.h 2025-05-26 14:45:06 UTC (rev 15295) +++ trunk/NSWindow_SKExtensions.h 2025-05-26 15:25:06 UTC (rev 15296) @@ -49,6 +49,9 @@ - (NSImageView *)addImageViewWithImage:(nullable NSImage *)image; +- (void)orderFrontWithoutAnimation; +- (void)orderOutWithoutAnimation; + @end NS_ASSUME_NONNULL_END Modified: trunk/NSWindow_SKExtensions.m =================================================================== --- trunk/NSWindow_SKExtensions.m 2025-05-26 14:45:06 UTC (rev 15295) +++ trunk/NSWindow_SKExtensions.m 2025-05-26 15:25:06 UTC (rev 15296) @@ -147,6 +147,20 @@ return imageView; } +- (void)orderFrontWithoutAnimation { + NSWindowAnimationBehavior animationBehavior = [self animationBehavior]; + [self setAnimationBehavior:NSWindowAnimationBehaviorNone]; + [self orderFront:nil]; + [self setAnimationBehavior:animationBehavior]; +} + +- (void)orderOutWithoutAnimation { + NSWindowAnimationBehavior animationBehavior = [self animationBehavior]; + [self setAnimationBehavior:NSWindowAnimationBehaviorNone]; + [self orderOut:nil]; + [self setAnimationBehavior:animationBehavior]; +} + - (BOOL)isRestorable { return NO; } @end Modified: trunk/SKMainWindowController_FullScreen.m =================================================================== --- trunk/SKMainWindowController_FullScreen.m 2025-05-26 14:45:06 UTC (rev 15295) +++ trunk/SKMainWindowController_FullScreen.m 2025-05-26 15:25:06 UTC (rev 15296) @@ -298,9 +298,7 @@ if ([NSScreen screenForWindowHasMenuBar:presentationWindow]) [NSApp setPresentationOptions:NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar]; - [mainWindow setAnimationBehavior:NSWindowAnimationBehaviorNone]; - [mainWindow orderOut:nil]; - [mainWindow setAnimationBehavior:NSWindowAnimationBehaviorDefault]; + [mainWindow orderOutWithoutAnimation]; [mainWindow setAlphaValue:1.0]; if ([self hasOverview]) [self hideOverviewAnimating:NO]; @@ -380,22 +378,20 @@ BOOL moveToTab = [[tabGroup windows] count] > 0; [mainWindow setAlphaValue:0.0]; - [mainWindow setAnimationBehavior:NSWindowAnimationBehaviorNone]; if (NSPointInRect(SKCenterPoint([mainWindow frame]), [[presentationWindow screen] 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]; - [mainWindow makeKeyAndOrderFront:nil]; + [mainWindow orderFrontWithoutAnimation]; dispatch_async(dispatch_get_main_queue(), ^{ [mainWindow setCollectionBehavior:collectionBehavior]; }); } else { - [mainWindow makeKeyAndOrderFront:nil]; + [mainWindow orderFrontWithoutAnimation]; } if ([pdfView window] == mainWindow) [mainWindow makeFirstResponder:pdfView]; [mainWindow setDelegate:self]; [mainWindow makeKeyWindow]; - [mainWindow setAnimationBehavior:NSWindowAnimationBehaviorDefault]; - + [NSApp removeWindowsItem:presentationWindow]; [presentationWindow setLevel:NSPopUpMenuWindowLevel]; Modified: trunk/SKSnapshotWindowController.m =================================================================== --- trunk/SKSnapshotWindowController.m 2025-05-26 14:45:06 UTC (rev 15295) +++ trunk/SKSnapshotWindowController.m 2025-05-26 15:25:06 UTC (rev 15296) @@ -268,9 +268,7 @@ if (openType == SKSnapshotOpenPreview) { [[self window] setAlphaValue:0.0]; - [[self window] setAnimationBehavior:NSWindowAnimationBehaviorNone]; - [[self window] orderFront:nil]; - [[self window] setAnimationBehavior:NSWindowAnimationBehaviorDefault]; + [[self window] orderFrontWithoutAnimation]; } else if ([self hasWindow]) { [self showWindow:nil]; } @@ -662,9 +660,7 @@ [miniaturizeWindow orderFront:nil]; if (miniaturize) { - [window setAnimationBehavior:NSWindowAnimationBehaviorNone]; - [window orderOut:nil]; - [window setAnimationBehavior:NSWindowAnimationBehaviorDefault]; + [window orderOutWithoutAnimation]; } animating = YES; @@ -676,10 +672,8 @@ } completionHandler:^{ if (miniaturize == NO) { - [window setAnimationBehavior:NSWindowAnimationBehaviorNone]; - [window orderFront:nil]; + [window orderFrontWithoutAnimation]; [self updateWindowLevel]; - [window setAnimationBehavior:NSWindowAnimationBehaviorDefault]; } [miniaturizeWindow orderOut:nil]; animating = NO; 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