Commit Graph

209 Commits

Author SHA1 Message Date
Matthias Clasen
3535b582a1 stack: Convert docs 2021-03-11 16:37:34 +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
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
Matthias Clasen
d5b9489408 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

Closes #3282

See merge request GNOME/gtk!2755
2020-10-27 22:38:58 +00:00
Matthias Clasen
9a943e21d3 stack: Update HIDDEN a11y state for stack pages
This will let us handle additions and removals
in the AT-SPI backend.
2020-10-24 22:04:26 -04:00
Matthias Clasen
434b145ee0 stack: Don't transition when the visible child is remove
This is a corner-case, and it is causing crashes in
the shortcuts window, after a11ab6c995.
2020-10-24 20:54:55 -04:00
Timm Bäder
44728d09a9 stack: assert for some assumptions 2020-10-22 17:46:34 +02:00
Matthias Clasen
1d802881eb stack: Change ordering for removal
Unparent the child widget before tearing down its
stack page. This is necessary so a11y can still access
the stack page accessible to emit change notification
when it learns that the child is removed.
2020-10-22 10:05:17 -04:00
Matthias Clasen
0a71dc1bed stack: Minor doc addition 2020-10-19 21:15:44 -04:00
Matthias Clasen
1bf21d3dba Document accessible roles for stacks and notebooks
This was forgotten when I implemented the Tabs pattern.
2020-10-14 22:27:09 -04:00
Matthias Clasen
7c6c718e19 stack: Turn pages into accessibles
This requires some cleanup to remove assumptions
about accessibles being widgets in the backend,
and some code to navigate the tree with these
extra objects in between widgets.

The accessibles for stack pages have the role
GTK_ACCESSIBLE_ROLE_TAB_PANEL. This is the first
step towards implementing the tabs patterns
as described in the aria authoring guidelines
for GtkStack.
2020-10-14 21:04:17 -04:00
Matthias Clasen
cc9fe4b354 stack: Add gtk_stack_add_child
The name of children is not essential, so add
a way to add children without providing one.

Fixes: #3165
2020-09-15 18:39:09 -04:00
Björn Daase
6315cd977c *: Fix spelling mistakes found by codespell 2020-08-21 15:29:34 +02:00
Timm Bäder
b489a1f6b5 stack: Allow NULL names
Does this work?
2020-08-01 15:27:13 +02:00
Timm Bäder
2f65459fcc stack: Only compare page names if the new page has one 2020-08-01 15:26:53 +02:00
Emmanuele Bassi
c63087a563 Remove ATK
To build a better world sometimes means having to tear the old one down.
        -- Alexander Pierce, "Captain America: The Winter Soldier"

ATK served us well for nearly 20 years, but the world has changed, and
GTK has changed with it. Now ATK is mostly a hindrance towards improving
the accessibility stack:

 - it maps to a very specific implementation, AT-SPI, which is Linux and
   Unix specific
 - it requires implementing the same functionality in three different
   layers of the stack: AT-SPI, ATK, and GTK
 - only GTK uses it; every other Linux and Unix toolkit and application
   talks to AT-SPI directly, including assistive technologies

Sadly, we cannot incrementally port GTK to a new accessibility stack;
since ATK insulates us entirely from the underlying implementation, we
cannot replace it piecemeal. Instead, we're going to remove everything
and then incrementally build on a clean slate:

 - add an "accessible" interface, implemented by GTK objects directly,
   which describe the accessible role and state changes for every UI
   element
 - add an "assistive technology context" to proxy a native accessibility
   API, and assign it to every widget
 - implement the AT context depending on the platform

For more information, see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2833
2020-07-26 20:31:14 +01:00
Benjamin Otte
3078b180fe Replace "gdouble" with "double" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Matthias Clasen
54a3293cad stack: Fix handling of GtkStackPage:visible
The stack wasn't updating its visible-child when
the stack pages visible property changes. This
showed up in the inspector, when showing the details
for a list model item.
2020-07-07 00:48:43 -04:00
Matthias Clasen
7c98af6358 stack: Cosmetic documentation fixes
Fix parameter mismatches.
2020-06-28 12:23:52 -04:00
Timm Bäder
fbb7948c13 stack: Avoid using an uninitialized value
This was showing up as criticals since for_size != >= -1.
2020-06-19 05:58:52 +02:00
Timm Bäder
d81a5a8338 stack: Add missing accessors for GtkStackPage properties 2020-06-19 05:26:25 +02:00
Timm Bäder
652323a4bf stack: Fix some documentation mishaps 2020-06-19 05:26:25 +02:00
Timm Bäder
e45518fb5f stack: Fix :needs-attention docs
This is a property on GtkStackPage these days.
2020-06-19 05:26:25 +02:00
Timm Bäder
3bd648e72e stack: stop keeping a cached child render node around
All widgets cache their render node already. Just allocate the
last_visible_child always at 0/0 and then move its rendernode around
during snapshot.

Fixes #2678
2020-06-19 05:26:25 +02:00
Yuri Chornoivan
01bd4cc4e1 Fix minor typos 2020-05-28 11:00:03 +03:00
Matthias Clasen
5907ecebfc stack: Derive from GtkWidget 2020-05-11 22:21:39 -04:00
Matthias Clasen
5e0c1e6a86 stack: Add gtk_stack_remove
This is a replacement for gtk_container_remove.
2020-05-11 22:21:39 -04:00
Matthias Clasen
cb056a1e8f stack: Add a :use-underline property
Add GtkStackPage:use-underline, and use it when
constructing labels in the stack switcher.
2020-04-30 19:17:34 -04:00
Matthias Clasen
5f01f6f36b Drop GtkStack:homogeneous
We have hhomogeneous and vhomogeneous properties
that can be set individually.

Fixes: #2673
2020-04-28 20:00:12 -04:00
Matthias Clasen
b55195fa2e Move the idle sizer to GtkWindow
This was only living in gtkcontainer.c for historic
reasons. Move it closer to where it belongs, and
rename it from 'idle' to 'layout', since it is
really about the layout phase of the frame clock,
nowadays.
2020-04-20 16:30:45 -04:00
Benjamin Otte
cda9007f0f stack: Make static analyzer happy 2020-03-06 05:56:29 +01:00
Timm Bäder
188f00e05a stack: Add GtkStackPage:visible accessors 2020-02-20 10:23:09 +01:00
Andy Holmes
44093f4966
stack: return the stack page when adding a child, to ease setting props 2019-11-03 18:05:03 -08:00
Matthias Clasen
700e9e03c5 stack: Make final 2019-05-28 22:35:36 +00:00
Matthias Clasen
18788c2a86 Remove gtk_widget_get/set_has_surface
These serve no purpose anymore - widgets don't
have surfaces, unless they're a GtkNative.
2019-05-28 20:25:15 +00:00
Benjamin Otte
9d0a42dc14 stack: Add a cube spin transition
Add a transition to GtkStack that pretends pages
are the sides or a cube, and switch them by
rotating the cube.

Use this transition in widget-factory.
2019-03-29 10:03:18 -04:00
Matthias Clasen
2bf1561b48 Port widgets to the root focus API 2019-03-16 21:24:44 -04:00
Benjamin Otte
6df2023e9d stack: Use new snapshot transforms 2019-02-21 19:47:28 +01:00
Benjamin Otte
9a8082bab2 widget: Remove gtk_widget_get_allocated_size()
Use gtk_widget_get_allocated_width/height in the only user (GtkStack),
even though that isn't 100% correct.
2019-02-19 19:29:58 +01:00
Matthias Clasen
89d8ae0431 stack: Fix a crash
We need to remove the weak pointer, as the stack switcher can
keep the list model alive beyond the stack. This was observed
to cause crashes:

==16870== Invalid write of size 8
==16870==    at 0x5168A4E: g_nullify_pointer (gutils.c:2284)
==16870==    by 0x522C500: weak_refs_notify (gobject.c:2791)
==16870==    by 0x50FE7BC: g_data_set_internal (gdataset.c:407)
==16870==    by 0x50FECA7: g_datalist_id_set_data_full (gdataset.c:670)
==16870==    by 0x5227EB4: g_object_real_dispose (gobject.c:1056)
==16870==    by 0x522D295: g_object_unref (gobject.c:3309)
==16870==    by 0x4AF849F: unset_stack (gtkstackswitcher.c:428)
==16870==    by 0x4AF892E: gtk_stack_switcher_dispose (gtkstackswitcher.c:527)
2019-02-14 12:24:22 -05:00
Matthias Clasen
6ef775dbcb stack: Add a pages property
This makes the list model available in the inspector.
2019-02-13 14:14:54 -05:00
Matthias Clasen
8c0b70691b stack: Don't emit bad ::selection-changed signals
We have to be careful to not pass bad numbers to
this signal, which was happening in cases where
we have on old or new selected item.
2019-02-13 09:01:07 -05:00
Matthias Clasen
1750922631 stack: Fix a corner-case
When the stack goes empty, we were failing to reset
the visible_child member to NULL, causing problems later
on, since we don't have a ref for it.
2019-02-13 09:00:00 -05:00
Matthias Clasen
2dd85b826f stack: Don't leak a reference
The page holds a reference to the widget, so can't just clear
this pointer.
2019-02-13 08:42:58 -05:00
Matthias Clasen
c0c6c87781 stack: Avoid some ugly unrefs
Instead of using the list model api that forces us
to drop the ref, just work with the list we have.
2019-02-13 08:40:13 -05:00