After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 727529 - Rotation via shortcut may not work if zoomed in.
Rotation via shortcut may not work if zoomed in.
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
3.12.x
Other Linux
: Normal minor
: ---
Assigned To: Evince Maintainers
Evince Maintainers
: 783221 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-04-03 09:32 UTC by Jakob Runge
Modified: 2018-03-02 00:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
shell: Unbind Ctrl-Left and Ctrl-Right from the scrolledwindow (1.10 KB, patch)
2018-02-27 17:03 UTC, José Aliste
committed Details | Review

Description Jakob Runge 2014-04-03 09:32:03 UTC
Evince allows to rotate a pdf by using ctrl+{left,right} keys
instead of using the menu to do so.
However, if for any reason the evince window has a horizontal scroll bar,
say if I zoom in or the window gets smaller,
rotation cannot be done using the keyboard shortcuts any more.
Instead the arrow keys only move the content around.

The expected behavior would be that the horizontal scroll-bar is
only used when I use the arrow keys alone, but not when I use ctrl+{left,right}.
This way rotation could still work while the arrow keys without ctrl work for
the scroll-bars just as everywhere else.
Comment 1 Pietro Battiston 2014-05-09 09:12:09 UTC
I can confirm in 3.12, and I think it is a regression (I don't recall meeting this behaviour in the past).

In fact, as far as I understand the code (which is not much!), it was never the intention of programmers to have ctrl+{left,right,up,down} keys cause scrolling. Indeed, "scroll" and "move" keybindings are set with no modifier in libview/ev-view.c:

add_scroll_binding_keypad (binding_set, GDK_KEY_Left,  0, GTK_SCROLL_STEP_BACKWARD, GTK_ORIENTATION_HORIZONTAL);

Wild guess: maybe somewhere that modifier is checked with an "&" instead than an "=="?
Comment 2 ftack 2014-07-12 07:16:49 UTC
I confirm for Evince 3.10.3 included with Ubuntu 14.04.
Severity is set to trivial, perhaps rightly so, but these are the little details that annoy and disrupt work flow.
Comment 3 satchitb 2014-07-30 11:27:36 UTC
I can confirm this for Evince 3.10.3 included with Ubuntu 14.04. It's highly irritating.
Comment 4 André Klapper 2014-07-30 11:42:34 UTC
As written in comment 1 this happens in 3.12, so the older 3.10 is pretty uninteresting at this point :)
Comment 5 Sebastien Bacher 2015-02-18 10:26:45 UTC
That's still an issue in the current version, reported as well on https://bugs.launchpad.net/evince/+bug/1423077
Comment 6 Pietro Battiston 2015-06-30 13:19:47 UTC
I just updated to 3.14.2 and Ctrl+Left/Right stopped rotating the document even when no horizontal bar is present! In that case it just doesn't have any effect.
Comment 7 Jeroen Hoek 2016-01-10 11:06:21 UTC
Ran into this bug in 3.16.1. The rotate command in the menu work, but the shortcuts either scroll or do nothing. Very confusing.

Oddly enough, contrary to some reports here, I remember using this feature in fairly recent versions (certainly after 3.10.3). Is some environmental factor causing mischief here?
Comment 8 Pietro Battiston 2016-01-10 11:09:27 UTC
Jeroen, you remember using Ctrl+Right after 3.10.3 _while sufficiently zoomed out_? It never stopped working as long as the document fits horizontally in the current view.
Comment 9 Jeroen Hoek 2016-01-10 11:15:26 UTC
Yes, I suspect that may have been without a horizontal scrollbar. Although in 3.16.1, rotating does not work at all with the keyboard short-cuts, regardless of the PDF viewed and whether or not horizontal scrolling is possible.
Comment 10 H Johnson 2017-12-07 16:47:38 UTC
SUGGESTED TEMPORARY FIX:  For now, and until this issue is better fixed, and as a temporary stop gap, please add this text to the `Keyboard Shortcuts` screen, (page 2) under 'Rotating and Zooming':

  "To rotate you may have to first zoom out." 


Otherwise it is very upsetting when you rotate, but then are stuck and can't rotate back.
Comment 11 José Aliste 2017-12-09 14:22:51 UTC
Hey, I just looked at this (sorry I didn't before) but actually there are two evince features that are competing for the ctrl+left and ctrl+right shorcuts... Caret navigation and Rotate page. Even if caret navigation is not so well used, the standard shorcut all across gnome apps to jump to the next or previous word is Ctrl+left and ctrl + right, so I think we should plainly change the shorcuts for Rotate.
Comment 12 Pietro Battiston 2017-12-10 00:38:02 UTC
Thanks for looking into this José.

Not sure about which is the best shortcut for rotating (I thought Ctrl+Left/Right, but I had no idea about caret navigation), but am I right that Ctrl+Left should, in any case, _never_ scroll, and that the fact it does is a bug?
Comment 13 José Aliste 2018-02-27 17:03:04 UTC
Created attachment 369046 [details] [review]
shell: Unbind Ctrl-Left and Ctrl-Right from the scrolledwindow

The GtkScrolledWindow binds Ctrl-Left and Ctrl-Right. Since we are
using these as shortcuts for Rotate left and right, and the evince
window sends the keypress event to widgets before processing Application
shortcuts, we need to unbind these to avoid conflict between the two.

https://bugzilla.gnome.org/show_bug.cgi?id=783221
Comment 14 José Aliste 2018-02-27 17:09:14 UTC
So, it turns out that I introduced this bug while ago when fixing #676040. The rationale is that we forward the keypress event to the focused widget BEFORE processing Application shortcuts, so that it can react to it (and hence if you have a focused entry Ctrl+left should jump to the previous word) 

The thing is that the GtkScrolledWindow actually binds Ctrl-Left and Ctrl-Right but these actions are only enabled when the horizontal scrollbar is shown. Unbinding these actions through CSS does the trick of Ctrl+left and Ctrl+right rotating if there is no entry focused. If the caret navigation is enabled, then Ctrl-left and ctrl-right will move between words, which I think for now is what we expect. 

Maybe it still makes sense to change the Bindings for the Rotate left and Right actions, but since we are in UI freeze, these can be in a new bug if someone think it is worthy (I am fine with the behavior after this patch).
Comment 15 José Aliste 2018-02-27 17:09:57 UTC
*** Bug 783221 has been marked as a duplicate of this bug. ***
Comment 16 Carlos Garcia Campos 2018-02-27 18:00:00 UTC
Comment on attachment 369046 [details] [review]
shell: Unbind Ctrl-Left and Ctrl-Right from the scrolledwindow

Ok.
Comment 17 Germán Poo-Caamaño 2018-02-27 18:10:47 UTC
(In reply to José Aliste from comment #14)
> So, it turns out that I introduced this bug while ago when fixing #676040.
> The rationale is that we forward the keypress event to the focused widget
> BEFORE processing Application shortcuts, so that it can react to it (and
> hence if you have a focused entry Ctrl+left should jump to the previous
> word) 
> 
> The thing is that the GtkScrolledWindow actually binds Ctrl-Left and
> Ctrl-Right but these actions are only enabled when the horizontal scrollbar
> is shown. Unbinding these actions through CSS does the trick of Ctrl+left
> and Ctrl+right rotating if there is no entry focused. If the caret
> navigation is enabled, then Ctrl-left and ctrl-right will move between
> words, which I think for now is what we expect. 
> 
> Maybe it still makes sense to change the Bindings for the Rotate left and
> Right actions, but since we are in UI freeze, these can be in a new bug if
> someone think it is worthy (I am fine with the behavior after this patch).

I think you should add this text to the commit message.
Comment 18 José Aliste 2018-02-27 19:34:02 UTC
Which text german? the second paragraph is already there and explains the rationale, or what part do you think is missing?
Comment 19 Germán Poo-Caamaño 2018-02-28 16:07:30 UTC
Add the following one (or rephrased version):

"it turns out that I introduced this bug while ago when fixing #676040. The rationale is that we forward the keypress event to the focused widget BEFORE processing Application shortcuts, so that it can react to it (and hence if you have a focused entry Ctrl+left should jump to the previous word)"

To acknowledge there was another bug and commit, and what was its purpose.
In case someone were bitten by something related, to not undo one to redo the
other one which has a secondary effect.

Does this make sense?
Comment 20 José Aliste 2018-02-28 16:53:49 UTC
(In reply to Germán Poo-Caamaño from comment #19)
> Add the following one (or rephrased version):
> 
> "it turns out that I introduced this bug while ago when fixing #676040. The
> rationale is that we forward the keypress event to the focused widget BEFORE
> processing Application shortcuts, so that it can react to it (and hence if
> you have a focused entry Ctrl+left should jump to the previous word)"
> 
> To acknowledge there was another bug and commit, and what was its purpose.
> In case someone were bitten by something related, to not undo one to redo the
> other one which has a secondary effect.
> 
> Does this make sense?

Sure, thanks
Comment 21 José Aliste 2018-03-02 00:43:05 UTC
Review of attachment 369046 [details] [review]:

thanks
Comment 22 José Aliste 2018-03-02 00:43:34 UTC
This problem has been fixed in the unstable development version. The fix will be available in the next major software release. You may need to upgrade your Linux distribution to obtain that newer version.