GNOME Bugzilla – Bug 399057
Implement GtkBindings
Last modified: 2015-12-26 12:46:24 UTC
Instead of hardcoding the key->event mapping in vte_terminal_key_press() the preferred method is to use GtkBinding, which allows the configuration of hotkeys.
There's even the start of a patch in bug 172766.
Got patch? ;)
*** Bug 172766 has been marked as a duplicate of this bug. ***
Ping? More grumbles on the OpenSolaris forums at the moment about not being able to use PgUp and PgDn without Shift :) (Which is what the original patch in #172766 was for...)
Bug 172766 has a patch that can serve as a starting point. Just needs someone interested in this take this and finish it.
Ehem, ping? :)
Created attachment 124042 [details] [review] better patch This patch is based on the earlier patch in the original bug report. I updated it so that it applies against the latest version of VTE. I also made a few changes to the patch: - Now I define a VteKeyType enumeration rather than using the GTK_SCROLL enumerations. Since VTE supports key sequences that a superset of scrolling, it seems better for VTE to use its own enumeration. - I changed the vte_scroll_page function to vte_key_sequence, scroll_page_signal to key_sequence_signal, the signal name to "key-sequence" instead of "scroll-page", etc. Again because the VTE key sequences are not just for scrolling. - The new patch supports the 1-line up/down keybindings and the Add/Subtract keybindings in addition to the home/end/pg-up/pg-down keybindings that the old patch supported. - I am still not supporting Backspace/Delete/Insert keys via bindings, simply because it isn't really clear to me how to make this work. Especially for the Backspace/Delete keys which currently set the "normal" variable which gets used later in the vte_terminal_key_press function. I'm not sure if these keys really need to be supported by keybindings. So perhaps someone could advise about this? This patch seems to work in my testing with the default keys. However, I'm not sure how to actually configure these keys to use a different key. How do I actually configure my system to use a different key if desired? For example, if I want to use just "Home" instead of "Shift-Home"? Thanks.
Keybindings can be customised from a gtkrc file; cf. the "Resource files" section in gtk's API docs. Few initial comments: +#define VTE_KEY_TYPE (vte_key_type ()) +GType vte_key_type (void); This should be unnecessary since the type-builtins code will do that. (And this should be vte_key_get_type() to stay with the std. naming.) + void (*key_sequence)(VteTerminal* terminal, VteKeyType type); + /* Padding for future expansion. */ void (*vte_reserved3)(void); Needs to remove one padding slot. Or make this not have a slot in the class at all, and then one wouldn't even need the public enum above. + guint key_sequence_signal; Unused, so can be removed.
Created attachment 127727 [details] [review] [PATCH] Bug 399057 – Implement GtkBindings src/marshal.list | 1 + src/vte.c | 151 ++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 96 insertions(+), 56 deletions(-)
Can this go upstream?
ChPe, is this ready to be committed, or needs some updating?
I'm not sure it's safe to do this. The patch makes changes to what the vte_terminal_key_press() event handler function does with these keycodes. Bindings are handled in the GTK_WIDGET_CLASS(vte_terminal_parent_class))->key_press_event() call, while currently these keycodes are handled after much further preprocessing only. Is it really ok to skip all of that?
Don't know.
Not going to happen; in fact I removed the already existing bindings. The problem is that they make it very hard to do the disabling/reassigning in gnome-terminal's UI, and they don't add much anyway.