Revision: 16662
          http://sourceforge.net/p/skim-app/code/16662
Author:   hofman
Date:     2026-10-15 22:20:53 +0000 (Thu, 15 Oct 2026)
Log Message:
-----------
implement performClose: in presentation window to exit presentation. Implement 
windowShouldClose: to avoid pathologies when switching full screen and commit 
any edits

Modified Paths:
--------------
    trunk/SKFullScreenWindow.m
    trunk/SKMainWindowController_UI.m

Modified: trunk/SKFullScreenWindow.m
===================================================================
--- trunk/SKFullScreenWindow.m  2026-10-15 16:06:25 UTC (rev 16661)
+++ trunk/SKFullScreenWindow.m  2026-10-15 22:20:53 UTC (rev 16662)
@@ -37,6 +37,7 @@
  */
 
 #import "SKFullScreenWindow.h"
+#import "SKMainWindowController_Actions.h"
 
 @implementation SKFullScreenWindow
 
@@ -65,5 +66,19 @@
     [[self windowController] tryToPerform:_cmd with:self];
 }
 
+- (void)performClose:(id)sender {
+    if ([self delegate] == nil || [[self windowController] 
respondsToSelector:@selector(togglePresentation:)] == NO)
+        return;
+    if ([[self delegate] respondsToSelector:@selector(windowShouldClose:)] && 
[[self delegate] windowShouldClose:self] == NO)
+        return;
+    [[self windowController] tryToPerform:@selector(togglePresentation:) 
with:self];
+}
+
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
+    if ([menuItem action] == @selector(performClose:))
+        return [self delegate] && [[self windowController] 
respondsToSelector:@selector(togglePresentation:)];
+    return [super validateMenuItem:menuItem];
+}
+
 @end
 

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2026-10-15 16:06:25 UTC (rev 16661)
+++ trunk/SKMainWindowController_UI.m   2026-10-15 22:20:53 UTC (rev 16662)
@@ -286,6 +286,16 @@
     }
 }
 
+- (BOOL)windowShouldClose:(NSWindow *)window {
+    if (mwcFlags.isSwitchingFullScreen)
+        return NO;
+    if ([self interactionMode] == SKPresentationMode)
+        return [self canExitPresentation];
+    if (mwcFlags.isEditingTable || [pdfView isEditing])
+        return [self commitEditing];
+    return YES;
+}
+
 - (void)windowWillClose:(NSNotification *)notification {
     [(id)[self document] windowWillClose:notification];
     

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