[gtk/matthiasc/atspi-child] a11y: Redo child-added/-removed for toplevels
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/atspi-child] a11y: Redo child-added/-removed for toplevels
- Date: Sat, 24 Oct 2020 19:27:47 +0000 (UTC)
commit 2546b8866102951493a765cb4a8bdef266f8f4db
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Oct 24 15:26:12 2020 -0400
a11y: Redo child-added/-removed for toplevels
Instead of monitoring the list of toplevels, rely
on GtkWindow updating the HIDDEN state before windows
get removed. This is better, since we still have the
object available when it happens, so we can pass it
to the ATs.
gtk/a11y/gtkatspicontext.c | 1 -
gtk/a11y/gtkatspiroot.c | 41 ++++-------------------------------------
gtk/a11y/gtkatspirootprivate.h | 1 -
3 files changed, 4 insertions(+), 39 deletions(-)
---
diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c
index 0b7c5eeb93..1787a9f2c9 100644
--- a/gtk/a11y/gtkatspicontext.c
+++ b/gtk/a11y/gtkatspicontext.c
@@ -871,7 +871,6 @@ gtk_at_spi_context_state_change (GtkATContext *ctx,
gtk_at_spi_root_child_changed (self->root,
hidden ? GTK_ACCESSIBLE_CHILD_STATE_REMOVED
: GTK_ACCESSIBLE_CHILD_STATE_ADDED,
- G_MAXUINT,
widget);
}
}
diff --git a/gtk/a11y/gtkatspiroot.c b/gtk/a11y/gtkatspiroot.c
index 21beb2eab3..a68d9cac40 100644
--- a/gtk/a11y/gtkatspiroot.c
+++ b/gtk/a11y/gtkatspiroot.c
@@ -405,47 +405,18 @@ static const GDBusInterfaceVTable root_accessible_vtable = {
NULL,
};
-static void
-root_toplevels__items_changed (GtkAtSpiRoot *self,
- guint position,
- guint removed,
- guint added,
- GListModel *toplevels)
-{
- if (added == 1 && removed == 0)
- {
- GtkWidget *window;
-
- window = GTK_WIDGET (g_list_model_get_item (self->toplevels, position));
- gtk_at_spi_root_child_changed (self,
- GTK_ACCESSIBLE_CHILD_STATE_ADDED,
- G_MAXUINT,
- window);
- g_object_unref (window);
- }
- else if (added == 0 && removed == 1)
- {
- gtk_at_spi_root_child_changed (self,
- GTK_ACCESSIBLE_CHILD_STATE_REMOVED,
- position,
- NULL);
- }
- else
- {
- g_assert_not_reached ();
- }
-}
-
void
gtk_at_spi_root_child_changed (GtkAtSpiRoot *self,
GtkAccessibleChildState state,
- guint position,
GtkWidget *window)
{
guint n, i;
int idx = 0;
GVariant *window_ref;
+ if (!self->toplevels)
+ return;
+
/* We can be called either with a valid position and window == NULL
* or with position == G_MAXUINT and a valid window. In both cases,
* we need to determine the index of where the removed object would
@@ -457,7 +428,7 @@ gtk_at_spi_root_child_changed (GtkAtSpiRoot *self,
g_object_unref (item);
- if (i == position || item == GTK_ACCESSIBLE (window))
+ if (item == GTK_ACCESSIBLE (window))
break;
if (!gtk_accessible_should_present (item))
@@ -517,11 +488,7 @@ on_registration_reply (GObject *gobject,
/* Register the cache object */
self->cache = gtk_at_spi_cache_new (self->connection, ATSPI_CACHE_PATH);
- /* Monitor the top levels */
self->toplevels = gtk_window_get_toplevels ();
- g_signal_connect_swapped (self->toplevels, "items-changed",
- G_CALLBACK (root_toplevels__items_changed),
- self);
}
static void
diff --git a/gtk/a11y/gtkatspirootprivate.h b/gtk/a11y/gtkatspirootprivate.h
index 12cba41085..7f4f062afc 100644
--- a/gtk/a11y/gtkatspirootprivate.h
+++ b/gtk/a11y/gtkatspirootprivate.h
@@ -45,7 +45,6 @@ gtk_at_spi_root_to_ref (GtkAtSpiRoot *self);
void
gtk_at_spi_root_child_changed (GtkAtSpiRoot *self,
GtkAccessibleChildState state,
- guint position,
GtkWidget *window);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]