GNOME Bugzilla – Bug 737774
Make the map pannable using the keyboard
Last modified: 2015-12-12 15:25:02 UTC
It would be nice if it was possible to pan the map using i.e. the arrow keys as an alternative to mouse/touch.
There seem to be support for this in libchamplain (where our map widget comes from) but it seems key-press is not propagatet there. Might be a limitation in clutter-gtk?
(In reply to comment #1) > There seem to be support for this in libchamplain (where our map widget comes > from) but it seems key-press is not propagatet there. Might be a limitation in > clutter-gtk? I was about to say that, also, libchamplain implements <Primary>+Up/<Primary>+Down for zooming and we are reimplementing that manually.
Yes, there's some default handling of keypresses which however only works when using plain clutter - otherwise the event gets eaten by GTK somewhere above. I don't know if there's a way in GTK to force propagating some keypress events to particular widgets (but I don't know GTK well enough). However, it's quite simple to register your main window's "key_press_event" and handle the keypresses by yourself by calling the corresponding libchamplain methods. You can have a look at champlain_view_scroll() and how it's called in kinetic_scroll_key_press_cb() within champlain-view.c and implement something similar by yourself in the key press event handler. If there's some interest, I might make the champlain_view_scroll() method or something similar part of the API even though it's quite trivial to implement.
Just a note - I've made a simple demo how to implement custom keyboard actions. It's now available in libchamplain's git repository under demos/keyboard-mapping.py. Is it OK if I close this bug? I believe it's a matter of GTK event processing rather than something that can/should be done in libchamplain.
(In reply to comment #4) > Just a note - I've made a simple demo how to implement custom keyboard actions. > It's now available in libchamplain's git repository under > demos/keyboard-mapping.py. > > Is it OK if I close this bug? I believe it's a matter of GTK event processing > rather than something that can/should be done in libchamplain. Actually, the bug is pointing to gnome-maps, I CC'ed you so you can give us your opinion. Let's close it when we fix it. Thanks for the feedback.
Created attachment 288834 [details] [review] Map pannable using libchamplain methods
I think we should be able to use the bindings already in libchamplain.
Created attachment 288903 [details] [review] mainWindow: Remove can_focus flag from Overlay Instead allow the GtkChamplainEmbed MapView to have focus. This is needed to propagate events to the ChamplainView.
With the patch in Depends applied on libchamplain, and the patch above applied in Maps, panning works for me.
(In reply to comment #2) > (In reply to comment #1) > > There seem to be support for this in libchamplain (where our map widget comes > > from) but it seems key-press is not propagatet there. Might be a limitation in > > clutter-gtk? > > I was about to say that, also, libchamplain implements > <Primary>+Up/<Primary>+Down for zooming and we are reimplementing that > manually. For zoom-in/zoom-out I am fine with having our own accelerators. 1) <Primary>-/<Primary>+ feels nicer that up and down 2) We might want to be able to zoom with keyboard even when the map does not have focus.
(In reply to comment #4) > Just a note - I've made a simple demo how to implement custom keyboard actions. > It's now available in libchamplain's git repository under > demos/keyboard-mapping.py. > > Is it OK if I close this bug? I believe it's a matter of GTK event processing > rather than something that can/should be done in libchamplain. If that is the case, isn't it still a libchamplain-gtk issue rather than Maps'?
(In reply to comment #11) > (In reply to comment #4) > > Just a note - I've made a simple demo how to implement custom keyboard actions. > > It's now available in libchamplain's git repository under > > demos/keyboard-mapping.py. > > > > Is it OK if I close this bug? I believe it's a matter of GTK event processing > > rather than something that can/should be done in libchamplain. > > If that is the case, isn't it still a libchamplain-gtk issue rather than Maps'? Well, I've added a patch to libchamplain, see Depends. And the patch currently in this bug is needed as well. To make sure the ChamplainView receives focus. So it's a bit of both according to me.
*** Bug 759382 has been marked as a duplicate of this bug. ***