Matthias Clasen
5432f73095
window: Fix residual resizing issues
...
After the GdkToplevel split, GtkWindow occasionally
forgets its minimum size. Fix this by keeping a GdkToplevelLayout
around and reusing it.
2020-03-31 13:07:44 -04:00
Matthias Clasen
15eb3bbbf1
shortcutcontroller: Document buildable support
2020-03-30 20:09:29 -04:00
Matthias Clasen
ace183f38f
shortcutcontroller: Fix builder support
...
The GtkBuilder support was not working anymore after
triggers and actions have been turned into objects.
Fix this.
2020-03-30 19:02:35 -04:00
Bastien Nocera
8cf41c1b66
filechoosernativeportal: Fall back if portal is too old
...
Add portal version checking as originally implemented for the GTK 3.x
branch.
See: 35fec1c6b2
2020-03-30 18:31:24 +02:00
Bastien Nocera
027ca22def
Add portal version checking helper
...
Add gtk_get_portal_interface_version() to check the version of a portal.
2020-03-30 18:31:23 +02:00
Bastien Nocera
bd55c5842e
colorpickerportal: Simplify version fetching code
...
Simplify version checking code by using a function to fetch the uint out
of the GVariant and don't throw a warning if it can't be fetched.
2020-03-30 18:31:23 +02:00
Matthias Clasen
de31bb59a1
window: Remove initial-focus leftovers
...
We removed the way to set initial_focus a year ago,
time to get rid of the leftovers.
2020-03-29 23:39:54 -04:00
Matthias Clasen
07bb29153b
widget: Remove a leftover vfunc
...
The popup-menu signal is gone, so we can remove the vfunc.
2020-03-29 23:18:56 -04:00
Timm Bäder
785b33f169
widget: Return an array from list_controllers
...
Minimize the GList usage throughout the code base.
2020-03-29 15:32:54 +02:00
Matthias Clasen
47982ae272
coloreditor: Drop the Private struct
2020-03-29 09:04:19 -04:00
Matthias Clasen
0020b735d9
colorchooserdialog: Drop the Private struct
2020-03-29 09:04:19 -04:00
Matthias Clasen
e05c1b0244
colorchooserwidget: Drop the Private struct
2020-03-29 09:04:19 -04:00
Matthias Clasen
d0b4f9eb29
notebook: Drop the Private struct
2020-03-29 09:04:19 -04:00
Matthias Clasen
03375b723a
listbox: Drop the Private struct
2020-03-29 09:04:19 -04:00
Matthias Clasen
e2beb6ec50
levelbar: Drop the Private struct
2020-03-29 09:04:19 -04:00
Matthias Clasen
ef32cff771
spinbutton: Drop the Private struct
2020-03-29 09:04:19 -04:00
Matthias Clasen
366b007024
filechooserwidget: Drop the Private struct
2020-03-29 09:04:19 -04:00
Matthias Clasen
40337aa1b3
printunixdialog: Drop the Private struct
2020-03-29 09:04:19 -04:00
Matthias Clasen
0bb38b903e
printjob: Drop the Private struct
2020-03-29 09:04:19 -04:00
Matthias Clasen
173b1333ca
printing: Avoid a crash
...
When no printer has been selected (e.g. because we don't
find any printers), the 'print at' radio group should be
insensitive, except for the 'now' choice. Selecting another
option in this situation will lead to a crash.
2020-03-28 15:36:15 -04:00
Matthias Clasen
784d6f8d0c
printing: Fix initial page range radio group
...
Only set one radio button as active in the ui file.
Otherwise we end up with multiple options appearing
as selected initially.
2020-03-28 15:36:15 -04:00
Matthias Clasen
7916b95bc5
gesture: Fix gtk_gesture_get_bounding_box
...
When we stopped translating event coordinates in-place,
this function inadvertently started returning surface-relative
bounding boxes instead of widget-relative ones, as expected.
Fix this by using the widget-relative coordinates that we
already store.
2020-03-28 15:03:33 -04:00
Matthias Clasen
7b135c96e4
cellarea: Fix cell editing
...
We need to translate the event coordinates to
widget-relative coordinates. This broke when
we stopped translating event coordinates in-place.
2020-03-28 14:56:26 -04:00
Matthias Clasen
e662438675
button: Fix an event handling gotcha
...
We no longer translate event coordinates in-place,
so gdk_event_get_position() returns surface-relative
coordinates, not widget-relative ones. Just use the
coordinates we are given.
2020-03-28 14:33:01 -04:00
Matthias Clasen
aa2ca80817
imcontextsimple: Don't use g_object_unref on events
...
Events are not objects anymore.
2020-03-28 14:29:08 -04:00
Matthias Clasen
ceef86895f
appchooserdialog: Drop the Private struct
2020-03-28 10:59:12 -04:00
Matthias Clasen
001d076e61
image: Drop the Private struct
2020-03-28 10:49:54 -04:00
Matthias Clasen
408dd37944
infobar: Drop the Private struct
2020-03-28 10:48:15 -04:00
Matthias Clasen
9287e0e7fb
texthandle: Drop the Private struct
2020-03-28 10:36:09 -04:00
Matthias Clasen
28eb1fce04
searchentry: Drop the Private struct
2020-03-28 10:28:22 -04:00
Matthias Clasen
49427119ab
statusbar: Drop the Private struct
2020-03-28 10:28:01 -04:00
Matthias Clasen
05891b1238
settings: Drop the Private struct
...
Also drop class padding - pointless for final types.
2020-03-28 10:22:44 -04:00
Matthias Clasen
b14d99ad7a
accellabel: Drop unused class fields
...
We are not using these anymore.
2020-03-28 10:15:50 -04:00
Matthias Clasen
329638280c
accellabel: Drop the Private struct
2020-03-28 10:06:26 -04:00
Matthias Clasen
06365cdc38
actionbar: Drop the Private struct
2020-03-28 09:59:49 -04:00
Matthias Clasen
1f808c479a
aboutdialog: Drop the Private struct
2020-03-28 09:59:07 -04:00
Matthias Clasen
7e8d61b92c
menubutton: Drop the Private struct
2020-03-28 09:49:29 -04:00
Timm Bäder
d01e664c79
applicationaccels: Fix shortcut memory leaks
...
g_list_model_get_item() is transfer-full.
2020-03-28 08:34:35 +01:00
Matthias Clasen
ba25e08e7b
menubutton: Add a use-underline property
...
This is necessary since apps no longer have direct
access to the label.
Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2489
2020-03-28 00:08:12 -04:00
Matthias Clasen
8997dc6f31
Merge branch 'rename-theme-resources' into 'master'
...
Rename GResources for standard GTK themes
See merge request GNOME/gtk!1576
2020-03-27 16:37:31 +00:00
Emmanuele Bassi
f1003d6ae8
Rename GResources for standard GTK themes
...
After commit 2ab9be54fb
we had to rename
the generated CSS files to be included into the GResource bundle; we
kept the URI stable to avoid too much churn, and allow backporting the
change to the 3.24 stable branch. This had the adverse effect of making
it harder to debug issues, as the on-disk file name does not match the
location in the GResource that will be used to print out warnings,
errors, and debugging messages.
2020-03-27 15:20:59 +00:00
Emmanuele Bassi
6719d3044d
Add parsing for GtkAlternativeTrigger
...
Alternative triggers are separate by a pipe character.
2020-03-27 14:35:00 +00:00
Emmanuele Bassi
170e8bd605
Parse keyval name directly for mnemonic triggers
...
We don't need to parse the full accelerator format for mnemonic
triggers.
2020-03-27 13:57:19 +00:00
Emmanuele Bassi
96ccb25f97
Return a full reference when parsing triggers
...
We're not returning a full reference for GtkNeverTrigger, but we are
returning full references for mnemonic and keyval triggers; this means
we're either going to leak mnemonic and keyval triggers if we consider
this function a "transfer none" one, or we are going to trigger an
assertion failure when finalizing a never trigger, if we consider this
function a "transfer full" one.
Let's be consistent, and always return a full reference to the caller.
2020-03-27 13:57:19 +00:00
Timm Bäder
c3c06e60dc
calendar: Only highlight one day as today
...
Fixes #2490
2020-03-27 09:50:30 +01:00
Timm Bäder
ecb8dda309
shortcutscontroller: Make add_shortcut transfer-full
...
Like all the other shortcut api
2020-03-27 08:36:32 +01:00
Timm Bäder
f7975828bc
filechooserwidget: Plug a memory leak
2020-03-27 08:36:32 +01:00
Jakub Steiner
06fe4f0205
Adwaita: make insensitive slightly less sensitive
...
- will expose itself even more in HC
2020-03-26 17:22:47 +01:00
Jakub Steiner
910dd7a20a
HC: derive from Adwaita
...
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/1450
2020-03-26 17:21:47 +01:00
Jakub Steiner
8d8990ccd7
Revert "Adwaita: make insensitive slightly less sensitive"
...
This reverts commit bf3ccaa1bf
.
2020-03-26 17:19:19 +01:00
Jakub Steiner
bf3ccaa1bf
Adwaita: make insensitive slightly less sensitive
...
- will expose itself even more in HC
2020-03-26 15:55:42 +01:00
Matthias Clasen
1ec2d1d9f1
shortcutmanager: Add some more docs
2020-03-25 23:14:45 -04:00
Matthias Clasen
f59cd392ba
shortcuttrigger: Some documentation fixups
2020-03-25 23:14:45 -04:00
Matthias Clasen
6bacb0b0ae
shortcutaction: Some documentation fixups
2020-03-25 23:14:45 -04:00
Matthias Clasen
530b571d89
shortcutcontroller: Expand the docs
2020-03-25 23:14:45 -04:00
Matthias Clasen
591f6bd7a9
popovermenu: Show mnemonics on keynav
...
This is the expected behavior for menus.
2020-03-25 23:14:45 -04:00
Matthias Clasen
642503afb4
popover: Implement auto mnemonics
...
Unfortunately, this involves copying a bunch of
code from gtkwindow.c. The only difference here
is that we add a private method to turn this off,
which will be used by GtkPopoverMenu to implement
its own auto mnemonics.
2020-03-25 23:14:45 -04:00
Matthias Clasen
fc0b0b14a8
label: Respect GtkPopover::mnemonics-visible
...
When inside a popover, look to the popover for
whether to show mnemonics or not.
2020-03-25 23:14:45 -04:00
Matthias Clasen
2de4fc3ec0
popover: Add a mnemonics-visible property
...
This will be handled separately for popovers, so we
need our own property for it.
2020-03-25 23:14:45 -04:00
Matthias Clasen
b2ac42e576
label: Disconnect visible mnemonics in popovers
...
The controller handling mnemonics is limited to same-native,
so showing mnemonics in other natives.
2020-03-25 23:14:45 -04:00
Matthias Clasen
b19d4b9006
modelbutton: Install accels when inside a popover
...
When a model button in a popover displays a shortcut,
it is probably from the global shortcut controllers,
and will not work inside the popover, since that is
a different native. Install a shortcut using the same
trigger that just activates the model button. This
shortcut will end up in the managed shortcut controller
of the popover.
2020-03-25 23:14:45 -04:00
Matthias Clasen
2c28a0713d
popovermenu: Make mnemonics work without Alt
...
This is expected menu behavior.
2020-03-25 23:14:45 -04:00
Matthias Clasen
b423f974db
shortcutcontroller: Inject accels into the action muxer
...
This is the way model button pic up accels for their actions.
2020-03-25 23:14:45 -04:00
Matthias Clasen
4a430820bd
popover: Implement GtkShortcutManager
...
This makes mnemonics work in popovers.
2020-03-25 23:14:45 -04:00
Matthias Clasen
5153cdc01d
modelbutton: Make activatable
...
This is expected of button-like widgets, and is necessary
to make keynav in popover menus work as expected.
2020-03-25 23:14:45 -04:00
Matthias Clasen
1db5382c6d
modelbutton: Remove accel poking
...
Stop manually poking GtkApplication for accels.
GtkApplication already feeds them into the action
muxer machinery, so that is where will get them.
2020-03-25 23:14:45 -04:00
Emmanuele Bassi
6e8c78714d
Turn GtkShortcutAction into a GObject
...
Just like we did for GtkShortcutTrigger.
This allows language bindings to properly deal with all the actions.
2020-03-25 23:14:45 -04:00
Emmanuele Bassi
457b6657bb
Turn GtkShortcutTrigger into an object
...
The lightweight inheritance mechanism used for GtkShortcutTrigger is not
going to be usable by bindings, because boxed types cannot have derived
types.
We could use GTypeInstance and derive everything from that, like
GParamSpec, but in the end shortcuts are not really a performance
critical paths, unlike CSS values or render nodes.
2020-03-25 23:14:45 -04:00
Matthias Clasen
5ea45bf57d
widget: Remove some leftover accel group plumbing
...
The ::can-activate-accel and ::accel-closures-changed signals
are not used anymore, remove them.
2020-03-25 23:14:45 -04:00
Matthias Clasen
4e978d6b7a
shortcutcontroller: Only activate shortcuts of visible widgets
...
Our shortcuts are like mnemonics in this respect - they only
activate when the widget is viewable.
2020-03-25 23:14:45 -04:00
Matthias Clasen
b4722b43a1
Drop GtkKeyHash
2020-03-25 23:14:45 -04:00
Matthias Clasen
fd95cc56b1
window: Remove GtkKeyHash remnants
...
It is not used anymore.
2020-03-25 23:14:45 -04:00
Matthias Clasen
35332eb3b0
shortcutcontroller: Implement mnemonic cycling
...
Make GtkShortcutController collect matching shortcuts
in the same way GtkKeyHash did (accept fuzzy matches
if we don't have any exact matches), and cycle among
the matches if we have multiple.
2020-03-25 23:14:45 -04:00
Matthias Clasen
586e7749d5
shortcuttrigger: Do elaborate matching for key events
...
Copy the logic from GtkKeyHash for matching key events
to shortcuts.
Adapt shortcuts test to work with the better matching,
by creating more complete key events.
2020-03-25 23:14:45 -04:00
Matthias Clasen
904835d4b1
shortcuttrigger: Introduce partial matches
...
Allow GtkShortcutTrigger to return partial matches.
Currently, no triggers produce such results, and
GtkShortcutController treats partial matches like
exact ones.
2020-03-25 23:14:45 -04:00
Matthias Clasen
9cce474106
widget: Drop the ::popup-menu signal
...
This is now done in widgets which have context
menus.
2020-03-25 23:14:45 -04:00
Matthias Clasen
9d84996fea
placesview: Stop using ::popup-menu
...
This signal is going away.
2020-03-25 23:14:45 -04:00
Matthias Clasen
c2d77a1f37
filechooser: Stop using ::popup-menu
...
This signal is going away.
2020-03-25 23:14:45 -04:00
Matthias Clasen
54a0037c45
mountoperation: Stop using ::popup-menu
...
We can just use a shortcut controller directly.
2020-03-25 23:14:45 -04:00
Matthias Clasen
844801580f
colorchooser: Stop using ::popup-menu
...
This signal is going away. Use an action instead.
2020-03-25 23:14:44 -04:00
Matthias Clasen
28b05eea67
range: Remove ::popup-menu emission
...
This signal is going away, and having context menus
on sliders is not really a thing anyway.
2020-03-25 23:14:44 -04:00
Matthias Clasen
ca1d4322a2
scrollbar: Remove :popup-menu forwarding
...
This signal is going away.
2020-03-25 23:14:44 -04:00
Matthias Clasen
c94ec4a204
emojichooser: Stop using ::popup-menu
...
This signal is going away. Use an action instead.
2020-03-25 23:14:44 -04:00
Matthias Clasen
778d884f70
Use an action for the context menu keybinding
...
The ::popup-menu signal is going away.
2020-03-25 23:14:44 -04:00
Matthias Clasen
e8be45fabc
Print mnemonic triggers clearly
2020-03-25 23:14:44 -04:00
Matthias Clasen
c90b0581dd
inspector: Show shortcuts
...
At a tab that lists the shortcuts contained in a
GtkShortcutController.
2020-03-25 23:14:44 -04:00
Benjamin Otte
43c0ea676d
filechooser: Trigger the location popup via bindings
...
Simplifies code quite a bit.
2020-03-25 23:14:44 -04:00
Benjamin Otte
bb4fbe3d8f
accels: Remove GtkAccelGroup
2020-03-25 23:14:44 -04:00
Benjamin Otte
4c45410d43
widget: Remove gtk_widget_add_accelerator()
...
People should use shortcut controllers instead (global, capture).
A side effect of this is that GtkAccelLabel now lost its method to
magically look up accelerators to display. Somebody needs to add that
back later.
2020-03-25 23:14:28 -04:00
Benjamin Otte
78e3e42042
shortcutcontroller: Implement GtkBuildable
...
Use it to allow adding shortcuts to the controller via the usual <child>
method.
2020-03-25 23:14:28 -04:00
Benjamin Otte
33045c3e0b
shortcutaction: Integrate with GtkBuilder property parsing
...
<property name="action">action(win.quit)</property> style action
specifications now work for GtkShortcutAction properties.
2020-03-25 23:14:28 -04:00
Benjamin Otte
7974751e24
shortcuttrigger: Add gtk_shortcut_triger_new_parse_string()
...
And hook it up into the GtkBuilder infrastructure.
2020-03-25 23:14:28 -04:00
Benjamin Otte
daa7d9072d
application: Replace accelerator handling with shortcuts
...
API remains the same, but activation is now done via a
shortcutcontroller.
The code uses a controller with global scope so that the
shortcuts are managed with all the other global shortcuts.
2020-03-25 23:14:28 -04:00
Benjamin Otte
90a34312d4
accel: Add display arg to gtk_accelerator_parse_with_keycode()
...
It was using the default display unconditionally.
2020-03-25 23:14:28 -04:00
Benjamin Otte
580863b112
accelerators: Make gtk_accelerator_parse() return TRUE/FALSE
...
A parse function should return success or not. So do that.
2020-03-25 23:14:28 -04:00
Benjamin Otte
fb6a8f5fc1
shortcuttrigger: Add hash(), equal(), and compare() functions
...
Those are useful for putting triggers in hash tables or getting sorted
output.
2020-03-25 23:14:28 -04:00
Matthias Clasen
c2e2e2993b
shortcutmanager: Use list models
2020-03-25 23:14:28 -04:00
Matthias Clasen
5763514ab8
shortcutcontroller: Use a list model for shortcuts
2020-03-25 23:14:28 -04:00
Benjamin Otte
4c5d8547be
shortcutaction: Add gtk_shortcut_action_to_string()
...
For all but the callback action, we can print something useful.
2020-03-25 23:14:27 -04:00
Matthias Clasen
34987c0b5c
widget: Only create a controller if we have shortcuts
...
No point in creating objects that just hold empty lists.
2020-03-25 23:14:27 -04:00
Benjamin Otte
3cd4eb0310
widget: Keep keybindings as a GListStore
...
This way, we can use shortcut_controller_new_for_model() and avoid all
the special casing about run_class.
2020-03-25 23:14:27 -04:00
Benjamin Otte
a1e9ae5259
shortcutcontroller: Add gtk_shortcut_controller_new_for_model()
...
This is mainly for internal use, but I can't see a reason to not have it
public for people who want to maintain their own lists.
I'm sure gnome-builder will never ever find a way to misuse it.
2020-03-25 23:14:27 -04:00
Benjamin Otte
e738a4d129
shortcutcontroller: Implement GListModel
...
After all, this controller is a list of shortcuts.
2020-03-25 23:14:27 -04:00
Benjamin Otte
92e20deca1
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.
2020-03-25 23:14:27 -04:00
Benjamin Otte
cd0332aad5
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
2020-03-25 23:14:27 -04:00
Benjamin Otte
cdd33bbee6
accelgroup: Remove unneeded APIs
...
After the removal of GtkAccelMap, these things are no longer necessary.
2020-03-25 23:14:27 -04:00
Emmanuele Bassi
bca1f6b64f
gtk: Remove GtkAccelMap
...
Now that accel paths are gone, the object managing them isn't needed
anymore either.
2020-03-25 23:14:27 -04:00
Benjamin Otte
9b99b89807
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.
2020-03-25 23:14:27 -04:00
Benjamin Otte
62f96bfda6
Remove GtkMnemonicHash
...
It's not used anymore.
2020-03-25 23:14:27 -04:00
Emmanuele Bassi
2c62cde780
window: Remove all old mnemonic handling API
2020-03-25 23:14:27 -04:00
Emmanuele Bassi
aab10ea43b
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-25 23:14:27 -04:00
Benjamin Otte
9428807c57
label: Implement mnemonics using shortcuts
2020-03-25 23:14:27 -04:00
Benjamin Otte
21e6e4c026
shortcut: Add gtk_shortcut_set_mnemonic_activate()
...
Makes the shortcut call gtk_widget_mnemonic_activate() upon activation.
2020-03-25 23:14:27 -04:00
Benjamin Otte
bde4cbe377
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-25 23:14:27 -04:00
Benjamin Otte
0b7e74318b
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-25 23:14:27 -04:00
Benjamin Otte
e398f63bf6
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-25 23:14:27 -04:00
Benjamin Otte
2244eeb727
gdk: Remove GDK_RELEASE_MASK
...
It was only ever supported by keybindings and those are gone now.
2020-03-25 23:14:27 -04:00
Benjamin Otte
730154df7d
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-25 23:14:27 -04:00
Benjamin Otte
2309e1dd38
shortcuttrigger: Add gtk_shortcut_trigger_to_label()
...
Provide a user-presentable string.
2020-03-25 23:14:27 -04:00
Benjamin Otte
90c7f4608a
accelgroup: Add gtk_accel_group_print_label()
2020-03-25 23:14:27 -04:00
Benjamin Otte
66102dacf1
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-25 23:14:27 -04:00
Benjamin Otte
d84b60e5f9
accellabel: Get rid of class variables
...
We can just look them up as-needed, no need to cache them.
2020-03-25 23:14:27 -04:00
Benjamin Otte
9a03c8b4d8
gtk: Remove bindings
...
The whole binding functionality is now handled by shortcuts.
2020-03-25 23:14:27 -04:00
Emmanuele Bassi
f02521c502
Remove bindings activation from GtkEventControllerKey
...
We're going to use shortcuts soon.
2020-03-25 22:36:03 -04:00
Matthias Clasen
c1247a7993
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-25 22:36:03 -04:00
Emmanuele Bassi
b2a747b4d4
popovermenu: Port to shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
c1ee2fd54a
accelgroup: Actually have a default mod mask
...
Don't just use a value without initializing it.
2020-03-25 22:36:03 -04:00
Benjamin Otte
4c7b00fd20
treeview: Redo event forwarding hack
...
Reorder the event controllers so that key forwarding to the search
entries really happens after shortcut triggering.
2020-03-25 22:36:03 -04:00
Benjamin Otte
3fba7f9dce
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-25 22:36:03 -04:00
Emmanuele Bassi
7ca4a94768
widget: Add private accessor to event controllers
2020-03-25 22:36:03 -04:00
Benjamin Otte
1df0a5eab5
iconview: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
6a005c815e
infobar: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
cb09211ace
label: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
e430e0e2ff
listbox: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
6ad1078595
notebook: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
cd7e9dcc27
scale: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
8752f613d7
scalebutton: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
f54d3a3aca
scrolledwindow: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
db525ef213
searchentry: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
3f00e42ec9
shortcutssection: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
d5fa5b9594
shortcutswindow: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
2e5fc35e51
flowbox: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
6ff94f3637
paned: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
80888d7111
spinbutton: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
48b46c8d08
textview: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
df457cadfc
filechooserwidget: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
58e8f2332d
shortcutcontroller: Add gtk_shortcut_controller_add_shortcut()
...
... and gtk_shortcut_controller_remove_shortcut().
2020-03-25 22:36:03 -04:00
Benjamin Otte
376dc4d169
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-25 22:36:03 -04:00
Benjamin Otte
dfd81f9c64
treeview: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
6d418134ee
widget: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
02646d74f4
dialog: Port binding to use shortcuts
2020-03-25 22:36:03 -04:00
Emmanuele Bassi
d62be573ad
text: Port to widget shortcuts
2020-03-25 22:36:03 -04:00
Emmanuele Bassi
17eef48835
Allow installing bindings bound to actions
...
This is just convenience code around GtkShortcut, just like bindings for
signal emission and callback invocation.
2020-03-25 22:36:03 -04:00
Emmanuele Bassi
7ffea02eb4
shortcut: Add action activation
2020-03-25 22:36:03 -04:00
Emmanuele Bassi
0b75edc0e1
bindings: Export action activation internally
...
We're going to use it, just like we use the signal emission code.
2020-03-25 22:36:03 -04:00
Benjamin Otte
d4bba7de88
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-25 22:36:03 -04:00
Benjamin Otte
a8902da4bc
assistant: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
8ff18b3d39
combobox: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
81fa63260e
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-25 22:36:03 -04:00
Matthias Clasen
6d452f1eb8
shortcut: Add GtkShortcutTrigger
...
Triggers are meant to describe how to trigger a shortcut.
So far only a keyval + modifiers trigger exists.
2020-03-25 22:36:03 -04:00
Benjamin Otte
d51b8ff058
window: Port bindings to use shortcuts
2020-03-25 22:36:03 -04:00
Benjamin Otte
b11263ae91
bindings: Add more variant types
...
Also marshal types that the code in gtkbindings.c doesn't use. These
will be used by gtk_widget_class_add_binding_signal().
2020-03-25 22:36:03 -04:00
Benjamin Otte
0eb1228902
widget: Add gtk_widget_class_add_shortcut()
...
This allows adding shortcuts as a replacement for keybindings.
2020-03-25 22:36:03 -04:00
Benjamin Otte
d8603864a9
gtk: Add GtkShortcut
...
This is the base class for what is about to take over all sorts of
keyboard shortcuts. The initial version barely deals with keybindings.
2020-03-25 22:36:03 -04:00
Benjamin Otte
f9ee703af4
bindings: Split out function to invoke an action signal
...
We want to use that in shortcuts later.
2020-03-25 22:36:03 -04:00
Benjamin Otte
a232107122
shortcutcontroller: Introduce
...
This is a very barebones controller that currently does nothing but
activate the binding signals. Yay.
And because we have bindings on every widget (Yes, a GtkGrid has a
keybinding - 2 in fact), we need that controller everywhere.
2020-03-25 22:36:03 -04:00
Benjamin Otte
27834b04ae
bindings: Make gtk_binding_parse_signal() use GVariantBuilder
...
And because it's the last user of GtkBindingArg and
gtk_binding_entry_add_signall(), also remove those two.
2020-03-25 22:36:03 -04:00
Benjamin Otte
cbe207a8de
bindings: Parse into GVariantBuilder directly
...
Avoids the indirection via GtkBindingArg
2020-03-25 22:36:03 -04:00
Benjamin Otte
1cab5e03ca
bindings: Add gtk_binding_entry_add_signal_variant()
...
This function is the replacement for
gtk_binding_entry_add_signall().
The GVariant will be demarshalled and passed to the action signal upon
binding activation. The same rules apply as used to apply for
GtkBindingArg, in that long, double and string args are now replaced by
"x", "d" and "s" variant types.
2020-03-25 22:36:03 -04:00
Benjamin Otte
f8c523fa72
bindings: Replace GtkBindingArg arguments with GVariant
...
So far, this only replaces invocation, not yet parsing.
2020-03-25 22:36:03 -04:00
Matthias Clasen
e17db0abde
Merge branch 'matthiasc/for-master2' into 'master'
...
Matthiasc/for master2
See merge request GNOME/gtk!1568
2020-03-26 02:30:54 +00:00
Emmanuele Bassi
a9c3a33620
passwordentry: Remove unused include
2020-03-25 21:53:12 -04:00
Emmanuele Bassi
f61d520ab1
entry: Remove unused include
2020-03-25 21:53:06 -04:00
Matthias Clasen
7672e6c833
text view: Fix touch selection
...
We forgot to allocated that popover.
2020-03-25 18:48:01 -04:00
Matthias Clasen
faf61cd112
event controller focus: drop include
...
This header is not needed here, and it is going away.
2020-03-25 18:47:54 -04:00
Matthias Clasen
1308ecb0ae
flattenlistmodel: Give access to child models
...
Add an api to retrieve the model containing a given
item in a flatten listmodel. This is useful when the
individual items in the list don't have backpointers.
2020-03-25 18:47:46 -04:00
Matthias Clasen
4f6096947e
Merge branch 'matthiasc/for-master' into 'master'
...
Matthiasc/for master
See merge request GNOME/gtk!1565
2020-03-25 21:48:38 +00:00
Matthias Clasen
8493ebfe98
filechoosererrorstack: Fix object life-cycle
...
Unparent children in dispose, not in finalize.
2020-03-25 17:04:29 -04:00
Christian Hergert
b5b836668a
muxer: force muxer dispoal as part of widget dispose
...
We need to cleanup state here immediately so that we do not potentially
access the g_class private data after it been finalized. This ensures that
the borrowed reference is dropped by the muxer.
2020-03-25 14:02:59 -07:00
Timm Bäder
c155ac98c8
Merge branch 'wip/sadiq/fix-leak' into 'master'
...
singleselection: Fix a memory leak
See merge request GNOME/gtk!1554
2020-03-25 09:13:50 +00:00
Timm Bäder
600952e295
magnifier: Don't try to use a null widget paintable
...
We destroy the paintable in dispose, which can be called multiple times.
2020-03-24 10:44:06 +01:00
Timm Bäder
3b2adf5d1f
inspector: Fix child widget life cycle
...
unparent them in dispose
2020-03-24 10:44:06 +01:00
LingMan
29c9776daa
gtkfilechoosernative: Remove duplicate "the" in the documentation
2020-03-24 04:58:13 +00:00
Mohammed Sadiq
cfc44e09a0
singleselection: Fix a memory leak
2020-03-22 14:05:56 +05:30
Matthias Clasen
dabd09bc42
a11y: Don't re turn uninitialized memory
...
For some reason, this was now showing up in the
a11y tests as random image sizes in the about
dialog test.
2020-03-21 21:44:23 -04:00
Matthias Clasen
95209290c4
file chooser: Fix the rename file popover
...
Make this popover work again by attaching it
to the file chooser itself.
2020-03-21 20:14:23 -04:00
Matthias Clasen
90197240d3
filechooser: Fix the file list popover
...
Make this popover work again.
2020-03-21 20:00:15 -04:00
Matthias Clasen
6555a2f661
filechooser: Fix the new folder popover
...
We were listening for change notification on a
no-longer-existing property.
2020-03-21 19:32:08 -04:00
Matthias Clasen
a197b202b8
places sidebar: Fix the popovers
...
We need to check-resize the popovers.
2020-03-21 18:28:57 -04:00
Bastien Nocera
e99d1605dc
filechoosernativeportal: Allowing selecting folder(s)
...
Use the "directory" portal option when asked to select folders.
2020-03-21 15:46:05 -04:00
Matthias Clasen
245851a6bb
portal file chooser: Handle errors
...
Fall back to showing a local file chooser
if we get DBus errors from the portal.
Closes : #2527
2020-03-21 13:16:43 -04:00
Matthias Clasen
bb3dc16680
Merge branch 'fix-inspector-picking' into 'master'
...
inspector: Make picking work again
Closes #2528
See merge request GNOME/gtk!1549
2020-03-21 16:21:51 +00:00
Matthias Clasen
fd58b116cf
inspector: Make picking work again
...
We used to either make the inspector see- and click-thru
or lower it, but sadly translucency broke after we
removed surface opacity, and lowering doesn't work
on Wayland. So just hide the inspector window while
we are picking.
Fixes : #2528
2020-03-21 09:42:58 -04:00
Matthias Clasen
9259efb5d7
Make overline support conditional
...
The ci image does not have Pango 1.45, so for the
time being, make the overline support conditional
on Pango being new enough.
2020-03-21 01:18:54 -04:00
Matthias Clasen
795ef5b4e3
textbuffer: Parse overline and hyphenation attributes
...
When inserting Pango markup into a text buffer, translate
Pango attributes for overlines and hyphenation control
into the corresponding text tag properties.
2020-03-20 23:58:23 -04:00
Matthias Clasen
fd9c911c3a
textlayout: Handle new text tag properties
...
Translate tag properties for overlines and
hyphenation control into Pango attributes.
2020-03-20 23:58:23 -04:00
Matthias Clasen
a8c6ae6085
texttag: Support overline and hyphenation control
...
Add support for recently added Pango attributes
for overlines and hyphenation control. The new
properties of GtkTextTag are
overline, overline-rgba, allow-breaks, show-spaces
and insert-hyphens.
2020-03-20 23:58:23 -04:00
Carlos Garnacho
28e7a0a565
Merge branch 'master_MR1290' into 'master'
...
Copy of !1290 for master
Closes #2365
See merge request GNOME/gtk!1546
2020-03-20 20:20:41 +00:00
Christian Hergert
ccac404f28
widget: fix class private data usage to be _init() safe
...
Before this commit, adding GtkWidgetAction to class private data would
require copying the actions to each subclass as they were built or
modified. This was convenient in that it is a sort of "copy on write"
semantic.
However, due to the way that GTypeInstance works with base _init()
functions, the "g_class" pointer in GTypeInstance is updated as each
_init() function is called. That means you cannot access the subclasses
class private data, but only the parent class private data.
If instead we use a singly linked list of GtkWidgetAction, each subclass
has their own "head" yet all subclasses share the tail of the
GtkWidgetAction chain.
This creates one bit of complexity though. You need a stable way to know
which "bit" is the "enabled" bit of the action so we can track enabled
GAction state. That is easily solved by calculating the distance to the
end of the chain for a given action so that base classes sort ahead of
subclasses. Since the parent class always knows its parent's actions, the
position is stable.
A new dynamic bitarray helper also helps us avoid allocations in all the
current cases (up to 64 actions per widget) and dynamically switches to
malloc if that is to ever be exceeded.
2020-03-20 11:17:56 -07:00
Christian Hergert
6822dce8fb
widget: move class private data to gtkwidgetprivate.h
...
We want access to the private data from the action muxer so we can just
move the structures to the gtkwidgetprivate.h header. Alternatively we
could create accessors, but given that we'll probably need to use this
in other areas, seems reasonable to just put it there.
2020-03-20 11:17:56 -07:00
Alexandr Miloslavskiy
32f088e335
gkimmulticontext: Fix crash due to leaked signal handler
...
The problem is caused by gtk_im_multicontext_set_slave(), which forgets
to disconnect these signal handlers:
* gtk_im_multicontext_retrieve_surrounding_cb
* gtk_im_multicontext_delete_surrounding_cb
If slave GtkImContext emits signal after GtkIMMulticontext context is
destroyed, this leads to reading freed memory, sometimes causing a crash.
Fixes : #2365
2020-03-20 18:02:22 +01:00
Carlos Garnacho
23f03ca1f2
gtktextview: Set magnifier popover on top
...
At the bottom, it sometimes has to fight for the same position than
text handles, besides might not be ergonomically convenient (eg.
finger/hand partly covering the popover). Move it at the top to fix
both.
2020-03-20 15:52:19 +01:00
Carlos Garnacho
54a4a18bcf
gtktext: Set magnifier popover on top
...
At the bottom, it sometimes has to fight for the same position than
text handles, besides might not be ergonomically convenient (eg.
finger/hand partly covering the popover). Move it at the top to fix
both.
2020-03-20 15:52:19 +01:00
Carlos Garnacho
9a0b70fc84
gtkpopover: Re-present surface if position/pointing-to change while visible
...
This ensures the popover will follow the new position parameters. This is
necessary for popovers like the text magnifier that can be repositioned
while visible.
2020-03-20 15:52:19 +01:00
Carlos Garnacho
6431bdcf91
gtkpopover: Ensure the pointed to rectangle has a minimum w/h
...
On wayland, protocol errors will be raised if the rectangle width/height
are 0. Avoid that situation so it's valid to all popovers.
2020-03-20 15:52:19 +01:00
Carlos Garnacho
0f73e83f44
gtkwindow: Remove internal popover API
...
This was only used by text handles, and not anymore.
2020-03-20 15:52:19 +01:00
Carlos Garnacho
0264a64f29
gtktexthandle: Refactor and use native surfaces
...
Instead of being a GObject managing two GtkWidgets, make GtkTextHandle
a GtkWidget subclass, representing a single handle.
From the perspective of users (GtkText and GtkTextView), this is not a
big leap since they have to be aware of a great deal of text handles'
state. It actually makes things more direct and simple.
With text handles being widgets, those can be actual children of the
widget, and may have their own GdkSurface that we move around at will.
This is the second major aspect of this refactor.
2020-03-20 15:52:19 +01:00
Matthias Clasen
31db615885
Revert "Merge branch 'disable-window-test' into 'master'"
...
This reverts commit 3ac4c76b18
, reversing
changes made to 6ec96d2e98
.
2020-03-19 18:03:16 -04:00
Matthias Clasen
7d5cfcf61d
Fix a compiler warning
2020-03-19 14:13:26 -04:00
Matthias Clasen
fcab0943bf
text view: Fix touch selection
...
We forgot to allocated that popover.
2020-03-19 09:46:53 -04:00
Matthias Clasen
c8fd6407a8
widget: Drop the ::popup-menu signal
...
This is now done in widgets which have context
menus.
2020-03-19 00:56:46 -04:00
Matthias Clasen
53f29ba427
placesview: Stop using ::popup-menu
...
This signal is going away.
2020-03-19 00:54:23 -04:00
Matthias Clasen
eb3f4b302f
filechooser: Stop using ::popup-menu
...
This signal is going away.
2020-03-19 00:24:53 -04:00
Matthias Clasen
59df45f3f7
mountoperation: Stop using ::popup-menu
...
We can just use a shortcut controller directly.
2020-03-18 23:00:51 -04:00
Matthias Clasen
f40965cc40
colorchooser: Stop using ::popup-menu
...
This signal is going away. Use an action instead.
2020-03-18 23:00:51 -04:00
Matthias Clasen
ab9b094f80
range: Remove ::popup-menu emission
...
This signal is going away, and having context menus
on sliders is not really a thing anyway.
2020-03-18 23:00:51 -04:00
Matthias Clasen
4bc60c6110
scrollbar: Remove :popup-menu forwarding
...
This signal is going away.
2020-03-18 23:00:51 -04:00
Matthias Clasen
48ace13635
emojichooser: Stop using ::popup-menu
...
This signal is going away. Use an action instead.
2020-03-18 23:00:51 -04:00
Matthias Clasen
908d996b4f
Use an action for the context menu keybinding
...
The ::popup-menu signal is going away.
2020-03-18 23:00:51 -04:00
Matthias Clasen
4e263b4042
Print mnemonic triggers clearly
2020-03-18 23:00:51 -04:00
Matthias Clasen
f5134a833c
inspector: Show shortcuts
...
At a tab that lists the shortcuts contained in a
GtkShortcutController.
2020-03-18 23:00:51 -04:00
Matthias Clasen
f7021e80a7
Only create a class shortcut controller if we have shortcuts
...
No point in creating objects that just hold empty lists.
2020-03-18 23:00:51 -04:00
Matthias Clasen
3e7d49a8d3
widget: Name the controllers
2020-03-18 23:00:51 -04:00
Matthias Clasen
5a6533d8fb
window: Name the the controllers
2020-03-18 23:00:51 -04:00
Matthias Clasen
5a6a9dc149
shortcutmanager: Name the controllers
...
This is helpful in the inspector.
2020-03-18 23:00:51 -04:00
Matthias Clasen
ad69899a9d
Move shortcut manager initialization code
...
It is just too ugly to use quarks across multiple
source files, so add a private helper function that
attaches the controllers.
2020-03-18 23:00:51 -04:00
Benjamin Otte
3cf56817e7
filechooser: Trigger the location popup via bindings
...
Simplifies code quite a bit.
2020-03-18 23:00:51 -04:00
Benjamin Otte
ff6df33b6a
accels: Remove GtkAccelGroup
2020-03-18 23:00:51 -04:00
Benjamin Otte
17d9ba362c
widget: Remove gtk_widget_add_accelerator()
...
People should use shortcut controllers instead (global, capture).
A side effect of this is that GtkAccelLabel now lost its method to
magically look up accelerators to display. Somebody needs to add that
back later.
2020-03-18 23:00:51 -04:00
Benjamin Otte
29ced09dc4
shortcutcontroller: Implement GtkBuildable
...
Use it to allow adding shortcuts to the controller via the usual <child>
method.
2020-03-18 23:00:51 -04:00
Benjamin Otte
458fcba457
shortcutaction: INtegrate with GtkBuilder property parsing
...
<property name="action">action(win.quit)</property> style action
specifications now work for GtkShortcutAction properties.
2020-03-18 23:00:51 -04:00
Benjamin Otte
5218dd6a34
shortcuttrigger: Add gtk_shortcut_triger_new_parse_string()
...
And hook it up into the GtkBuilder infrastructure.
2020-03-18 23:00:51 -04:00
Benjamin Otte
df792a088d
application: Replace accelerator handling with shortcuts
...
API remains the same, but activation is now done via a
shortcutcontroller.
The code uses a controller with global scope so that the
shortcuts are managed with all the other global shortcuts.
2020-03-18 23:00:51 -04:00
Benjamin Otte
94ef20ea36
accel: Add display arg to gtk_accelerator_parse_with_keycode()
...
It was using the default display unconditionally.
2020-03-18 23:00:51 -04:00
Benjamin Otte
87df17e4ce
accelerators: Make gtk_accelerator_parse() return TRUE/FALSE
...
A parse function should return success or not. So do that.
2020-03-18 23:00:51 -04:00
Benjamin Otte
673a0463e0
shortcuttrigger: Add hash(), equal(), and compare() functions
...
Those are useful for putting triggers in hash tables or getting sorted
output.
2020-03-18 23:00:51 -04:00
Benjamin Otte
0c81698911
shortcuts: Mananage managed shortcuts with a custom model
...
Reduce the amount of special casing by using a list model
for global and managed shortcuts, too.
This way, the ListModel API will work for the ShortcutController in the
GtkShortcutManager and GtkRoot.
The only special case remaining is shortcut activation, which needs to
pass the right widget to the controller in the global/managed case.
2020-03-18 23:00:51 -04:00
Benjamin Otte
a10a295515
shortcutaction: Add gtk_shortcut_action_to_string()
...
For all but the callback action, we can print something useful.
2020-03-18 23:00:51 -04:00
Benjamin Otte
3b595f5720
widget: Keep keybindings as a GListStore
...
This way, we can use shortcut_controller_new_for_model() and avoid all
the special casing about run_class.
2020-03-18 23:00:51 -04:00
Benjamin Otte
d14807b93d
shortcutcontroller: Add gtk_shortcut_controller_new_for_model()
...
This is mainly for internal use, but I can't see a reason to not have it
public for people who want to maintain their own lists.
I'm sure gnome-builder will never ever find a way to misuse it.
2020-03-18 23:00:51 -04:00
Benjamin Otte
538a1a0461
shortcutcontroller: Implement GListModel
...
After all, this controller is a list of shortcuts.
2020-03-18 23:00:51 -04:00
Benjamin Otte
4a4bfa0766
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.
2020-03-18 23:00:51 -04:00
Benjamin Otte
e6d0560a82
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
2020-03-18 23:00:51 -04:00
Benjamin Otte
4d0bab0c24
accelgroup: Remove unneeded APIs
...
After the removal of GtkAccelMap, these things are no longer necessary.
2020-03-18 23:00:51 -04:00
Emmanuele Bassi
b28da74e90
gtk: Remove GtkAccelMap
...
Now that accel paths are gone, the object managing them isn't needed
anymore either.
2020-03-18 23:00:51 -04:00
Benjamin Otte
ba3882de83
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.
2020-03-18 23:00:51 -04:00
Benjamin Otte
20cfa2e280
Remove GtkMnemonicHash
...
It's not used anymore.
2020-03-18 23:00:51 -04:00
Emmanuele Bassi
a977094e18
window: Remove all old mnemonic handling API
2020-03-18 23:00:51 -04:00
Emmanuele Bassi
09400b6bfe
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-18 23:00:50 -04:00
Benjamin Otte
bbe98d9f7c
label: Implement mnemonics using shortcuts
2020-03-18 23:00:50 -04:00
Benjamin Otte
ab681b0e05
shortcut: Add gtk_shortcut_set_mnemonic_activate()
...
Makes the shortcut call gtk_widget_mnemonic_activate() upon activation.
2020-03-18 23:00:50 -04:00
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