Commit Graph

67325 Commits

Author SHA1 Message Date
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
f95943a752 Merge branch 'wip/jimmac/sassc-global-vars' into 'master'
Adwaita: avoid !global

See merge request GNOME/gtk!2816
2020-11-12 12:34:10 +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
Matthias Clasen
afff39c503 Merge branch 'suggestion-entry-demo2' into 'master'
gtk-demo: Add suggestion entry demos

See merge request GNOME/gtk!2812
2020-11-11 21:40:07 +00:00
Matthias Clasen
a2897e1868 gtk-demo: Add suggestion entry demos
Add a possible replacement for GtkEntryCompletion
as a demo.

Move the Dropdowns demo to Lists/Selections, and make
it show both GtkDropDown and the suggestion entry, with
some variations.
2020-11-11 15:54:43 -05:00
Matthias Clasen
15172ebdb0 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2810
2020-11-11 20:49:51 +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
5ed3ad6cc8 gtk-demo: Split off SvgPaintable
Put the SvgPaintable implementation into its
own source files, for ease of copying.
2020-11-11 10:35:54 -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
a047b7d6d1 Merge branch 'fix-demos-wo-pangoft2' into 'master'
gtk-demo: Fix building scrolling demo without PangoFT2

See merge request GNOME/gtk!2807
2020-11-11 03:50:46 +00:00
Chun-wei Fan
a76f37a501 gtk-demo: Fix building scrolling demo without PangoFT2
For builds that do not have PangoFT2, the demo fails to link because we weren't
building listview_ucd.c.  Fix the build by building listview_ucd.c with
script-names.c and unicode-names.c for all builds, as we now require a Pango
version that already always depends on HarfBuzz and those sources do not use
anything from PangoFT2.
2020-11-11 11:15:05 +08:00
Matthias Clasen
d6a0948182 testsuite: Update buildertool tests
gtk-builder-tool simplify --3to4 now produces a
<requires lib="gtk" version="4.0"/>.
Adapt for that, and also add some tests that check that we
actually verify the requires, and accept 3.99 and 4.0, but
not 5.x.
2020-11-10 19:20:51 -05: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
18779b9d67 testsuite: Remove <requires> from ui files
We don't need these here, the testsuite is shipped
with GTK.
2020-11-10 19:17:45 -05:00
Matthias Clasen
9b056f57f7 examples: Remove requires from ui files
No need to check requires for things that are shipped
with GTK.
2020-11-10 18:38:54 -05:00
Matthias Clasen
d6c753bde7 gtk4-demo: Remove <requires> from ui files
No need to check requires for things that are shipped
with GTK.
2020-11-10 18:37:40 -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
Matthias Clasen
3cc0870084 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2805
2020-11-10 16:59:47 +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