Revision: 13541
          http://sourceforge.net/p/skim-app/code/13541
Author:   hofman
Date:     2023-07-27 15:51:21 +0000 (Thu, 27 Jul 2023)
Log Message:
-----------
Animate to fullscreen to reduced frame when shopwing main menu bar in 
fullscreen, possible on 12.0+

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

Modified: trunk/SKMainWindowController_FullScreen.m
===================================================================
--- trunk/SKMainWindowController_FullScreen.m   2023-07-26 22:19:35 UTC (rev 
13540)
+++ trunk/SKMainWindowController_FullScreen.m   2023-07-27 15:51:21 UTC (rev 
13541)
@@ -86,6 +86,8 @@
 
 static CGFloat fullScreenToolbarOffset = 0.0;
 
+static BOOL showMenuBarInFullScreen = NO;
+
 #if SDK_BEFORE(10_12)
 @interface NSWorkSpace (BDSKSierraDeclarations)
 - (void)accessibilityDisplayShouldReduceMotion;
@@ -615,6 +617,7 @@
 }
 
 - (NSApplicationPresentationOptions)window:(NSWindow *)window 
willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions
 {
+    showMenuBarInFullScreen = (proposedOptions & 
NSApplicationPresentationAutoHideMenuBar) == 0;
     if (autoHideToolbarInFullScreen)
         return proposedOptions | NSApplicationPresentationAutoHideToolbar;
     return proposedOptions;
@@ -636,6 +639,8 @@
     if (fullScreenToolbarOffset <= 0.0 && autoHideToolbarInFullScreen == NO && 
[[mainWindow toolbar] isVisible])
         fullScreenToolbarOffset = toolbarViewOffset(mainWindow);
     NSRect frame = SKShrinkRect([[window screen] frame], 
-fullScreenOffset(window), NSMaxYEdge);
+    if (showMenuBarInFullScreen)
+        frame.size.height -= [[NSApp mainMenu] menuBarHeight];
     if (animationWindow != nil) {
         [self showStaticContentForWindow:window];
         [(SKMainWindow *)window setDisableConstrainedFrame:YES];
@@ -729,7 +734,8 @@
     NSRect frame = NSRectFromString([savedNormalSetup 
objectForKey:MAINWINDOWFRAME_KEY]);
     if (animationWindow != nil) {
         [self showStaticContentForWindow:window];
-        [animationWindow setLevel:NSStatusWindowLevel];
+        if (showMenuBarInFullScreen == NO)
+            [animationWindow setLevel:NSStatusWindowLevel];
         [window setStyleMask:[window styleMask] & 
~NSWindowStyleMaskFullScreen];
         setAlphaValueOfTitleBarControls(window, 1.0, NO);
         [window setFrame:frame display:YES];
@@ -750,12 +756,13 @@
             }];
     } else {
         NSRect startFrame = [window frame];
-        startFrame.size.height = NSHeight([[window screen] frame]) + 
fullScreenOffset(window);
+        startFrame.size.height += fullScreenOffset(window);
         [window setStyleMask:[window styleMask] & 
~NSWindowStyleMaskFullScreen];
         setAlphaValueOfTitleBarControls(window, 0.0, NO);
         [(SKMainWindow *)window setDisableConstrainedFrame:YES];
         [window setFrame:startFrame display:YES];
-        [window setLevel:NSStatusWindowLevel];
+        if (showMenuBarInFullScreen == NO)
+            [window setLevel:NSStatusWindowLevel];
         [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
                 [context setDuration:duration];
                 [[window animator] setFrame:frame display:YES];

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

Reply via email to