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 778738 - Convert single keystroke commands to use action signals
Convert single keystroke commands to use action signals
Status: RESOLVED FIXED
Product: geary
Classification: Other
Component: client
master
Other Linux
: Normal normal
: 0.14.0
Assigned To: Geary Maintainers
Geary Maintainers
Depends on:
Blocks: 730495 778740 785187
 
 
Reported: 2017-02-16 06:10 UTC by Michael Gratton
Modified: 2019-11-20 16:15 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Michael Gratton 2017-02-16 06:10:02 UTC
Switching to action signals[0] shortcuts for single keystroke commands (SKCs) will enable us to remove a gross hack, and support improving SKC for a dedicated "GMail-mode" and also allow people to customise SKC's themselves in GTK CSS in the future.

The default GtkWindow key press event handler by default basically does the following for each event:

1. Call gtk_window_activate_key
2. If not handled, call gtk_window_propagate_key_event
3. Finally, if not handled then call gtk_bindings_activate_event

To support the current implementation of single keystroke commands that uses the keyboard shortcuts mechanism, but to prevent it interfering with embedded composers and to avoid some issues with how WebKit handles events, we need to override the default implementation to reverse the order in which (1) and (2) are called — see MainWindow::key_press_event. This also causes some other odd behaviour however, such as Bug 730495.

If we switch to using the action signal mechanism, then the issue goes away, since the SKCs will only be processed at step (3) above, and we can remove the hack in MainWindow::key_press_event.

This means adding a signal annotated "[Signal (action=true)]" for each possible SKC to the appropriate widget (MainWindow? ConversationViewer?), using Gtk.BindingEntry.add_signal on the widget's BindingSet to add the SKCs, then removing the MainWindow hack above and the old machinery used to hook up SKCs.

[0] - See "Signal Actions": https://blogs.gnome.org/chergert/2016/11/14/accelerators-a-history-lesson/ and gtk_binding_entry_add_signal()
Comment 1 Michael Gratton 2018-06-26 04:47:41 UTC
Bump tickets to 0.14 that aren't going to make 0.13.
Comment 2 Michael Gratton 2019-11-20 16:15:34 UTC
Landing over in https://gitlab.gnome.org/GNOME/geary/merge_requests/373