On Aug 16, 2014, at 19:29, James Widman wrote:
> Hi all,
>
> Issue: in OS X 10.10 (14A314h), NSKeyDown events for the pagedown key and
> the space bar result in a call to goToPreviousPage, and pageup/shift-space
> result in a call to goToNextPage.
>
> I wrote a patch for this (below) but:
>
> - I’m a newbie with Skim’s source code (and Objective-C in general);
> - I’m not sure where keyboard bindings are normally supposed to happen; and
> - I’m not sure whether this is a bug in Yosemite (though Preview.app seems
> well behaved).
>
> Criticism welcome!
>
> —James
>
> Index: SKPDFView.m
> ===================================================================
> --- SKPDFView.m (revision 8385)
> +++ SKPDFView.m (working copy)
> @@ -1045,11 +1045,18 @@
> }
> } else {
> // Normal or fullscreen mode
> - BOOL isLeftRightArrow = eventChar == NSRightArrowFunctionKey ||
> eventChar == NSLeftArrowFunctionKey;
> - BOOL isUpDownArrow = eventChar == NSUpArrowFunctionKey || eventChar
> == NSDownArrowFunctionKey;
> - BOOL isArrow = isLeftRightArrow || isUpDownArrow;
> -
> - if ((eventChar == NSDeleteCharacter || eventChar ==
> NSDeleteFunctionKey) &&
> + BOOL const isLeftRightArrow = eventChar == NSRightArrowFunctionKey
> || eventChar == NSLeftArrowFunctionKey;
> + BOOL const isUpDownArrow = eventChar == NSUpArrowFunctionKey ||
> eventChar == NSDownArrowFunctionKey;
> + BOOL const isArrow = isLeftRightArrow || isUpDownArrow;
> + BOOL const haveShiftKey = !!(modifiers & NSShiftKeyMask);
> + BOOL const isPageDown = eventChar == NSPageDownFunctionKey ||
> eventChar == ' ' && !haveShiftKey;
> + BOOL const isPageUp = eventChar == NSPageUpFunctionKey ||
> eventChar == ' ' && haveShiftKey;
> +
> + if (isPageDown) {
> + [self goToNextPage:self];
> + } else if (isPageUp) {
> + [self goToPreviousPage:self];
> + } else if ((eventChar == NSDeleteCharacter || eventChar ==
> NSDeleteFunctionKey) &&
> (modifiers == 0)) {
> [self delete:self];
> } else if (([self toolMode] == SKTextToolMode || [self toolMode] ==
> SKNoteToolMode) && activeAnnotation && editor == nil &&
>
BTW, PDFView calls -scrollPageDown: and - scrollPageUp:, not -goToNextPage: and
goToPreviousPage:. This does the right thing for any PDF display mode.
I wonder if you'd use these it would reproduce the problem. If that's the case
then we'd know that the bug is in the implementation of those methods. If the
bug really is in the system (which I still find inexplicable given that it's
not in Preview), my best guess is that they changed the vertical orientation of
some view, but forgot to take account of that in some methods.
Anyway, if you really see this, you should report this bug to Apple. We should
not have to workaround this.
Christiaan
------------------------------------------------------------------------------
_______________________________________________
skim-app-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-develop