Revision: 15534
http://sourceforge.net/p/skim-app/code/15534
Author: hofman
Date: 2025-06-23 21:49:35 +0000 (Mon, 23 Jun 2025)
Log Message:
-----------
No need to check for window identity in window delegate methods, as we are only
the delegate of our own window, otherwwise the delegate it nil. Check for
presentation window bby comparing to savedNomralWindow in presdntation mode.
Modified Paths:
--------------
trunk/SKMainWindowController_UI.m
Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m 2025-06-23 16:38:19 UTC (rev 15533)
+++ trunk/SKMainWindowController_UI.m 2025-06-23 21:49:35 UTC (rev 15534)
@@ -232,42 +232,38 @@
#pragma mark NSWindow delegate protocol
- (void)windowDidBecomeMain:(NSNotification *)notification {
- if ([[self window] isEqual:[notification object]]) {
+ if ([self interactionMode] != SKPresentationMode)
[self updateUtilityPanel];
- if ([self interactionMode] == SKPresentationMode && [NSApp isActive]
&& [[NSUserDefaults standardUserDefaults]
boolForKey:SKUseNormalLevelForPresentationKey] == NO && ([[self window]
styleMask] & NSWindowStyleMaskTitled) == 0)
- [[self window] setLevel:NSPopUpMenuWindowLevel];
- }
+ else if ([NSApp isActive] && [[NSUserDefaults standardUserDefaults]
boolForKey:SKUseNormalLevelForPresentationKey] == NO && [[self window]
isEqual:savedNormalWindow] == NO)
+ [[self window] setLevel:NSPopUpMenuWindowLevel];
}
- (void)windowDidResignMain:(NSNotification *)notification {
- if ([[self window] isEqual:[notification object]]) {
- [[SKImageToolTipWindow sharedToolTipWindow] orderOut:nil];
- if ([[[NSColorPanel sharedColorPanel] accessoryView]
isEqual:colorAccessoryView] || [[[NSColorPanel sharedColorPanel] accessoryView]
isEqual:textColorAccessoryView])
- [[NSColorPanel sharedColorPanel] setAccessoryView:nil];
- if ([self interactionMode] == SKPresentationMode && [[NSUserDefaults
standardUserDefaults] boolForKey:SKUseNormalLevelForPresentationKey] == NO)
- [[self window] setLevel:NSNormalWindowLevel];
- }
+ [[SKImageToolTipWindow sharedToolTipWindow] orderOut:nil];
+ if ([[[NSColorPanel sharedColorPanel] accessoryView]
isEqual:colorAccessoryView] || [[[NSColorPanel sharedColorPanel] accessoryView]
isEqual:textColorAccessoryView])
+ [[NSColorPanel sharedColorPanel] setAccessoryView:nil];
+ if ([self interactionMode] == SKPresentationMode && [[NSUserDefaults
standardUserDefaults] boolForKey:SKUseNormalLevelForPresentationKey] == NO &&
[[self window] isEqual:savedNormalWindow] == NO)
+ [[self window] setLevel:NSNormalWindowLevel];
}
- (void)windowDidResignKey:(NSNotification *)notification {
- if ([[self window] isEqual:[notification object]]) {
- [[SKImageToolTipWindow sharedToolTipWindow] orderOut:nil];
- }
+ [[SKImageToolTipWindow sharedToolTipWindow] orderOut:nil];
}
- (void)windowWillClose:(NSNotification *)notification {
- if ([[notification object] isEqual:[self window]]) {
- [(id)[self document] windowWillClose:notification];
- if ([[pdfView document] isFinding])
- [[pdfView document] cancelFindString];
- if ((mwcFlags.isEditingTable || [pdfView isEditing]) && [self
commitEditing] == NO)
- [self discardEditing];
- [self cleanup]; // clean up everything
- }
+ [(id)[self document] windowWillClose:notification];
+
+ if ([[pdfView document] isFinding])
+ [[pdfView document] cancelFindString];
+
+ if ((mwcFlags.isEditingTable || [pdfView isEditing]) && [self
commitEditing] == NO)
+ [self discardEditing];
+
+ [self cleanup]; // clean up everything
}
- (void)windowDidChangeScreen:(NSNotification *)notification {
- if ([[notification object] isEqual:[self window]] && [self
interactionMode] == SKPresentationMode && ([[notification object] styleMask] &
NSWindowStyleMaskTitled) == 0) {
+ if ([self interactionMode] == SKPresentationMode && [[self window]
isEqual:savedNormalWindow] == NO) {
NSScreen *screen = [[self window] screen];
[[self window] setFrame:[screen frame] display:NO];
if (sideWindow) {
@@ -277,21 +273,16 @@
frame.origin.y = NSMidY(screenFrame) - floor(0.5 *
NSHeight(frame));
[sideWindow setFrame:frame display:YES];
}
- [pdfView layoutDocumentView];
- [pdfView setNeedsDisplay:YES];
}
}
- (void)windowDidMove:(NSNotification *)notification {
- if ([[notification object] isEqual:[self window]] && [self
interactionMode] == SKPresentationMode && ([[notification object] styleMask] &
NSWindowStyleMaskTitled) == 0) {
+ if ([self interactionMode] == SKPresentationMode && [[self window]
isEqual:savedNormalWindow] == NO) {
if ([[self window] styleMask] == NSWindowStyleMaskBorderless) {
NSScreen *screen = [[self window] screen];
NSRect screenFrame = [screen frame];
- if (NSEqualRects(screenFrame, [[self window] frame]) == NO) {
+ if (NSEqualRects(screenFrame, [[self window] frame]) == NO)
[[self window] setFrame:screenFrame display:NO];
- [pdfView layoutDocumentView];
- [pdfView setNeedsDisplay:YES];
- }
} else if (sideWindow) {
NSRect screenFrame = [[[self window] screen] frame];
NSRect frame = [sideWindow frame];
@@ -303,7 +294,7 @@
}
- (void)windowDidChangeBackingProperties:(NSNotification *)notification {
- if ([[notification object] isEqual:[self window]] && 0 != ([[notification
object] styleMask] & NSWindowStyleMaskTitled)) {
+ if ([self interactionMode] != SKPresentationMode) {
CGFloat oldScale = [[[notification userInfo]
objectForKey:@"NSBackingPropertyOldScaleFactorKey"] doubleValue];
if (fabs(oldScale - [[self window] backingScaleFactor]) > 0.0) {
[self allThumbnailsNeedUpdate];
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