Benjamin Otte
d66d0268e5
shortcut: Change the API for creating shortcuts
...
When creating shortcuts, there almost always are a trigger and an action
available for use. So make gtk_shortcut_new() take those as arguments.
Also add gtk_shortcut_new_with_arguments() so people can easily pass
those in, too.
2018-08-24 08:55:44 +02:00
Benjamin Otte
22f9dc86bf
shortcut: Add GtkShortcutAction
...
Similar to GtkShortcutTrigger, GtkShortCutAction provides all the
different ways to activate a shortcut.
So far, these different ways are supported:
- do nothing
- Call a user-provided callback
- Call gtk_widget_activate()
- Call gtk_widget_mnemonic_activate()
- Emit an action signal
- Activate an action from the widget's action muxer
- Activate a GAction
2018-08-24 08:55:44 +02:00
Benjamin Otte
74338af685
accelgroup: Remove unneeded APIs
...
After the removal of GtkAccelMap, these things are no longer necessary.
2018-08-24 08:55:44 +02:00
Benjamin Otte
4195b4dfa1
gtk: Remove GtkAccelMap
...
Now that accel paths are gone, the object managing them isn't needed
anymore either.
2018-08-24 08:55:44 +02:00
Benjamin Otte
5e89acb4de
gtk: Remove accel paths
...
It's an outdated technology now that everybody is using GActionGroups.
If somebody wanted to support changeable shortcuts, they'd need to
reintroduce it in another way.
2018-08-24 08:55:44 +02:00
Benjamin Otte
0a893b203a
menushell: Remove old mnemonic handling
...
It's not used anymore.
This was also the last user of GtkMnemonicHash, so delete that one, too.
2018-08-24 08:55:44 +02:00
Benjamin Otte
4f2570d9b6
window: Remove all old mnemonic handling API
2018-08-24 08:55:44 +02:00
Benjamin Otte
57f9eed05f
menu: Implement GtkShortcutManager
...
And make sure to activate mnemonics without Alt
2018-08-24 08:55:44 +02:00
Benjamin Otte
d50be09253
shortcutmanager: Add
...
This adds an interface for taking care of shortcut controllers with
managed scope.
GtkRoot requires this interface, where it's also used for global
controllers and to ensure that managed scope always finds a parent that
is a shortcut manager.
No widget that isn't a root implements the interface yet.
2018-08-24 08:55:44 +02:00
Benjamin Otte
37bb5de03b
label: Implement mnemonics using shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
26ab1e68ab
shortcut: Add gtk_shortcut_set_mnemonic_activate()
...
Makes the shortcut call gtk_widget_mnemonic_activate() upon activation.
2018-08-24 08:55:44 +02:00
Benjamin Otte
7cbcee1514
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.
2018-08-24 08:55:44 +02:00
Benjamin Otte
78b6268ac3
window: Put F10 accelerator into its own shortcut controller
...
So instead of relying on gtk_window_activate_key(), it's now using
proper infrastructure.
2018-08-24 08:55:44 +02:00
Benjamin Otte
8e428e9b85
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).
2018-08-24 08:55:44 +02:00
Benjamin Otte
77e75f40a7
gdk: Remove GDK_RELEASE_MASK
...
It was only ever supported by keybindings and those are gone now.
2018-08-24 08:55:44 +02:00
Benjamin Otte
19eee860de
gtk-demo: Add a dumb demo for shortcut triggers
2018-08-24 08:55:44 +02:00
Benjamin Otte
12a4531f71
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.
2018-08-24 08:55:44 +02:00
Benjamin Otte
3065ff7908
shortcuttrigger: Add gtk_shortcut_trigger_to_label()
...
Provide a user-presentable string.
2018-08-24 08:55:44 +02:00
Benjamin Otte
4b7df0fe84
accelgroup: Add gtk_accel_group_print_label()
2018-08-24 08:55:44 +02:00
Benjamin Otte
34736ab97e
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.
2018-08-24 08:55:44 +02:00
Benjamin Otte
4682f706fa
accellabel: Get rid of class variables
...
We can just look them up as-needed, no need to cache them.
2018-08-24 08:55:44 +02:00
Benjamin Otte
4b3172d047
gtk: Remove bindings
...
The whole binding functionality is now handled by shortcuts.
2018-08-24 08:55:44 +02:00
Benjamin Otte
be341be1ac
accelgroup: Actually have a default mod mask
...
Don't just use a value without initializing it.
2018-08-24 08:55:44 +02:00
Benjamin Otte
56f9b96fe6
treeview: Redo event forwarding hack
...
Reorder the event controllers so that key forwarding to the search
entries really happens after shortcut triggering.
2018-08-24 08:55:44 +02:00
Benjamin Otte
4aac701b42
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.
2018-08-24 08:55:44 +02:00
Benjamin Otte
caf309d81b
eventcontrollerkey: Remove unused header
2018-08-24 08:55:44 +02:00
Benjamin Otte
d80e651623
iconview: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
fb6cdbc1f1
infobar: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
66476bbd23
label: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
853c9b3c4c
listbox: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
37c4b5209d
menubar: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
893bd45c1f
menu: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
06ed2e0356
menushell: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
ebf15560f0
notebook: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
dcfa355d0a
scale: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
474494d82c
scalebutton: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
c73be5c405
scrolledwindow: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
6bba263745
searchentry: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
da418ffc80
shortcutssection: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
b3508dc423
shortcutswindow: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
a66990b0e8
flowbox: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
599a2c908b
paned: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
fa86955a60
spinbutton: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
48b67c55ab
textview: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
7be30c8a9f
filechooserwidget: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
1dfce91211
toolbar: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
b37f91e4c6
shortcutcontroller: Add gtk_shortcut_controller_add_shortcut()
...
... and gtk_shortcut_controller_remove_shortcut().
2018-08-24 08:55:44 +02:00
Benjamin Otte
fee425998e
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.
2018-08-24 08:55:44 +02:00
Benjamin Otte
de5334fc7f
treeview: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00
Benjamin Otte
4bfd0cb976
widget: Port bindings to use shortcuts
2018-08-24 08:55:44 +02:00