Revision: 15266
          http://sourceforge.net/p/skim-app/code/15266
Author:   hofman
Date:     2025-05-23 15:54:22 +0000 (Fri, 23 May 2025)
Log Message:
-----------
simply set presentation options for window on NSApp

Modified Paths:
--------------
    trunk/NSDocument_SKExtensions.h
    trunk/NSDocument_SKExtensions.m
    trunk/SKApplication.h
    trunk/SKApplication.m
    trunk/SKMainDocument.m
    trunk/SKMainWindowController_FullScreen.m
    trunk/SKNotesDocument.m

Modified: trunk/NSDocument_SKExtensions.h
===================================================================
--- trunk/NSDocument_SKExtensions.h     2025-05-23 15:30:57 UTC (rev 15265)
+++ trunk/NSDocument_SKExtensions.h     2025-05-23 15:54:22 UTC (rev 15266)
@@ -54,8 +54,6 @@
 
 + (BOOL)isPDFDocument;
 
-@property (nonatomic, readonly) SKInteractionMode systemInteractionMode;
-
 @property (nonatomic, nullable, readonly) NSWindow *mainWindow;
 
 - (IBAction)copyURL:(nullable id)sender;

Modified: trunk/NSDocument_SKExtensions.m
===================================================================
--- trunk/NSDocument_SKExtensions.m     2025-05-23 15:30:57 UTC (rev 15265)
+++ trunk/NSDocument_SKExtensions.m     2025-05-23 15:54:22 UTC (rev 15266)
@@ -67,8 +67,6 @@
 
 + (BOOL)isPDFDocument { return NO; }
 
-- (SKInteractionMode)systemInteractionMode { return SKNormalMode; }
-
 - (NSWindow *)mainWindow {
     return [[[self windowControllers] firstObject] window];
 }

Modified: trunk/SKApplication.h
===================================================================
--- trunk/SKApplication.h       2025-05-23 15:30:57 UTC (rev 15265)
+++ trunk/SKApplication.h       2025-05-23 15:54:22 UTC (rev 15266)
@@ -58,8 +58,6 @@
 
 @property (nonatomic, getter=isUserAttentionDisabled) BOOL 
userAttentionDisabled;
 
-- (void)updatePresentationOptionsForWindow:(NSWindow *)aWindow;
-
 - (BOOL)willDragMouse;
 
 @property (nullable, weak) id<SKApplicationDelegate> delegate;

Modified: trunk/SKApplication.m
===================================================================
--- trunk/SKApplication.m       2025-05-23 15:30:57 UTC (rev 15265)
+++ trunk/SKApplication.m       2025-05-23 15:54:22 UTC (rev 15266)
@@ -80,16 +80,6 @@
     [super terminate:sender];
 }
 
-- (void)updatePresentationOptionsForWindow:(NSWindow *)aWindow {
-    const NSApplicationPresentationOptions options[4] = 
{NSApplicationPresentationDefault,
-            NSApplicationPresentationAutoHideDock | 
NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationFullScreen,
-            NSApplicationPresentationHideDock | 
NSApplicationPresentationHideMenuBar
-        };
-    SKInteractionMode mode = [[[aWindow windowController] document] 
systemInteractionMode];
-    if ([self presentationOptions] != options[mode])
-        [self setPresentationOptions:options[mode]];
-}
-
 - (BOOL)willDragMouse {
     return NSEventTypeLeftMouseDragged == [[self 
nextEventMatchingMask:(NSEventMaskLeftMouseUp | NSEventMaskLeftMouseDragged) 
untilDate:[NSDate distantFuture] inMode:NSEventTrackingRunLoopMode dequeue:NO] 
type];
 }

Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m      2025-05-23 15:30:57 UTC (rev 15265)
+++ trunk/SKMainDocument.m      2025-05-23 15:54:22 UTC (rev 15266)
@@ -1556,13 +1556,6 @@
 
 #pragma mark Accessors
 
-- (SKInteractionMode)systemInteractionMode {
-    // only return the real interaction mode when the fullscreen window is on 
the primary screen, otherwise no need to block main menu and dock
-    if ([NSScreen screenForWindowHasMenuBar:[[self mainWindowController] 
window]])
-        return [[self mainWindowController] interactionMode];
-    return SKNormalMode;
-}
-
 - (NSWindow *)mainWindow {
     return [mainWindowController window];
 }

Modified: trunk/SKMainWindowController_FullScreen.m
===================================================================
--- trunk/SKMainWindowController_FullScreen.m   2025-05-23 15:30:57 UTC (rev 
15265)
+++ trunk/SKMainWindowController_FullScreen.m   2025-05-23 15:54:22 UTC (rev 
15266)
@@ -237,7 +237,7 @@
         [mainWindow makeFirstResponder:pdfView];
     [mainWindow setDelegate:self];
     [mainWindow makeKeyWindow];
-    [NSApp updatePresentationOptionsForWindow:mainWindow];
+    [NSApp setPresentationOptions:NSApplicationPresentationDefault];
     [mainWindow setAnimationBehavior:NSWindowAnimationBehaviorDefault];
 
     [NSApp removeWindowsItem:presentationWindow];
@@ -402,7 +402,9 @@
             
             [mainWindow setDelegate:nil];
             [self setWindow:presentationWindow];
-            [NSApp updatePresentationOptionsForWindow:presentationWindow];
+            // only hide the dock and menubar when the presentation window is 
on the primary screen, otherwise no need to block main menu and dock
+            if ([NSScreen screenForWindowHasMenuBar:presentationWindow])
+                [NSApp 
setPresentationOptions:NSApplicationPresentationHideDock | 
NSApplicationPresentationHideMenuBar];
             [mainWindow setAnimationBehavior:NSWindowAnimationBehaviorNone];
             [mainWindow orderOut:nil];
             [mainWindow setAnimationBehavior:NSWindowAnimationBehaviorDefault];

Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m     2025-05-23 15:30:57 UTC (rev 15265)
+++ trunk/SKNotesDocument.m     2025-05-23 15:54:22 UTC (rev 15266)
@@ -453,12 +453,6 @@
     return ([[self window] styleMask] & NSWindowStyleMaskFullScreen) == 0 ? 
SKNormalMode : SKFullScreenMode;
 }
 
-- (SKInteractionMode)systemInteractionMode  {
-    if ([NSScreen screenForWindowHasMenuBar:[self window]])
-        return [self interactionMode];
-    return SKNormalMode;
-}
-
 - (NSArray *)SkimNoteProperties {
     NSArray *array = [super SkimNoteProperties];
     if ([unsupportedNotes count])

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