Commit Graph

37711 Commits

Author SHA1 Message Date
Jonas Ådahl
a798edc360 gtk/window: Only deal with shadow when (ex|in)cluding csd size
The size should correspond what gtk_widget_measure() does, and it
measures what's within the window excluding the shadow; so make this
helper function correspond to this.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
14b5a5a4c7 gtk/window: Remove gtk_window_resize()
Use gtk_window_set_default_size() or change the size of the widget
inside the window to get the same effect.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
deb58339b9 gtk/expander: Remove manual call to gtk_window_resize()
It happens implicitly for a non-resizeable window.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
ecd40fa265 wayland: Layout drag icon from GdkSurface::layout 2020-12-07 09:46:39 +01:00
Jonas Ådahl
3b140a05a4 gtk/dragicon: Don't show until child is set
Showing before the child would result in bogus
gdk_drag_surface_present() with an "empty" (1x1) size. This can easily
be avoided by postponing showing until there is anything to show.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
d38f81999e wayland: Communicate popup layout changes via GdkSurface::layout
By moving popup layout emission to the layout phase, the current
GdkPopup::poup-layout-changed signal has no value on its own as it'd be
ignored by GtkPopover.

Make the Wayland backend communicate the popup layout changes via the
common signal; but leave the rest intact until other backends catch up.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
ecc861bf06 Pass the layout signal via GdkSurface to GtkRoot
Don't have GtkRoot listen directly to the layout signal on the frame
clock, but let it pass through GdkSurface. This will allow GdkSurface to
be more involved in the layout phase.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
0c8d97e3f7 gtk/root: Validate css node after update
It should happen before layout, but after the animation tick, thus after
the update.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
13b4a4b24c gdk/toplevelsize: Add way to set margin
Will be used to communicate the shadow margin, instead of using
gdk_surface_set_shadow_width().

Also set these values in gtkwindow.c.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
8f27b3fcf6 gtk/window: Let the backend handle toplevel freezing 2020-12-07 09:46:39 +01:00
Jonas Ådahl
996eeec16c gtk/window: Don't gdk_toplevel_present() if not mapped
That would map the window too early.
2020-12-07 09:46:39 +01:00
Michael Terry
c8d991e4de wayland: avoid referencing unallocated memory when uninhibiting 2020-12-06 18:37:40 -05:00
Emmanuele Bassi
d8c9a67d20 docs: Clarify gtk_widget_activate()
We need to tell people what signal will be emitted when calling
gtk_widget_activate(), and that the shortcuts API might be more
appropriate to what they are looking for.
2020-12-06 15:13:57 +00:00
Emmanuele Bassi
c352fe9ab0 Move activate_signal to the widget private class data
Instead of having it as a field in the class structure.
2020-12-06 15:06:18 +00:00
Emmanuele Bassi
f6c53ced0d a11y: Plug a leak in the AT-SPI context
Fixes: #3450
2020-12-05 20:25:30 +00:00
Matthias Clasen
894f893223 Merge branch 'revert-round-windows' into 'master'
Revert "theme: Round all window corners"

See merge request GNOME/gtk!2921
2020-12-05 15:10:16 +00:00
Emmanuele Bassi
3a9cca74fc Use WidgetClass.activate_signal getter function 2020-12-05 01:04:18 +00:00
Emmanuele Bassi
fe9c0db603 Add getter for WidgetClass.activate_signal
Just like we have a setter.
2020-12-05 01:04:18 +00:00
Emmanuele Bassi
fde32c5219 Use private can_activate() method
Instead of checking the activate_signal field directly.
2020-12-05 01:04:18 +00:00
Emmanuele Bassi
213024a560 Use function setter for WidgetClass.activate_signal 2020-12-05 01:04:18 +00:00
Emmanuele Bassi
e5e18ddffb Add private method to check activatability
We should have an actual method, instead of checking the
WidgetClass.activate_signal directly.
2020-12-05 01:04:18 +00:00
Emmanuele Bassi
b3e03fa6f0 Add wrappers for setting the WidgetClass.activate_signal field
Setting a field on a class structure is not always an easy task from
languages other than C. While bindings can provide access to the class
pointer, twiddling the fields in the class structure can be awkward.
Additionally, signal ids are not always readily available.

We can paper over the direct access to the class structure, as well as
the "signal name to id" mapping with a simple couple of setter
functions.
2020-12-05 01:04:18 +00:00
Jean Felder
4430314514 customsorter: Add missing nullable annotation 2020-12-05 00:04:36 +01:00
Matthias Clasen
24124452d5 docs: Fix up GtkPicture docs
These were missing proper linking.
2020-12-04 11:47:43 -05:00
Matthias Clasen
0dff89d9fb Revert "theme: Round all window corners"
This reverts commit e46522e4b5.
2020-12-04 11:13:26 -05:00
Matthias Clasen
f0f64f42ee emoji chooser: Fix incremental loading
This broke when we started using GDK_PROFILER_CURRENT_TIME for
timekeeping - that gets defined to 0 when we're building without
sysprof, so we can use it to make such determinations. Go back
to using g_get_monotonic_time().

Fixes: #3438
2020-12-04 11:09:43 -05:00
Benjamin Otte
66c3a43e96 Add docs about sizing pictures
Suggested by Christopher Davis.
2020-12-04 02:04:19 +00:00
Matthias Clasen
6ecae6c5f8 Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
macos: fix motion event delivery after closing transient window

Closes #3419

See merge request GNOME/gtk!2910
2020-12-03 20:07:16 +00:00
Corentin Noël
585ba777c2 build: Use the correct path to the header of the wayland and x11 backends 2020-12-03 10:02:03 +01:00
Matthias Clasen
35d2cbefe6 Merge branch 'wip/otte/conic' into 'master'
Add support for conic gradients

See merge request GNOME/gtk!2911
2020-12-03 03:54:24 +00:00
Christian Hergert
004f0a6596 macos: plug leak of application windows
This ensures that we don't leak window references inside the action muxer.
Otherwise, we risk not disposing the windows upon gtk_window_destroy()
and blocking the main loop from quitting.

Fixes #3419
2020-12-02 19:44:02 -08:00
Christian Hergert
b68e0bb3fb muxer: add helper to get group by name
This is useful when you need to read a group back out of the muxer.
2020-12-02 19:44:02 -08:00
Matthias Clasen
6e67d44aa3 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3429

See merge request GNOME/gtk!2912
2020-12-03 03:43:19 +00:00
Benjamin Otte
e622013f7e css: Add support for conic-gradient()
This comes complete with animation support. For a good time, try:

@keyframes conic {
  100% { background-image: conic-gradient(from 1turn, red, lime, blue, yellow, red); }
}

window {
  background-image: conic-gradient(red, lime, blue, yellow, red);
  animation: conic infinite linear 5s;
}
2020-12-03 04:13:33 +01:00
Benjamin Otte
3886f0c530 Merge branch 'wip/otte/diediedie' into 'master'
Remove GtkFileChooserButton

See merge request GNOME/gtk!2909
2020-12-03 01:31:39 +00:00
Benjamin Otte
eb9c204535 gtk: Remove GtkFileChooserButton
... as discussed in the meeting.
2020-12-03 02:02:27 +01:00
Matthias Clasen
ab9e99218f docs: Remove mentions of <accelerator>
That is no longer supported, keyboard shortcuts
are done with GtkShortcut now.

Fixes: #3429
2020-12-02 19:59:44 -05:00
Benjamin Otte
8706d69e60 snapshot: Add gsk_snapshot_append_conic_gradient() 2020-12-03 01:15:53 +01:00
Benjamin Otte
55a242bd81 gsk: Add GskConicGradientNode 2020-12-03 00:47:54 +01:00
Emmanuele Bassi
0c8de4e561 Fix transfer of GtkTreeExpander.get_item()
We return a full reference to the item.

Fixes: #3428
2020-12-02 19:10:13 +00:00
Emmanuele Bassi
13f9993007 docs: Add missing fields to GtkTextBufferClass 2020-12-02 19:05:41 +00:00
Emmanuele Bassi
2e146a56f7 docs: Mark GtkModelButton's section as private
The widget is not public any more.
2020-12-02 19:05:41 +00:00
Bilal Elmoussaoui
475352fbc0 StringList: add missing nullability annotations 2020-12-02 10:36:29 -05:00
Bilal Elmoussaoui
ad30ac3932 Shortcut: add missing nullability annotations 2020-12-02 10:29:16 -05:00
Bilal Elmoussaoui
9d52ca1887 StringFilter: get_search fix nullable annotation 2020-12-02 10:28:07 -05:00
Bilal Elmoussaoui
ec537d75e4 Text: add missing nullability annotations 2020-12-02 10:28:07 -05:00
Bilal Elmoussaoui
b47ea9421f TextView: add missing nullability annotations 2020-12-02 10:28:07 -05:00
Bilal Elmoussaoui
845d2e5433 TreeModel: add missing nullability annotations 2020-12-02 10:28:07 -05:00
Bilal Elmoussaoui
50310f7b14 TreeView: add missing nullability annotations 2020-12-02 10:28:07 -05:00
Matthias Clasen
af944aa74c widget: Add a missing nullability annotation 2020-12-02 10:08:58 -05:00
Matthias Clasen
b5077d02ed Clarify the docs for gtk_widget_class_set_css_name
Reword, and mention the default css name.
2020-12-02 10:06:01 -05:00
Bilal Elmoussaoui
6a3bd1c4d1 window: default_icon_name can be null 2020-12-02 10:00:18 -05:00
Emmanuele Bassi
69b1b19315 docs: Annotate missing symbols 2020-12-01 17:28:16 +00:00
Emmanuele Bassi
516f71bbdc Use the appropriate prefix for GtkBuilderClosureFlags
Facilitate the job of glib-mkenums, and ensure that the enumeration
nicknames are computed reliably.
2020-12-01 17:26:34 +00:00
Emmanuele Bassi
d820fea7a4 docs: Annotate GtkBuildableParser 2020-12-01 17:21:45 +00:00
Emmanuele Bassi
3e8d157118 docs: Hide GtkBitsetIter fields 2020-12-01 17:18:38 +00:00
Emmanuele Bassi
67f45940ce docs: Annotate GtkAssistant::escape action signal 2020-12-01 17:18:23 +00:00
Emmanuele Bassi
95400e6451 docs: Annotate GtkAppChooserButton::changed 2020-12-01 17:16:05 +00:00
Emmanuele Bassi
4f67be1c8e docs: Add missing annotations for GtkTextTagTable 2020-12-01 15:51:52 +00:00
Emmanuele Bassi
c13e164f25 Make GtkCenterLayout accessors more idiomatic
Add argument validation, and emit a layout-changed signal whenever the
start, center, and end widgets change.
2020-12-01 15:51:52 +00:00
Emmanuele Bassi
eba8f36d4f docs: Fix annotations in GtkCenterLayout
Missing ':' separator.
2020-12-01 15:51:52 +00:00
Matthias Clasen
617d12fd77 Merge branch 'sophie-h/gtk-nullables-2'
Merge Sophie's nullable annotations, with some documentation
fixups on top.
2020-11-30 23:43:44 -05:00
Matthias Clasen
837f398a9b columnviewcolumn: Improve docs
Mention what setting sorter to NULL means.
2020-11-30 23:40:03 -05:00
Matthias Clasen
e18211deca centerlayout: Improve docs
Explain what passing NULL does.
2020-11-30 23:36:23 -05:00
Matthias Clasen
365afa381a Merge branch 'arnaudb/annotate-set-title' into 'master'
Add "nullable" annotation.

See merge request GNOME/gtk!2895
2020-11-30 21:14:28 +00:00
Matthias Clasen
39f0c48eb2 Apply 1 suggestion(s) to 1 file(s) 2020-11-30 17:44:30 +00:00
Matthias Clasen
7d24e1405e Apply 1 suggestion(s) to 1 file(s) 2020-11-30 17:42:39 +00:00
Matthias Clasen
f309fa21c9 build: Use link_whole for linking our convenience libs
Without this, we lose exported symbols from e.g. libgsk
that are not used elsewhere in the code.
2020-11-30 09:56:55 -05:00
Timm Bäder
dc13ff97e2 modelbutton: Reset active menu item on pointer leave
We don't want to leave an active menu item behind if the pointer doesn't
enter another menu item.
This matches the old GtkMenu behavior
2020-11-30 09:23:03 -05:00
Timm Bäder
af28237569 popovermenu: Connect to right controller signal
leave is emitted before the new contains-pointer value is set, so the
signal handler wasn't working right.
2020-11-30 09:22:57 -05:00
Timm Bäder
ff8de0a93f eventcontrollermotion: Notify by pspec 2020-11-30 09:22:49 -05:00
Timm Bäder
aefabcc056 popovermenu: Pull variable declaration in closest scope 2020-11-30 09:22:41 -05:00
Timm Bäder
1d6c6fc3b8 shortcutcontroller: Separate trigger/action early returns
We take this early return in update_accel over 36k times when starting
the widget factory and always because the action is not a named action.
2020-11-30 09:22:34 -05:00
Timm Bäder
8645773fc6 shortcutcontroller: Pass the muxer to update_accel()
We only needed the widget to get its action muxer. And this way we don't
have to call gtk_widget_get_action_muxer() dozens of times, just once in
set_widget().
2020-11-30 09:22:29 -05:00
Timm Bäder
d663909159 shortcutcontroller: Use priv->shortcuts directly in set_widget()
Instead of treating the shortcut controller itself as a GListModel,
which just passes everything along from priv->shortcuts.
2020-11-30 09:22:21 -05:00
Timm Bäder
e3ff92bc87 shortcutcontroller: Save signal handler ID
gtk_shortcut_controller_finalize() used to take ~13.8% when closing the
complex listbox demo in gtk4-demo. Now it takes nothing.
2020-11-30 09:21:57 -05:00
Timm Bäder
2d43ecf8ca widget: root child before emitting child observer signals
Try to avoid the childen_observer signal handlers screwing up internal
state.

Fixes #3364
2020-11-30 09:21:52 -05:00
Timm Bäder
5f4beb711f widgetprivate: Remove unused function 2020-11-30 09:21:42 -05:00
Matthias Clasen
8cf4ce5d9e Merge branch 'ebassi/cell-renderer-get-size' into 'master'
Remove GtkCellRendererClass.get_size()

See merge request GNOME/gtk!2896
2020-11-30 14:09:03 +00:00
Emmanuele Bassi
09b6c37e1d Merge branch 'ebassi/for-master' into 'master'
Blend nodes might have NULL top/bottom nodes

See merge request GNOME/gtk!2891
2020-11-30 13:10:25 +00:00
Emmanuele Bassi
60a7830ba5 Remove GtkCellRendererClass.get_size()
The get_size() vfuncs is deprecated in GTK3, and only used as a
fallback path for cell renderers that do not implement preferred
size virtual functions.
2020-11-28 19:21:24 +00:00
Emmanuele Bassi
ac473282a2 Port CellRendererGraph to preferred size vfuncs
Drop use of GtkCellRendererClass.get_size()
2020-11-28 19:21:24 +00:00
Emmanuele Bassi
20f9e0f144 Port GtkCellRendererProgress to preferred size vfuncs
Drop the use of GtkCellRendererClass.get_size()
2020-11-28 19:21:24 +00:00
Emmanuele Bassi
71a9e5d8c2 Port GtkCellRendererToggle to preferred size vfuncs
Drop the use of GtkCellRendererClass.get_size()
2020-11-28 19:21:24 +00:00
Emmanuele Bassi
a605fcc2bd Port GtkCellRendererSpinner to preferred size vfuncs
Drop the use of GtkCellRendererClass.get_size()
2020-11-28 19:21:23 +00:00
Emmanuele Bassi
3eaebf1e0b Port GtkCellRendererPixbuf to preferred size vfuncs
Drop the GtkCellRendererClass.get_size() override.
2020-11-28 19:21:23 +00:00
Arnaud Bonatti
55ce61d1a8 Add "nullable" annotation. 2020-11-28 12:15:38 +01:00
Jakub Steiner
bbbcc72460 Adwaita,HC: use dark prelights
- increase :hover visibility by going darker rather than lighter
  puppies died.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3380
2020-11-27 18:17:12 +01:00
Emmanuele Bassi
247fc2e471 Blend nodes might have NULL top/bottom nodes
We have code in place to handle a NULL node in the state when dealing
with blend nodes, but we don't always check for NULL, which leads to
warnings in the CSS Blend modes demo.
2020-11-26 00:21:11 +00:00
Matthias Clasen
9d2ca90b4c popover: Fix a typo
s/Wether/Whether/

Fixes #3393
2020-11-25 13:59:16 -05:00
Emmanuele Bassi
16b5a88097 a11y: Check before disconnecting Text signals
Use the same initial check for the accessible object type that we use
when connecting the signal, in case we try to disconnect signals on
different widgets. Additionally, check before accessing data that might
have already been removed.

Fixes: #3403
2020-11-25 18:15:04 +00:00
Emmanuele Bassi
fdf2e046c3 a11y: Check before disconnecting selection signals
If the selection data has already been cleared we should just bail out.

Fixes: #3404
2020-11-25 18:13:54 +00:00
Jakub Steiner
399b457f54 Adwaita: darker selected menuitem + sidebars
- without sacrificing the fg/bg contrast too much, increase
  selected item visibility

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3390
2020-11-25 14:28:19 +01:00
Sophie Herold
fed734edfc Fix some nullable return annotations 2 2020-11-24 19:27:33 +01:00
Christian Hergert
1e994419ee textview: fix precondition assertions
It is a programmer error to call this with a child widget that has not
been placed within the GtkTextView.

Fixes #3386
2020-11-24 08:29:52 -08:00
Matthias Clasen
b75b359f19 Drop devel styling from our windows
We are about to do a stable release. Time to get used
again to plain old, boring header bars.
2020-11-23 12:10:01 -05:00
Emmanuele Bassi
ef86e46238 a11y: Cache the accessibility bus address
Just check for it once; doing it every time we failed to create an
ATContext is just going to fill up the logs.
2020-11-23 14:34:46 +00:00
Emmanuele Bassi
0a46baeb56 a11y: Turn critical warnings into debug messages
The accessibility bus might not be available, and if it isn't the case,
it means something has failed at a level where the user can't do much
about it. There's no need to emit a critical warning.
2020-11-23 14:34:46 +00:00
Emmanuele Bassi
1f44319588 Drop redundant dependencies
PangoCairo already depends on Pango; Cairo-gobject already depends on
Cairo.
2020-11-23 13:04:11 +00:00
Emmanuele Bassi
505478bc59 Drop GLib dependency from GTK's declared dependencies
We depend on GObject, which already depends on GLib; on older versions
of Meson, this ends up trying to depend on the system copy of GLib,
instead of the sub-project copy, in case the version of GLib we have
installed is too old.
2020-11-23 12:29:32 +00:00
Emmanuele Bassi
3a1b2083d6 Do not depend on GLib API introduced after 2.66
To avoid bleeding edge deprecations we use GLIB_VERSION_MIN_REQUIRED and
GLIB_VERSION_MAX_ALLOWED. Since we depend on GLib 2.66, we cannot use
API introduced in 2.67, even when conditionally compiled.
2020-11-23 12:06:22 +00:00
nana-4
61dcb685b2 Adwaita: Unify sidebar background-color
The sidebar item style is already unified. The sidebar background-color
should be unified as well.

See https://gitlab.gnome.org/GNOME/gtk/-/issues/3382
2020-11-23 10:51:58 +01:00
nana-4
bd0d75e237 Adwaita: Make sidebar row styling better
- Reorder declaration blocks for code legibility.
- Don't lighten text color on :hover and :selected for better contrast.
- Add missing :focus-visible:focus-within styling to non-:selected row.
2020-11-23 10:51:58 +01:00
nana-4
179fc68355 Adwaita: Fix some sidebar sizing
- Don't set the sidebar padding twice.
- Add padding to the assistant sidebar directly, as it doesn't have
  .navigation-sidebar internally.
- Set missing margin to the sidebar separator.

See https://gitlab.gnome.org/GNOME/gtk/-/issues/3382
2020-11-23 10:51:58 +01:00
nana-4
9828756e05 Adwaita: Move placessidebar-specific sizing from .navigation-sidebar
The common .navigation-sidebar styling should be more generic.
2020-11-23 10:51:58 +01:00
nana-4
40f2b49c0d Adwaita: Make treeexpander styling generic
The widget can be used outside .navigation-sidebar.

This also fixes the label misalignment in the widget.
2020-11-23 10:51:58 +01:00
nana-4
8e81cbef2c stacksidebar: Add missing .navigation-sidebar to the inner list
Also don't set :show-separators, which is not applied in other sidebars.

See https://gitlab.gnome.org/GNOME/gtk/-/issues/3382
2020-11-23 10:51:58 +01:00
Bilal Elmoussaoui
46601325f1 properly set ScaleButton's parent_class
GtkScaleButton doesn't subclass GtkButton anymore
Fixes #3381
2020-11-23 02:47:12 +01:00
Sophie Herold
1e01b9079d Fix some nullable return annotations 2020-11-21 16:33:40 +01:00
Jakub Steiner
ab163f168d Merge branch 'wip/jimmac/clipped-menu-shadows' into 'master'
Adwaita: avoid clipping menu shadows

Closes #1987

See merge request GNOME/gtk!2872
2020-11-20 12:37:49 +00:00
Jakub Steiner
e937f7eac8 Revert "Adwaita: unified sidebar styles"
Doing the same mistake twice :( Even margin is eating from the container,
not expanding outside of it.

This reverts commit 6be575992f.
2020-11-20 13:24:23 +01:00
Jakub Steiner
b84945e43f Merge branch 'wip/jimmac/sidebar-backdrop' into 'master'
Adwaita: don't backdrop labels

Closes #3377

See merge request GNOME/gtk!2868
2020-11-20 12:08:59 +00:00
Jakub Steiner
b3dba1dca6 Adwaita: avoid clipping menu shadows
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/1987
2020-11-20 13:04:04 +01:00
Jakub Steiner
6be575992f Adwaita: unified sidebar styles
- stacksidebar focus, separation and color as everything else
- eliminate placessidebar double padding

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3382
2020-11-20 12:24:40 +01:00
Jakub Steiner
4bec75c66b Adwaita: don't backdrop labels
- instead of overriding :backdrop for sidebars, continue pursuing
  not to backdrop anything but headerbar items and buttons.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3377
2020-11-20 09:34:23 +01:00
Matthias Clasen
8e4cc59a7a Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2870
2020-11-20 02:02:10 +00:00
Carlos Garnacho
5ab14ff7f6 gtk/main: Do not unset active state on button release w/o implicit grab
If an active grab gets undone on button press (e.g. closing a menu), we
will receive a button release on the new target even though it didn't handle
the button press, and disable ::active state.

This causes warnings when handling the button release, as it tries to undo
::active state that is not really there.

In order to fix this, check that the pointer focus actually had an implicit
grab at the time of receiving the button release, before trying to unset
the ::active state.
2020-11-19 22:58:14 +01:00
Emmanuele Bassi
8482b956d6 Merge branch 'ebassi/for-master' into 'master'
Ebassi/for master

See merge request GNOME/gtk!2867
2020-11-19 16:37:58 +00:00
Matthias Clasen
562c7b1ff3 Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
GTK4: various fixes

See merge request GNOME/gtk!2864
2020-11-19 16:05:47 +00:00
Emmanuele Bassi
e600a07237 a11y: Skip atspi.Cache signals for hidden elements
If the accessible object is hidden, we can skip the emission of the
AddAccessible and RemoveAccessible signals on the cache, as those
objects won't be visible in the accessibility tree.
2020-11-19 15:20:56 +00:00
Emmanuele Bassi
8fa58c2e17 a11y: Get the accessible role once
Simplify getting the accessible role when checking if an accessible
implementation should present itself; this avoids going through
GtkAccessible twice to get the same data.
2020-11-19 15:20:56 +00:00
Emmanuele Bassi
d436c2e839 a11y: Remove weak ref from atspi.Cache
The GtkAtSpiContext is responsible for removing itself from the root,
which will remove itself from the cache. Any code path that leads to the
GtkAtSpiContext instance being collected passes through the
unrealization phase, which will also unregister the context from the
accessibility bus and from the cache.
2020-11-19 15:20:56 +00:00
Emmanuele Bassi
b37634dcd5 a11y: Add a fallback for the root base path
In case g_get_prgname() returns NULL, which seems to be the case for the
GTK tests.
2020-11-19 15:20:56 +00:00
Emmanuele Bassi
2d636fdda0 a11y: Reuse the generated AT-SPI interface name
We already have the name available.
2020-11-19 15:20:56 +00:00
Emmanuele Bassi
28095641c5 a11y: Use the appropriate GVariant for cache signals
We need to wrap the argument for AddAccessible and RemoveAccessible into
a tuple, as that's what GDBus expects.
2020-11-19 12:14:55 +00:00
Jakub Steiner
d58b06ceeb Adwaita: revert edge-to-edge menuitems
- use the old Industrial style menuitems to make the design feel purposeful
- adjust corners to have compatible border-radii of child elements
- include sidebars and navigation sidebars to look consistent
  (plus the assistant sidebar)

Implements https://gitlab.gnome.org/GNOME/gtk/-/issues/3366
2020-11-19 11:16:28 +01:00
Christian Hergert
0d2ea14ac1 types: fix various use of volatile in type registration
The use of volatile was incorrect in GLib and has been that way for
a long time. Recently however that has changed, and this makes GTK
follow suit to avoid using volatile in the type registration.

See also: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Combined with the above merge request for GLib, this fixes a large
number of compilation warnings when using Clang.
2020-11-18 20:21:33 -08:00
Christian Hergert
f32ae2964a macos: fix various compiler warnings 2020-11-18 20:16:37 -08:00
Matthias Clasen
86d7ab7c50 docs: Update GtkSensitivityType docs
Don't talk about steppers here, since we are only using
this type for combobox buttons nowadays.
2020-11-18 18:18:31 -05:00
Matthias Clasen
88be92ceee scrollbar: Don't talk about steppers
There steppers were lost on the way from GtkRange
to GtkScrollbar, so don't talk about them in the docs.
2020-11-18 17:27:13 -05:00
Matthias Clasen
76b8676955 constraintlayout: Fix parsing of constant constraints
We were inadvertently turning constant constraints into
constraints against super, due to confusion between target
and source attribute.
2020-11-17 23:11:16 -05:00
Matthias Clasen
ba081bf119 Merge branch 'fix-doc-packtype' into 'master'
doc: Adapt GtkPackType documentation to GTK4 changes

See merge request GNOME/gtk!2858
2020-11-17 22:46:43 +00:00
Matthias Clasen
c1e05e7c52 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3278

See merge request GNOME/gtk!2856
2020-11-17 19:25:05 +00:00
Matthias Clasen
6b475aacd2 Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
inspector: handle differences in DPI between backends

See merge request GNOME/gtk!2857
2020-11-17 19:24:47 +00:00
vanadiae
bc4969ec42 doc: Adapt GtkPackType documentation to GTK4 changes
Since GTK4, the functions that used the GtkPackType enumeration,
`gtk_box_pack_{start,end}`, were replaced by `gtk_box_{append,prepend}`,
hence this enumeration isn't used anymore by any function within the
GtkBox type, and the child packing properties were also removed for GTK4.
So this commit adapts the documentation accordingly.
2020-11-17 20:19:16 +01:00
Benjamin Otte
1c7daece7a Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!2855
2020-11-17 19:08:01 +00:00
Christian Hergert
37a8c138f9 inspector: handle differences in DPI between backends
This fixes an issue on macOS where the text gets much larger once opening
the inspector.
2020-11-17 10:45:25 -08:00
Matthias Clasen
34d547a2aa inspector: Limit the width of readonly properties
For readonly properties, we show the serialized value
in a label. If we don't take precautions, this can cause
our window to grow extremely wide, and break things.
So, ellipsize things at a reasonable size.

Fixes: #3278
2020-11-17 13:36:57 -05:00
Benjamin Otte
163c04c101 snapshot: Add cleanup function to snapshot state
Otherwise we're leaking data in error cases.
2020-11-17 19:04:39 +01:00
Benjamin Otte
f2284ff40f rendernode: Rename all gsk_render_node_peek_*() functions
Those are getters, they should be gsk_render_node_get_*() functions.
2020-11-17 19:04:39 +01:00
Benjamin Otte
77f9efa747 textbuffer: Remove unused properties
The getters and setters were removed in
f53848c360 but the pspecs were forgotten.
2020-11-17 19:04:39 +01:00
Benjamin Otte
109ec523cb shortcut: Actions are objects 2020-11-17 19:04:39 +01:00
Emmanuele Bassi
5cc5022a8f Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
macos: bring forward quartz search engine updates

See merge request GNOME/gtk!2854
2020-11-17 17:58:14 +00:00
Emmanuele Bassi
3c769bb11d Merge branch 'ebassi/inout-args' into 'master'
Remove pointless inout arguments

See merge request GNOME/gtk!2853
2020-11-17 17:40:13 +00:00
Christian Hergert
33b07e4825 macos: bring forward quartz search engine updates
These were not cherry picked after GTK branched for 4 development.
2020-11-17 09:37:13 -08:00
Emmanuele Bassi
153c6424d3 Remove pointless inout arguments
GtkTreeView.get_tooltip_context() takes an inout X and Y coordinates,
but the "out" side is a side effect: the conversion from widget-relative
to bin window-relative coordinates is not documented, and can be done
using public API, if needed.

GtkIconView.get_tooltip_context() follows the same pattern, and takes
two inout arguments for the coordinates, but it does not change them any
more, after GtkIconView's bin window was dropped in commit 8dc5e13e.

There's really no point in having these `inout` arguments, and while
GtkTreeView and GtkIconView are certainly de-emphasised in GTK4, and we
nudge developers to move to the new list views, we should take advantage
of the API break to remove warts.
2020-11-17 16:38:12 +00:00
Emmanuele Bassi
b76e514322 Merge branch 'ebassi/for-master' into 'master'
Introspection fixes

Closes #3281

See merge request GNOME/gtk!2852
2020-11-17 16:04:03 +00:00
Jakub Steiner
1501aa0603 Revert "Adwaita: avoid clipping menu/popover shadow"
There are big side effects to adding padding around all menus and popovers.

https://gitlab.gnome.org/GNOME/gtk/-/issues/1987#note_963889

This reverts commit d266bd62de.
2020-11-17 16:53:32 +01:00
Emmanuele Bassi
cf5a173a4f Add type annotations for GtkShortcutAction types
The constructors and singleton getters need proper annotations for their
return type, given that we return a base type.
2020-11-17 14:17:26 +00:00
Emmanuele Bassi
4f12df5f1c Annotate the return type for GtkTreeExpander.get_item()
We use gpointer for C convenience, but the returned value is really a
GObject.
2020-11-17 13:54:22 +00:00
Matthias Clasen
2ef72442ec docs: Fix the links for keybinding signals
GtkBindingSignal does not exist anymore, so link to
GtkSignalAction for an explanation of keybinding signals.
2020-11-17 07:34:52 -05:00
Matthias Clasen
3bc2bf40a8 popover: Document signals 2020-11-17 07:34:52 -05:00
Matthias Clasen
cd4c0b6127 menubutton: Fix a gtk-doc complaint 2020-11-17 07:34:52 -05:00
Matthias Clasen
c2ae73f247 popover: Fix submenu navigation
In commit 024d832d94, we introduced a
cascade-popdown property that makes closing a submenu
propagate up and close its parent menus. This is the
behavior we want when a menuitem in the submen is
activated.

What we overlooked is that we still need to be able to
close a submenu during navigation, before opening another
one. And in this case, propagating the closing is breaking
things. Fix this by adding a private close_submenu api
to GtkPopoverMenu that avoids the propagation.

Fixes: #3301
2020-11-16 21:34:33 -05:00
Benjamin Otte
4b0b6100d6 build: Include GSK types in gtk_test_register_all_type() 2020-11-17 03:13:31 +01:00
Emmanuele Bassi
1d11d42aa0 Merge branch 'ebassi/for-master' into 'master'
Ebassi/for master

See merge request GNOME/gtk!2840
2020-11-16 23:06:55 +00:00
Matthias Clasen
50c29398e6 Merge branch 'wip/exalm/button' into 'master'
Allow pressing multiple buttons at once on touch

See merge request GNOME/gtk!2813
2020-11-16 20:16:10 +00:00
Jakub Steiner
dff8a9eb46 Merge branch 'wip/jimmac/popover-menu-submenus' into 'master'
Adwaita: fix up submenus again

See merge request GNOME/gtk!2845
2020-11-16 19:50:08 +00:00
Jakub Steiner
47e49acc7d Adwaita: fix up submenus again
- move menubar section under more generic popover.menu
  rather than resort to specificity dir(ltr) hacks
2020-11-16 19:48:11 +01:00
Jakub Steiner
0996b178dc Adwaita: circular button focus
- have the same focus look like the other items

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3368
2020-11-16 19:11:52 +01:00
Matthias Clasen
4befd13744 Merge branch 'wip/jimmac/spinbutton-spacing' into 'master'
Adwaita: spinbutton spacing

Closes #3370

See merge request GNOME/gtk!2841
2020-11-16 17:50:56 +00:00
Emmanuele Bassi
bb1463871c a11y: Ensure valid object paths in the fallback code
When falling back to using the program name to create a unique base path
for the objects on the accessibility bus we need to ensure that the name
is a valid DBus object path.
2020-11-16 17:47:15 +00:00
Jakub Steiner
108fe033aa Adwaita: spinbutton spacing
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3370
2020-11-16 18:22:17 +01:00
Emmanuele Bassi
9de2b4b0e1 a11y: Implement atspi.Cache
The AT-SPI cache interface is used to quickly populate the accessible
objects tree.

The tricky bit is ensuring that we emit change notifications on the
cache only when the cache is available, which means waiting until the
root is asynchronously registered.
2020-11-16 16:44:56 +00:00
Emmanuele Bassi
ee056fd8bd a11y: Update the Cache interface introspection
The type for cached items is, unsurprisingly, wrong when compared to the
implementation inside atk-spi2-atk.
2020-11-16 16:44:56 +00:00
Emmanuele Bassi
bc4f71a107 a11y: Add getters for GtkAtSpiContext
We are going to use them in order to implement atspi.Cache.
2020-11-16 16:44:56 +00:00
Emmanuele Bassi
125442297f a11y: Use the tab widget to label the notebook stack page 2020-11-16 16:44:56 +00:00
Emmanuele Bassi
eec92b40ea a11y: Compute the base path in the root object
The root path is shared by all AtSpiContext instances, so we should
compute it once, instead of every time we instantiate a new context.

This allows us to defer the path creation at realization time and ensure
that we have a registered application.
2020-11-16 16:44:56 +00:00
Emmanuele Bassi
d392f6f2a4 a11y: Resync the AT-SPI XML
Mostly just changes in the annotations coming from at-spi2-core, but
it's good to try and keep the XML in sync.
2020-11-16 16:44:56 +00:00
Jakub Steiner
22741a74ff Adwaita: circular buttons
- the vertical padding was thown off with the chin/forehead of menus removed
2020-11-16 15:21:46 +01:00
Jakub Steiner
d266bd62de Adwaita: avoid clipping menu/popover shadow
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/1987
2020-11-16 14:20:24 +01:00
Jakub Steiner
04d802f7f4 Adwaita: remove chin on menus
- clipping a rounded corner seems to be working fine for first and last item.

Addresses https://gitlab.gnome.org/GNOME/gtk/-/issues/3366
2020-11-16 13:31:27 +01:00
Jakub Steiner
994cc32d7b Merge branch 'wip/jimmac/subtle-sidebar' into 'master'
Adwaita: navigation sidebar color changes

Closes #3362

See merge request GNOME/gtk!2836
2020-11-16 09:34:36 +00:00
Jakub Steiner
f14ca28c4e Adwaita: navigation sidebar color changes
- use more subtle selected state grey

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3362
2020-11-16 10:17:57 +01:00
Matthias Clasen
6891f40110 modelbutton: Fix keynav for check and radio
The expected behavior when activating check or radio
menuitems via keynav is that Space toggles the item
but keeps the menu open, while Return toggles the
item and closes the menu.
2020-11-15 21:52:07 -05:00
Matthias Clasen
cdbf24c3af Merge branch 'fix-tooltip-trigger' into 'master'
Fix tooltip triggering

See merge request GNOME/gtk!2833
2020-11-15 17:37:47 +00:00
Matthias Clasen
b30715da6a Fix tooltip triggering
Ever since 5b5d2665d3, tooltips don't work properly,
since we get more motion events now, and those keep the
tooltips from appearing. This can be seen e.g. on the icon
in the password entry in widget-factory, or on the section
switcher buttons in the Emoji chooser.

Ignore synthetic motion events for the purposes of
determining whether the user moved the mouse.
2020-11-15 10:54:36 -05:00
Christoph Reiter
b97b95b0c7 gtkwidget: fix crashes with GTK_A11Y=none
at_context can be NULL in that case, so guard against it.

Fixes #3333
2020-11-15 15:59:31 +01:00
Matthias Clasen
dd0a854bbb Merge branch 'button-fill-var-removal' into 'master'
Adwaita: Stop using $button_fill

Closes #3354

See merge request GNOME/gtk!2828
2020-11-15 13:45:42 +00:00
Matthias Clasen
b8d0ad8643 Merge branch 'parse-debug-env-vars-always' into 'master'
Always parse GTK/GDK/GSK_DEBUG env vars and make some entries available in non-debug mode

See merge request GNOME/gtk!2830
2020-11-15 13:37:44 +00:00
Christoph Reiter
65d57877a8 Revert "Update comment annotations of gtk_tree_model_iter_previous and gtk_tree_model_iter_next to state that the ITER parameter is modified."
This reverts commit 1340ff2bc2.

Same as with 53cd499621
2020-11-15 13:36:42 +01:00
Christoph Reiter
afc73c38ce Always parse GTK/GDK/GSK_DEBUG env vars and make some entries available in non-debug mode
Currently GTK can be built with G_ENABLE_DEBUG which enables various debug code and parsing
of those env vars, or without, which instead of parsing them prints a warning if they are set.
While building with G_ENABLE_DEBUG isn't strictly needed it's the only way to make GTK_DEBUG=interactive work,
which is a nice thing to have always.

This enables parsing of those env vars in any case and allows specific values being marked as also
available when not built with G_ENABLE_DEBUG (interactive for example). If not built with G_ENABLE_DEBUG
then all unavailable values will be marked as such in the help output and a note is added that
GTK needs to be built with G_ENABLE_DEBUG to use them, which should help discoverability.
2020-11-15 11:34:54 +01:00
Carlos Garnacho
5b4ac5456e gtk/main: Reset active state on grab broken only if implicit
An implicit grab means some button is down, reset the active state
only in that case when we get a grab broken event.

Avoids active state accounting warnings when we do get active grabs
broken (e.g. after selecting a menu option).
2020-11-14 10:52:34 +01:00
nana-4
f1db73379e Adwaita: Stop using $button_fill
Since the $button_fill variables are no longer used outside of the
button() mixin (and it was for an ugly hack), there is no need to keep
that anymore.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3354
2020-11-14 10:13:05 +09:00
Matthias Clasen
20918dbe8e Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3359 and #3353

See merge request GNOME/gtk!2827
2020-11-14 00:15:34 +00:00
Matthias Clasen
b5ec20db88 Adwaita: Fix list separators
Commit bfe5b0d1b7 ran into some specificity
trouble.

Fixes: #3353
2020-11-13 17:18:05 -05:00
Matthias Clasen
d347df431d label: Avoid short-circuiting
Commit 0db504edde made a mistake described here:
https://en.wikipedia.org/wiki/Short-circuit_evaluation#Possible_problems

Fixes: #3359
2020-11-13 15:35:51 -05:00
Jakub Steiner
f45ea3fa90 Adwaita: tooltip styling
- balance padding
- increase border radius, yuck
- get rid of text shadow

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3352
2020-11-13 19:36:26 +01:00
Jakub Steiner
8a92ee03ea Adwaita: rounded submenus
- all corners have rounded corners

See https://gitlab.gnome.org/GNOME/gtk/-/issues/2745
2020-11-13 17:27:40 +01:00
Jakub Steiner
1f472104ad Adwaita: double declated $button_fill
- this was already in place in _common, no need to have it in _colors
2020-11-13 17:21:03 +01:00
Jakub Steiner
4b41580041 Merge branch 'wip/exalm/window' into 'master'
Round window corners

See merge request GNOME/gtk!1952
2020-11-13 15:33:15 +00:00
Carlos Garnacho
80de00a248 gtk/main: Stack ::active calls
We may have the situation of multiple touchpoints in the same
widget, or combinations with other devices. Stack those ::active
states are preserved on widgets on all but the last pointer/touch
going away.
2020-11-13 00:39:23 +01:00
Carlos Garnacho
50a7e59623 gtk/main: Toggle active flag with touch events
This went missing at some point, add the missing toggling of active
state with GDK_TOUCH_BEGIN/END/CANCEL events.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3348
2020-11-13 00:39:23 +01:00
Emmanuele Bassi
8203d9cc40 a11y: Use GROUP role for ShortcutsShortcut
And hide the image from the accessible tree.
2020-11-12 21:46:06 +00:00
Emmanuele Bassi
abc9b403f8 a11y: Implement atspi.Text.ScrollSubstringTo for GtkTextView
We reuse the existing implementation in GTK3.
2020-11-12 21:46:06 +00:00
Emmanuele Bassi
b9ad3172a4 a11y: Document GtkRevealer's accessible state
Use the GROUP role, and make sure to note that the child is always
revealed. Unlike GtkExpander, GtkRevealer can only be programmatically
toggled, so we cannot turn it into a "button" object.
2020-11-12 21:46:06 +00:00
Emmanuele Bassi
0d7fcdda28 a11y: Add more accessible data to GtkTreeExpander
Document the role of the GtkTreeExpander, and the behaviour of the
expander button.

Additionally, improve the label of the expander button, by adding a
fixed "Expand" label, and setting the "labelled-by" relation to the
child of the GtkTreeExpander.
2020-11-12 21:46:06 +00:00
Emmanuele Bassi
61e980bfb6 a11y: Add accessible actions to GtkSearchEntry
Just like GtkPasswordEntry, GtkSearchEntry should have its set of
accessible actions.
2020-11-12 21:46:06 +00:00
Emmanuele Bassi
ebda736a09 a11y: Mark SearchEntry icons as presentational
While the "clear the search entry" icon behaves like a button, we don't
have any actual action that can trigger it, so let's ignore it.
2020-11-12 21:46:06 +00:00
Emmanuele Bassi
d4ddfdc265 a11y: Set the role on GtkSearchBar
The search bar widget has a "SEARCH" landmark role, which is described
as:

    A landmark region that contains a collection of items and
    objects that, as a whole, combine to create a search facility.
2020-11-12 21:46:06 +00:00
Emmanuele Bassi
f8bb206034 a11y: Icons in buttons are presentational
Buttons are described by text, and the icon child can be safely ignored.
2020-11-12 21:46:06 +00:00
Emmanuele Bassi
87f92a93d3 a11y: Add more accessibility labels to GtkNotebook
Label the various components:

 - the tab list
 - the tab widget
 - the arrow widgets
2020-11-12 21:46:06 +00:00
Emmanuele Bassi
e49e084f4c a11y: Use the stack page title as its accessible label 2020-11-12 21:46:06 +00:00
Emmanuele Bassi
995daa1e29 a11y: GtkStack is a group of stack pages 2020-11-12 21:46:06 +00:00
Emmanuele Bassi
d34936c1ea Handle empty stack pages when creating an ATContext
If we don't have a widget inside GtkStackPage, we should use the default
GdkDisplay.
2020-11-12 21:46:06 +00:00
Emmanuele Bassi
a59889a274 Unrealize the ATContext in StackPage on dispose
Otherwise we're going to try to unrealize it during the GtkStack
destruction, which will emit warnings.
2020-11-12 21:46:05 +00:00
Emmanuele Bassi
bfb054a023 a11y: Icons in WindowControls are presentational only
They don't contribute anything to the accessible description.
2020-11-12 21:46:05 +00:00
Emmanuele Bassi
e940704018 a11y: Ignore more structural roles when computing labels
These roles should not have a fallback name when explicitly unlabelled.
2020-11-12 21:46:05 +00:00
Emmanuele Bassi
429c7fc039 a11y: Add role exception for GtkScrolledWindow
ARIA does not have a "scroll pane" role, but AT-SPI does.
2020-11-12 21:46:05 +00:00
Florian Müllner
056a073061 searchbar: Fix clearing search entry on hide
Commit fa3d1940bf added separate grab handling for GtkSearchEntry, but
didn't consider whether the bar was revealed or concealed. The expected
behavior for the latter is that the entry is cleared rather than focused,
fix the condition accordingly.
2020-11-12 19:59:55 +01:00
Alexander Mikhaylenko
e46522e4b5 theme: Round all window corners 2020-11-12 22:19:00 +05:00
Alexander Mikhaylenko
7ac7919697 theme: Restructure window style 2020-11-12 22:17:52 +05:00
Matthias Clasen
5d9799d4e3 Merge branch 'ebassi/for-master' into 'master'
ATContext lifetime fixes

Closes #3341

See merge request GNOME/gtk!2811
2020-11-12 12:35:23 +00:00
Jakub Steiner
ef88e9ffcc Adwaita: avoid !global
- Work around having !global variables as sassc will
  no longer support it
2020-11-12 13:14:37 +01:00
Alexander Mikhaylenko
49613dca8e button: Don't make the gesture exclusive
With the last commit, pressing the same button with multiple fingers
doesn't cause extra emissions, so we can remove exclusive and allow
pressing multiple buttons at once on touch.
2020-11-12 15:27:16 +05:00
Alexander Mikhaylenko
a651a0ce69 gestureclick: Only emit release for the same sequence
Avoid spurious releases when touching the same widget with another finger.
2020-11-12 15:26:36 +05:00
Emmanuele Bassi
08d59d3f68 docs: Add "Accessibility" section to various widgets
There are a few widgets that gained an accessible role, which means
adding an "Accessibility" section in their description.
2020-11-12 00:36:32 +00:00
Emmanuele Bassi
9ac4a7d99f a11y: Simplify GtkModelButton
Instead of recreating GtkATContexts in order to change their role, we
can simply unrealize and realize them back.
2020-11-11 19:45:43 +00:00
Emmanuele Bassi
8157717e03 a11y: Add missing fallback for accessible-role getter
If the per-instance accessible role is unset, use the class role.
2020-11-11 19:45:43 +00:00
Emmanuele Bassi
9052f6dafe a11y: Rework ownership and lifetime of GtkATContext
Now that GtkATContext is explicitly realized and unrealized, we should
always create an instance at widget initialization time, and drop it
during the widget finalization. This should make it easier to set up the
initial accessible state of a widget during the instance initialization,
as well as reduce the chances of accidental creation of GtkATContext
instances during the destruction sequence.
2020-11-11 19:45:43 +00:00
Emmanuele Bassi
292576f312 a11y: Defer to the GtkAccessible's implementation
Since GtkATContexts are now lazily realized, we need to go through the
GtkAccessible's implementation to access the :accessible-role property,
in case there are fallbacks.
2020-11-11 19:45:43 +00:00
Emmanuele Bassi
2285382074 a11y: Create AtSpiRoot on realization
There's no need to do a lot of work on construction, if we're delaying
all remote work after the GtkATContext is realized.

The GtkAtSpiContext should also keep a reference on the root, and drop
it at unrealize time.
2020-11-11 18:46:44 +00:00
Emmanuele Bassi
526f1e315b a11y: Use GROUP role for GtkNotebook
A notebook is a grouping of a tab list, tabs, and tab pages.
2020-11-11 18:46:11 +00:00
Emmanuele Bassi
877a7f98ca a11y: Protect should_present() from empty contexts
If the GtkAccessible implementation returns a NULL context, we should
not be calling methods on it.
2020-11-11 18:33:15 +00:00
Emmanuele Bassi
73b14a3c3a a11y: Do not leak the ATContext in GtkStackPage
GtkStackPage is not a widget, so it must release the reference on the
ATContext it owns.
2020-11-11 18:33:15 +00:00
Emmanuele Bassi
40c0826921 a11y: Mark more containers as structural elements
Widgets that just provide grouping and layout to other widgets should
not be relevant to the accessible tree.
2020-11-11 18:33:15 +00:00
Emmanuele Bassi
27b9b2e76c a11y: Use the window title as its label 2020-11-11 18:33:15 +00:00
Emmanuele Bassi
04c4d293a7 a11y: Skip unlabelled structural roles
If a structural role is left unlabelled, just leave it unnamed.
2020-11-11 18:33:15 +00:00
Emmanuele Bassi
033791b374 a11y: Translate ARIA windows to AT-SPI frames
For backward compatibility with GTK3.
2020-11-11 18:33:15 +00:00
Emmanuele Bassi
95ee5ff424 a11y: Add more ARIA/AT-SPI role translations 2020-11-11 18:33:15 +00:00
Emmanuele Bassi
65d29e00c7 a11y: Realize parent ATContext for the stack page
Just like for popovers, the stack page is not directly connected on the
widget's DOM, so we need to realize the parent ATContext ourselves.
2020-11-11 18:33:15 +00:00
Emmanuele Bassi
3b2cd972d5 a11y: Implement missing atspi.Component getters
Some of them are entirely innocuous, and we can easily provide values
that match what GTK3 provides.
2020-11-11 18:33:15 +00:00
Emmanuele Bassi
428ec29598 a11y: Unrealize ATContext on dispose()
By unrealizing the context we avoid additional work during the dispose
phase, in case widget code updates the accessible state. We use
GtkAccessible's API, to ensure we unrealize the right ATContext, instead
of the one we store inside GtkWidgetPrivate.

We drop the ATContext instance inside GtkWidget during finalization, to
mop up eventual vivifications there.
2020-11-11 18:33:15 +00:00
Matthias Clasen
bfe5b0d1b7 Adwaita: Don't do n-th child things for list rows
Making the list row child css depend on the position
is very expensive, and does not acutally work correctly
(since we don't have widgets for all children, so the
position of the child widget does not reflect the actual
model item position).

To make this more palatable, use the bottom border
instead of the top border, since most lists have a natural
border at the top (with headers), and may end up with
empty space at the bottom.
2020-11-11 13:18:08 -05:00
Matthias Clasen
82b855cc4b label: Avoid a needless strdup
Don't duplicate the string before we know if it
has actually changed.
2020-11-11 12:24:35 -05:00
Matthias Clasen
0db504edde label: Optimize GtkLabel setters
The overarching goal here is to not queue a resize
unless something has actually changed. In columnview
scenarios, we often deal with hundreds of labels.

Labels are cattle, not pets.
2020-11-11 11:48:27 -05:00
Matthias Clasen
27c4c19333 Don't hide widgets in dispose()
This is leftover code from when widgets were hidden
by default, and was setting them back to their initial
state.

This is getting in the way now, as hiding the widget
updates the HIDDEN accessible state, which ends up
re-creating the at context that we've already disposed
of, leading to memory leaks.
2020-11-11 10:35:54 -05:00
Matthias Clasen
74a7f73239 Merge branch 'matthiasc/builder-requires' into 'master'
Matthiasc/builder requires

See merge request GNOME/gtk!2806
2020-11-11 03:53:52 +00:00
Matthias Clasen
7215c74933 buildertool: Supplant a requires
When we convert a ui file to GTK 4 syntax, we *know*
that it requires GTK 4, so put that in the output.
2020-11-10 19:19:40 -05:00
Matthias Clasen
e4be785c6c builder: Be a bit more strict about requires
Check that the major version matches (without this, the
requires check is really toothless), but allow 3.99 to
match 4.0.
2020-11-10 19:18:26 -05:00
Matthias Clasen
d69a943661 gtk: Remove <requires> from ui files
We don't need to check requirements for things
that are shipped *with* gtk.
2020-11-10 18:36:03 -05:00
Matthias Clasen
0ececc7109 Merge branch 'ebassi/for-master' into 'master'
Ebassi/for master

Closes #3343 and #3342

See merge request GNOME/gtk!2804
2020-11-10 18:33:36 +00:00
Emmanuele Bassi
2229d7f66c docs: Add example of relations with lists of references 2020-11-10 14:38:09 +00:00
Emmanuele Bassi
ed7619ec16 a11y: Clone GtkATContext in GtkModelButton
The hypothetical widget that needs to clone ATContext instances
because it needs to control the accessible role post-construction is
really GtkModelButton.

Fixes: #3342
2020-11-10 14:31:57 +00:00
Emmanuele Bassi
7ed06480cf a11y: Add private API to clone a GtkATContext
Some widgets might want to override GtkAccessible and create their own
context in order to control the accessible role post-construction time.
To avoid explicitly copying the existing state over from the original
ATContext to the new one, we need a way to clone the context's state
from inside the ATContext itself.
2020-11-10 14:31:56 +00:00
Emmanuele Bassi
f9db651f32 a11y: Do not copy the list of references
The constructor for GtkReferenceListAccessibleValue is transfer full,
which means we should not be copying the GList around.

Fixes: #3343
2020-11-10 14:31:56 +00:00
Emmanuele Bassi
c264254d4b a11y: Parse reference lists using varargs
Using GList is a bit lame, and makes the API more complicated to use
than necessary in the common case.

The only real use case for a GList is gtk_widget_add_mnemonic_label(),
and for that we can use the GValue-based API instead.

Fixes: #3343
2020-11-10 14:31:56 +00:00
Emmanuele Bassi
6af89e9034 a11y: Add GValue initializers for accessible attributes
Consumers of the GValue-based API for GtkAccessible need to have a way
to initialize the GValue with the correct type for the given attribute.
2020-11-10 14:31:56 +00:00
Emmanuele Bassi
1bdc8b9061 a11y: Proxy GtkWidget:accessible-role
The accessible-role property in GtkWidget has three possible targets:

 - the :accessible-role of a GtkATContext, if realized
 - the accessible_role field of GtkWidgetPrivate
 - the accessible_role field of GtkWidgetClassPrivate

When we set the accessible role of a widget using the GObject property
mechanism, we want to either set the GtkWidgetPrivate.accessible_role
field, if there's no ATContext *or* if the ATContext is not realized.
Conversely, when we get the accessible-role property we want to have a
series of fallbacks in place:

 - if GtkAccessible.get_at_context() returns an ATContext, and that
   ATContext is realized, return the :accessible-role of the context
 - if GtkWidgetPrivate.accessible_role is not WIDGET, return the
   stored accessible role
 - return GtkWidgetClassPrivate.accessible_role

This should help catch the case of getting the accessible role of
widgets that override GtkAccessible.get_at_context(), like
GtkModelButton.

See: #3342
2020-11-10 14:31:56 +00:00
Matthias Clasen
c442f9f05a printdialog: Plug listmodel memory leaks
We were leaking references returned from g_list_model_get_item
in some places.
2020-11-10 09:07:54 -05:00