Commit Graph

61617 Commits

Author SHA1 Message Date
Emmanuele Bassi
a11dd6aaac window: Remove all old mnemonic handling API 2020-03-24 00:05:38 -04:00
Emmanuele Bassi
ea195b2211 Add GtkShortcutManager
This adds an interface for taking care of shortcut controllers with
managed scope.

Only GtkWindow currently implements this interface, so we need to ensure
that we check if any top-level widget we reach is a shortcuts manager
before we call into it.
2020-03-24 00:05:38 -04:00
Benjamin Otte
d98800701e label: Implement mnemonics using shortcuts 2020-03-24 00:05:38 -04:00
Benjamin Otte
15fe812393 shortcut: Add gtk_shortcut_set_mnemonic_activate()
Makes the shortcut call gtk_widget_mnemonic_activate() upon activation.
2020-03-24 00:05:38 -04:00
Benjamin Otte
d06cb7773b 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-24 00:05:38 -04:00
Benjamin Otte
b3d8d6d79f 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-24 00:05:38 -04:00
Benjamin Otte
2b3c937f09 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-24 00:05:38 -04:00
Benjamin Otte
514b8a9dc3 gdk: Remove GDK_RELEASE_MASK
It was only ever supported by keybindings and those are gone now.
2020-03-24 00:05:38 -04:00
Benjamin Otte
d4fdae074d gtk-demo: Add a dumb demo for shortcut triggers 2020-03-24 00:05:38 -04:00
Benjamin Otte
fa8b2676eb 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-24 00:05:38 -04:00
Benjamin Otte
ec10fae6ed shortcuttrigger: Add gtk_shortcut_trigger_to_label()
Provide a user-presentable string.
2020-03-24 00:05:38 -04:00
Benjamin Otte
82a4b87640 accelgroup: Add gtk_accel_group_print_label() 2020-03-24 00:05:38 -04:00
Benjamin Otte
79495be090 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-24 00:05:38 -04:00
Benjamin Otte
e17cafb3d1 accellabel: Get rid of class variables
We can just look them up as-needed, no need to cache them.
2020-03-24 00:05:38 -04:00
Benjamin Otte
05d7e67080 gtk: Remove bindings
The whole binding functionality is now handled by shortcuts.
2020-03-24 00:05:38 -04:00
Matthias Clasen
0b6323fdfd event controller focus: drop include
This header is not needed here, and it is going away.
2020-03-24 00:05:38 -04:00
Emmanuele Bassi
2091d6389e Remove bindings activation from GtkEventControllerKey
We're going to use shortcuts soon.
2020-03-24 00:05:38 -04:00
Emmanuele Bassi
f1968e5498 popover: Remove unused include 2020-03-24 00:05:38 -04:00
Matthias Clasen
ac4b6f6668 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-24 00:05:37 -04:00
Emmanuele Bassi
a41c87d449 popovermenu: Port to shortcuts 2020-03-22 11:14:06 -04:00
Emmanuele Bassi
f1a8938cd7 passwordentry: Remove unused include 2020-03-22 11:14:06 -04:00
Emmanuele Bassi
a9391bb100 entry: Remove unused include 2020-03-22 11:14:06 -04:00
Benjamin Otte
06a5fd1cf7 accelgroup: Actually have a default mod mask
Don't just use a value without initializing it.
2020-03-22 11:14:06 -04:00
Benjamin Otte
2df6e8e8dc treeview: Redo event forwarding hack
Reorder the event controllers so that key forwarding to the search
entries really happens after shortcut triggering.
2020-03-22 11:14:06 -04:00
Benjamin Otte
cf6940be9f 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-22 11:14:06 -04:00
Emmanuele Bassi
1e91f65ffd widget: Add private accessor to event controllers 2020-03-22 11:14:06 -04:00
Benjamin Otte
f54c0bf1df iconview: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
d405d95ce4 infobar: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
16b8bf042c label: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
b695b1fd4c listbox: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
fda4d8b7c6 notebook: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
378af08a72 scale: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
3e1a86b36b scalebutton: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
199b5174f1 scrolledwindow: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
7efbe18783 searchentry: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
893b6a8514 shortcutssection: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
75e9d9af53 shortcutswindow: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
ff500ea26c flowbox: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
eb6834b989 paned: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
6f0284e361 spinbutton: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
a3d9f0ac60 textview: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
6fec3f22a4 filechooserwidget: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
453d08b982 shortcutcontroller: Add gtk_shortcut_controller_add_shortcut()
... and gtk_shortcut_controller_remove_shortcut().
2020-03-22 11:14:06 -04:00
Benjamin Otte
4fbcb74697 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-22 11:14:06 -04:00
Benjamin Otte
2382d8e9c2 treeview: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
0089c6146e widget: Port bindings to use shortcuts 2020-03-22 11:14:06 -04:00
Benjamin Otte
60a89ff7d4 dialog: Port binding to use shortcuts 2020-03-22 11:14:06 -04:00
Emmanuele Bassi
3eec8799f0 text: Port to widget shortcuts 2020-03-22 11:14:06 -04:00
Emmanuele Bassi
93bebe31e6 Allow installing bindings bound to actions
This is just convenience code around GtkShortcut, just like bindings for
signal emission and callback invocation.
2020-03-22 11:14:06 -04:00
Emmanuele Bassi
0ee873c5e4 shortcut: Add action activation 2020-03-22 11:14:06 -04:00