summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2021-04-20 17:24:13 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2021-04-20 17:24:13 +0100
commit639932ad8a93157628937d03c2da72edfd853bf8 (patch)
tree03a124a332262c1e6f7325b2325b61fdeafb960f
parent1a944b28241c128b6c5aa4f5526ce659762292fa (diff)
downloadgtk+-639932ad8a93157628937d03c2da72edfd853bf8.tar.gz
a11y: Emit window:activate event
Orca uses the window:activate event type to track top levels, and avoid being spammed by events coming from non-focused windows.
-rw-r--r--gtk/a11y/gtkatspicontext.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c
index c15c4d37b9..9f69b53181 100644
--- a/gtk/a11y/gtkatspicontext.c
+++ b/gtk/a11y/gtkatspicontext.c
@@ -883,6 +883,22 @@ emit_focus (GtkAtSpiContext *self,
}
static void
+emit_window_activate (GtkAtSpiContext *self)
+{
+ if (self->connection == NULL)
+ return;
+
+ g_dbus_connection_emit_signal (self->connection,
+ NULL,
+ self->context_path,
+ "org.a11y.atspi.Event.Window",
+ "activate",
+ g_variant_new ("(siiva{sv})",
+ "", 0, 0, g_variant_new_string("0"), NULL),
+ NULL);
+}
+
+static void
gtk_at_spi_context_state_change (GtkATContext *ctx,
GtkAccessibleStateChange changed_states,
GtkAccessiblePropertyChange changed_properties,
@@ -1117,6 +1133,9 @@ gtk_at_spi_context_platform_change (GtkATContext *ctx,
gboolean state = gtk_accessible_get_platform_state (GTK_ACCESSIBLE (widget),
GTK_ACCESSIBLE_PLATFORM_STATE_ACTIVE);
emit_state_changed (self, "active", state);
+
+ if (gtk_accessible_get_accessible_role (accessible) == GTK_ACCESSIBLE_ROLE_WINDOW && state)
+ emit_window_activate (self);
}
}