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 737774 - Make the map pannable using the keyboard
Make the map pannable using the keyboard
Status: RESOLVED FIXED
Product: gnome-maps
Classification: Applications
Component: map view
3.14.x
Other Linux
: Normal enhancement
: ---
Assigned To: gnome-maps-maint
gnome-maps-maint
: 759382 (view as bug list)
Depends on: 738849
Blocks:
 
 
Reported: 2014-10-02 09:42 UTC by Marcus Lundblad
Modified: 2015-12-12 15:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Map pannable using libchamplain methods (1.93 KB, patch)
2014-10-19 09:57 UTC, amisha
rejected Details | Review
mainWindow: Remove can_focus flag from Overlay (2.23 KB, patch)
2014-10-20 09:22 UTC, Jonas Danielsson
committed Details | Review

Description Marcus Lundblad 2014-10-02 09:42:11 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.
Comment 1 Jonas Danielsson 2014-10-02 11:47:42 UTC
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?
Comment 2 Damián Nohales 2014-10-02 19:35:01 UTC
(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.
Comment 3 Jiri Techet 2014-10-15 18:49:21 UTC
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.
Comment 4 Jiri Techet 2014-10-18 18:48:12 UTC
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.
Comment 5 Damián Nohales 2014-10-18 18:53:23 UTC
(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.
Comment 6 amisha 2014-10-19 09:57:19 UTC
Created attachment 288834 [details] [review]
Map pannable using libchamplain methods
Comment 7 Jonas Danielsson 2014-10-20 09:22:20 UTC
I think we should be able to use the bindings already in libchamplain.
Comment 8 Jonas Danielsson 2014-10-20 09:22:57 UTC
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.
Comment 9 Jonas Danielsson 2014-10-20 09:23:37 UTC
With the patch in Depends applied on libchamplain, and the patch above applied in Maps, panning works for me.
Comment 10 Jonas Danielsson 2014-10-20 10:58:52 UTC
(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.
Comment 11 Zeeshan Ali 2014-10-20 14:11:53 UTC
(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'?
Comment 12 Jonas Danielsson 2014-10-20 14:14:57 UTC
(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.
Comment 13 Jonas Danielsson 2015-12-12 15:25:02 UTC
*** Bug 759382 has been marked as a duplicate of this bug. ***