Revision: 16128
          http://sourceforge.net/p/skim-app/code/16128
Author:   hofman
Date:     2026-03-29 16:08:26 +0000 (Sun, 29 Mar 2026)
Log Message:
-----------
Don't remove pdfview (or presentationview) when showing overview, hide instead. 
When the scrollview is removed and readded, auto-reveal in fullscreen does not 
work.

Modified Paths:
--------------
    trunk/SKMainWindowController.m
    trunk/SKMainWindowController_Actions.m
    trunk/SKPresentationView.m

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2026-03-28 22:49:10 UTC (rev 16127)
+++ trunk/SKMainWindowController.m      2026-03-29 16:08:26 UTC (rev 16128)
@@ -1672,12 +1672,11 @@
     BOOL isPresentation = [self interactionMode] == SKPresentationMode;
     NSView *oldView = isPresentation ? presentationView : [splitViewController 
view];
     NSView *contentView = [oldView superview];
-    BOOL hasStatus = isPresentation == NO && [statusBar isVisible];
     NSArray *constraints = @[
-        [[overviewContentView leadingAnchor] 
constraintEqualToAnchor:[contentView leadingAnchor]],
-        [[contentView trailingAnchor] 
constraintEqualToAnchor:[overviewContentView trailingAnchor]],
-        [[overviewContentView topAnchor] 
constraintEqualToAnchor:[(mwcFlags.fullSizeContent || isPresentation ? 
contentView : [[self window] contentLayoutGuide]) topAnchor]],
-        [(hasStatus ? [statusBar topAnchor] : [contentView bottomAnchor]) 
constraintEqualToAnchor:[overviewContentView bottomAnchor]]];
+        [[overviewContentView leadingAnchor] constraintEqualToAnchor:[oldView 
leadingAnchor]],
+        [[oldView trailingAnchor] constraintEqualToAnchor:[overviewContentView 
trailingAnchor]],
+        [[overviewContentView topAnchor] constraintEqualToAnchor:[oldView 
topAnchor]],
+        [[oldView bottomAnchor] constraintEqualToAnchor:[overviewContentView 
bottomAnchor]]];
     
     [overviewContentView setFrame:[oldView frame]];
     [overviewView scrollRectToVisible:[overviewView 
frameForItemAtIndex:[[pdfView currentPage] pageIndex]]];
@@ -1707,7 +1706,8 @@
     
     if (animate) {
         [NSAnimationContext runAnimationGroup:^(NSAnimationContext * context){
-                [[contentView animator] replaceSubview:oldView 
with:overviewContentView];
+                [[contentView animator] addSubview:overviewContentView];
+                [[oldView animator] setHidden:YES];
                 [NSLayoutConstraint activateConstraints:constraints];
             }
             completionHandler:^{
@@ -1717,7 +1717,8 @@
             }];
     } else {
         [overviewView scrollRectToVisible:[overviewView 
frameForItemAtIndex:[[pdfView currentPage] pageIndex]]];
-        [contentView replaceSubview:oldView with:overviewContentView];
+        [contentView addSubview:overviewContentView];
+        [oldView setHidden:YES];
         [NSLayoutConstraint activateConstraints:constraints];
     }
     [[self window] makeFirstResponder:overviewView];
@@ -1741,18 +1742,11 @@
     BOOL isPresentation = 0 == ([[overviewContentView window] styleMask] & 
NSWindowStyleMaskTitled);
     NSView *newView = isPresentation ? presentationView : [splitViewController 
view];
     NSView *newKeyView = isPresentation ? presentationView : pdfView;
-    NSView *contentView = [overviewContentView superview];
-    BOOL hasStatus = isPresentation == NO && [statusBar isVisible];
-    NSArray *constraints = @[
-        [[newView leadingAnchor] constraintEqualToAnchor:[contentView 
leadingAnchor]],
-        [[contentView trailingAnchor] constraintEqualToAnchor:[newView 
trailingAnchor]],
-        [[newView topAnchor] 
constraintEqualToAnchor:[(mwcFlags.fullSizeContent || isPresentation ? 
contentView : [[contentView window] contentLayoutGuide]) topAnchor]],
-        [(hasStatus ? [statusBar topAnchor] : [contentView bottomAnchor]) 
constraintEqualToAnchor:[newView bottomAnchor]]];
     
     if (animate) {
         [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
-                [[contentView animator] replaceSubview:overviewContentView 
with:newView];
-                [NSLayoutConstraint activateConstraints:constraints];
+                [[overviewContentView animator] removeFromSuperview];
+                [[newView animator] setHidden:NO];
             }
             completionHandler:^{
                 [[self window] recalculateKeyViewLoop];
@@ -1763,8 +1757,8 @@
                     handler();
             }];
     } else {
-        [contentView replaceSubview:overviewContentView with:newView];
-        [NSLayoutConstraint activateConstraints:constraints];
+        [overviewContentView removeFromSuperview];
+        [newView setHidden:NO];
         [touchBarController overviewChanged];
         [noteToolbarController validateButtons];
         [[newKeyView window] makeFirstResponder:newKeyView];

Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m      2026-03-28 22:49:10 UTC (rev 
16127)
+++ trunk/SKMainWindowController_Actions.m      2026-03-29 16:08:26 UTC (rev 
16128)
@@ -781,8 +781,7 @@
 
 - (IBAction)toggleStatusBar:(id)sender {
     [[NSUserDefaults standardUserDefaults] setBool:(NO == [statusBar 
isVisible]) forKey:SKShowStatusBarKey];
-    NSView *view = [self hasOverview] ? overviewContentView : 
[splitViewController view];
-    [statusBar toggleBelowView:view animate:sender != nil];
+    [statusBar toggleBelowView:[splitViewController view] animate:sender != 
nil];
 }
 
 - (void)selectSearchFieldForSideViewController:(SKSideViewController 
*)sideViewController {

Modified: trunk/SKPresentationView.m
===================================================================
--- trunk/SKPresentationView.m  2026-03-28 22:49:10 UTC (rev 16127)
+++ trunk/SKPresentationView.m  2026-03-29 16:08:26 UTC (rev 16128)
@@ -1196,18 +1196,40 @@
 }
 
 - (void)handleWindowDidResignKeyNotification:(NSNotification *)notification {
-    [self cancelDelayedRequests];
-    pvFlags.cursorHidden = NO;
-    [[NSCursor arrowCursor] set];
+    if ([self isHidden] == NO) {
+        [self cancelDelayedRequests];
+        pvFlags.cursorHidden = NO;
+        [[NSCursor arrowCursor] set];
+    }
 }
 
 - (void)handleWindowDidBecomeKeyNotification:(NSNotification *)notification {
-    if (pvFlags.cursorHidden == NO) {
+    if (pvFlags.cursorHidden == NO && [self isHidden] == NO) {
         [self performSelectorOnce:@selector(setCursorForMouse:) 
afterDelay:0.0];
         [self performSelectorOnce:@selector(autoHide) 
afterDelay:AUTO_HIDE_DELAY];
     }
 }
 
+- (void)resetAutoHide {
+    if ([pageLayer opacity] < 1.0) {
+        [CATransaction begin];
+        [CATransaction setDisableActions:YES];
+        [pageLayer setOpacity:1.0];
+        [CATransaction commit];
+    }
+    pvFlags.cursorHidden = NO;
+    [NSCursor setHiddenUntilMouseMoves:NO];
+    [[NSCursor arrowCursor] set];
+    if (navWindow) {
+        [navWindow remove];
+        navWindow = nil;
+    }
+    if (cursorWindow) {
+        [cursorWindow remove];
+        cursorWindow = nil;
+    }
+}
+
 - (void)viewWillMoveToWindow:(NSWindow *)newWindow {
     [self cancelDelayedRequests];
     
@@ -1221,23 +1243,7 @@
         [nc addObserver:self 
selector:@selector(handleWindowDidBecomeKeyNotification:) 
name:NSWindowDidBecomeKeyNotification object:newWindow];
         [nc addObserver:self 
selector:@selector(handleWindowDidResignKeyNotification:) 
name:NSWindowDidResignKeyNotification object:newWindow];
     } else {
-        if ([pageLayer opacity] < 1.0) {
-            [CATransaction begin];
-            [CATransaction setDisableActions:YES];
-            [pageLayer setOpacity:1.0];
-            [CATransaction commit];
-        }
-        pvFlags.cursorHidden = NO;
-        [NSCursor setHiddenUntilMouseMoves:NO];
-        [[NSCursor arrowCursor] set];
-        if (navWindow) {
-            [navWindow remove];
-            navWindow = nil;
-        }
-        if (cursorWindow) {
-            [cursorWindow remove];
-            cursorWindow = nil;
-        }
+        [self resetAutoHide];
     }
     
     [super viewWillMoveToWindow:newWindow];
@@ -1250,4 +1256,14 @@
     [super viewDidMoveToWindow];
 }
 
+- (void)setHidden:(BOOL)hidden {
+    BOOL wasHidden = [self isHidden];
+    [self cancelDelayedRequests];
+    if (hidden && wasHidden == NO)
+        [self resetAutoHide];
+    [super setHidden:hidden];
+    if (hidden == NO && wasHidden && [[self window] isKeyWindow])
+        [self handleWindowDidBecomeKeyNotification:nil];
+}
+
 @end

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