Revision: 16638
http://sourceforge.net/p/skim-app/code/16638
Author: hofman
Date: 2026-10-09 09:24:22 +0000 (Fri, 09 Oct 2026)
Log Message:
-----------
Navigate to previous/next page on page-up/down in single/two page mode when the
page was not changed and no scrolling occurred on 27+, as PDFKit seems to fail
doing that. Check expected (but wrong) key direction first.
Modified Paths:
--------------
trunk/SKBasePDFView.m
Modified: trunk/SKBasePDFView.m
===================================================================
--- trunk/SKBasePDFView.m 2026-10-08 17:09:08 UTC (rev 16637)
+++ trunk/SKBasePDFView.m 2026-10-09 09:24:22 UTC (rev 16638)
@@ -476,7 +476,7 @@
}
- (void)keyDown:(NSEvent *)event {
- if ([self displayDirection]) {
+ if ([self displayDirection] || ([self displayMode] &
kPDFDisplaySinglePageContinuous) == 0) {
unichar ch = [event firstCharacter];
if (ch == NSPageDownFunctionKey || ch == NSDownArrowFunctionKey)
keyDirection = 1;
@@ -503,6 +503,12 @@
if ((displayMode & kPDFDisplaySinglePageContinuous) == 0) {
// Apple scrolls to the bottom of the next page rather than the top
pageIndex = [[self currentPage] pageIndex];
+ if (@available(macOS 27.0, *)) {
+ if ((keyDirection == 1 ? [self canGoToNextPage] : keyDirection ==
-1 ? [self canGoToPreviousPage] : NO)) {
+ clipView = [[self embeddedScrollView] contentView];
+ bounds = [clipView bounds];
+ }
+ }
} else if (displayMode == kPDFDisplayTwoUpContinuous || [self
displayDirection] == kPDFDisplayDirectionVertical) {
// Apple scrolls by too much, so correct for it
scrollView = [self embeddedScrollView];
@@ -537,17 +543,26 @@
} else if (pageIndex != NSNotFound) {
// check whether we jumped pages
NSUInteger currentPageIndex = [[self currentPage] pageIndex];
- if (currentPageIndex > pageIndex)
+ if (currentPageIndex > pageIndex) {
[self verticallyScrollToTop];
- else if (currentPageIndex < pageIndex)
+ } else if (currentPageIndex < pageIndex) {
[self verticallyScrollToBottom];
+ } else if (clipView && NSEqualPoints([clipView bounds].origin,
bounds.origin)) {
+ if (keyDirection == 1) {
+ [self goToNextPage:sender];
+ [self verticallyScrollToTop];
+ } else {
+ [self goToPreviousPage:sender];
+ [self verticallyScrollToBottom];
+ }
+ }
} else if (clipView && NSEqualPoints([clipView bounds].origin,
bounds.origin)) {
- if (keyDirection == -1) {
+ if (keyDirection == 1) {
+ [self goToNextPage:sender];
+ [self verticallyScrollToTop];
+ } else {
[self goToPreviousPage:sender];
[self verticallyScrollToBottom];
- } else {
- [self goToNextPage:sender];
- [self verticallyScrollToTop];
}
}
}
@@ -562,12 +577,18 @@
if ((displayMode & kPDFDisplaySinglePageContinuous) == 0) {
// Apple scrolls to the top of the next page rather than the bottom
pageIndex = [[self currentPage] pageIndex];
+ if (@available(macOS 27.0, *)) {
+ if ((keyDirection == -1 ? [self canGoToPreviousPage] :
keyDirection == 1 ? [self canGoToNextPage] : NO)) {
+ clipView = [[self embeddedScrollView] contentView];
+ bounds = [clipView bounds];
+ }
+ }
} else if (displayMode == kPDFDisplayTwoUpContinuous || [self
displayDirection] == kPDFDisplayDirectionVertical) {
// Apple scrolls by too much, so correct for it
scrollView = [self embeddedScrollView];
clipView = [scrollView contentView];
bounds = [clipView bounds];
- } else if ((keyDirection == 1 ? [self canGoToNextPage] : keyDirection ==
-1 ? [self canGoToPreviousPage] : NO)) {
+ } else if ((keyDirection == -1 ? [self canGoToPreviousPage] : keyDirection
== 1 ? [self canGoToNextPage] : NO)) {
// Apple does not navigate in horizontal mode
clipView = [[self embeddedScrollView] contentView];
bounds = [clipView bounds];
@@ -596,17 +617,26 @@
} else if (pageIndex != NSNotFound) {
// check whether we jumped pages
NSUInteger currentPageIndex = [[self currentPage] pageIndex];
- if (currentPageIndex < pageIndex)
+ if (currentPageIndex < pageIndex) {
[self verticallyScrollToBottom];
- else if (currentPageIndex > pageIndex)
+ } else if (currentPageIndex > pageIndex) {
[self verticallyScrollToTop];
+ } else if (clipView && NSEqualPoints([clipView bounds].origin,
bounds.origin)) {
+ if (keyDirection == -1) {
+ [self goToPreviousPage:sender];
+ [self verticallyScrollToBottom];
+ } else {
+ [self goToNextPage:sender];
+ [self verticallyScrollToTop];
+ }
+ }
} else if (clipView && NSEqualPoints([clipView bounds].origin,
bounds.origin)) {
- if (keyDirection == 1) {
+ if (keyDirection == -1) {
+ [self goToPreviousPage:sender];
+ [self verticallyScrollToBottom];
+ } else {
[self goToNextPage:sender];
[self verticallyScrollToTop];
- } else {
- [self goToPreviousPage:sender];
- [self verticallyScrollToBottom];
}
}
}
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