Commit Graph

34372 Commits

Author SHA1 Message Date
Benjamin Otte
ef40f22632 shortcuttrigger: Add support for mnemonics
Mnemonics need to be triggered with help from the controllers (who
determine the modifiers). Support for that has been added, too.

Mnemonics do not use this yet though.
2020-03-18 23:00:50 -04:00
Benjamin Otte
bea2dcef8f window: Put F10 accelerator into its own shortcut controller
So instead of relying on gtk_window_activate_key(), it's now using
proper infrastructure.
2020-03-18 23:00:50 -04:00
Benjamin Otte
cc13b47542 window: Get rid of public APIs that shouldn't be
Event controllers should have replaced all of them.
And if they haven't, apps need to fix their code (I'm
looking at you Gimp).
2020-03-18 23:00:50 -04:00
Benjamin Otte
8c23ccd86e gdk: Remove GDK_RELEASE_MASK
It was only ever supported by keybindings and those are gone now.
2020-03-18 23:00:50 -04:00
Benjamin Otte
d4127fe0d4 shortcutcontroller: Add GtkShortcutScope
Allow setting the scope for a controller. The scope determines at what
point in event propagation the shortcuts will be activated.

Local scope is the usual activation, global scope means that the root
widget activates the shortcuts - ie they are activated at the very
start of event propagation (for global capture events) or the very end
(for global bubble events).
Managed scope so far is unimplemented.

This is supposed to be used to replace accelerators and mnemonics.
2020-03-18 23:00:50 -04:00
Benjamin Otte
22801f0d4d shortcuttrigger: Add gtk_shortcut_trigger_to_label()
Provide a user-presentable string.
2020-03-18 23:00:50 -04:00
Benjamin Otte
e050288d07 accelgroup: Add gtk_accel_group_print_label() 2020-03-18 23:00:50 -04:00
Benjamin Otte
93af53a2fc accellabel: Move gtk_accelerator_get_label() code
The function lives in gtkaccelgroup.c, so there's no need to have that
call a private function in another source file. Instead, make that
other source file call gtk_accelerator_get_label() instead.
2020-03-18 23:00:50 -04:00
Benjamin Otte
e2a0ed4fcb accellabel: Get rid of class variables
We can just look them up as-needed, no need to cache them.
2020-03-18 23:00:50 -04:00
Benjamin Otte
fb99f834e6 gtk: Remove bindings
The whole binding functionality is now handled by shortcuts.
2020-03-18 23:00:50 -04:00
Matthias Clasen
a062b96051 event controller focus: drop include
This header is not needed here, and it is going away.
2020-03-18 23:00:50 -04:00
Emmanuele Bassi
5033fc62f2 Remove bindings activation from GtkEventControllerKey
We're going to use shortcuts soon.
2020-03-18 23:00:50 -04:00
Emmanuele Bassi
bdde072c06 popover: Remove unused include 2020-03-18 23:00:50 -04:00
Matthias Clasen
f7a4d968e9 popover: Add keynav keybindings
The shortcut controllers are limited to same-native,
so we need to duplicate the Tab and arrow key bindings
for focus handling, as well as the Enter bindings for
activation.
2020-03-18 23:00:50 -04:00
Emmanuele Bassi
252030ba59 popovermenu: Port to shortcuts 2020-03-18 23:00:50 -04:00
Emmanuele Bassi
f24cf29326 passwordentry: Remove unused include 2020-03-18 23:00:50 -04:00
Emmanuele Bassi
9b1d593967 entry: Remove unused include 2020-03-18 23:00:50 -04:00
Benjamin Otte
4e3ac8f52b accelgroup: Actually have a default mod mask
Don't just use a value without initializing it.
2020-03-18 23:00:50 -04:00
Benjamin Otte
7f10641fd9 treeview: Redo event forwarding hack
Reorder the event controllers so that key forwarding to the search
entries really happens after shortcut triggering.
2020-03-18 23:00:50 -04:00
Benjamin Otte
3ef6be0d25 combobox: Redo key event forwarding hack
Instead of manualling invoking bindings, we now reorder event
controllers inside the treemenu, so that shortcuts run before the event
forwarding.
2020-03-18 23:00:50 -04:00
Emmanuele Bassi
56595e7529 widget: Add private accessor to event controllers 2020-03-18 23:00:50 -04:00
Benjamin Otte
4b798e238f iconview: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Benjamin Otte
718faf68ac infobar: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Benjamin Otte
83dc9dabed label: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Benjamin Otte
051f7e4118 listbox: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Benjamin Otte
cbeb096bb3 notebook: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Benjamin Otte
bf7c51cc11 scale: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Benjamin Otte
3803209330 scalebutton: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Benjamin Otte
fb7d1095d1 scrolledwindow: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Benjamin Otte
45ec453b76 searchentry: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Benjamin Otte
e4d628b410 shortcutssection: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Benjamin Otte
e11d799460 shortcutswindow: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Benjamin Otte
6e38af4429 flowbox: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Benjamin Otte
a70635f760 paned: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Benjamin Otte
2c91f15f6d spinbutton: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Benjamin Otte
bad5ee7ed9 textview: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Benjamin Otte
277aaab041 filechooserwidget: Port bindings to use shortcuts 2020-03-18 23:00:50 -04:00
Benjamin Otte
5ade831cd1 shortcutcontroller: Add gtk_shortcut_controller_add_shortcut()
... and gtk_shortcut_controller_remove_shortcut().
2020-03-18 23:00:50 -04:00
Benjamin Otte
3b8a4340da shortcutcontroller: Add private API for running class shortcuts
We don't want regular users to be able to run class shortcuts in their
controllers, so we have to special case that.
2020-03-18 23:00:49 -04:00
Benjamin Otte
ae11b29ee7 treeview: Port bindings to use shortcuts 2020-03-18 23:00:49 -04:00
Benjamin Otte
ac31979805 widget: Port bindings to use shortcuts 2020-03-18 23:00:49 -04:00
Benjamin Otte
0b4d0f4d31 dialog: Port binding to use shortcuts 2020-03-18 23:00:49 -04:00
Emmanuele Bassi
00bc9e6b85 text: Port to widget shortcuts 2020-03-18 23:00:49 -04:00
Emmanuele Bassi
d75fd59ddf Allow installing bindings bound to actions
This is just convenience code around GtkShortcut, just like bindings for
signal emission and callback invocation.
2020-03-18 23:00:49 -04:00
Emmanuele Bassi
84a52e3bbd shortcut: Add action activation 2020-03-18 23:00:49 -04:00
Emmanuele Bassi
9687d69b5a bindings: Export action activation internally
We're going to use it, just like we use the signal emission code.
2020-03-18 23:00:49 -04:00
Benjamin Otte
b18f9da807 shortcut: Add gtk_shortcut_set_callback()
... and gtk_widget_class_add_binding() to go with it.

This allows shortcuts to invoke manually added callbacks.
2020-03-18 23:00:49 -04:00
Benjamin Otte
6c13bbb441 combobox: Port bindings to use shortcuts 2020-03-18 23:00:49 -04:00
Benjamin Otte
4f128a4a21 assistant: Port bindings to use shortcuts 2020-03-18 23:00:49 -04:00
Benjamin Otte
e62154c91f trigger: Add an alternative trigger
And use it.

I just added it to GtkWidget just to show that I can.
The real reason I want it is for gamepad/joystick triggers
in games, so that it becomes possible to select 2 different
triggers (gamepad and keyboard) for the same shortcut.
2020-03-18 23:00:49 -04:00