a11y: Emit focus events

Orca relies on these to keep track of the focus location,
ignoring the focused state. With this change, orca can
once again speak text in entries as I type.
This commit is contained in:
Matthias Clasen
2021-04-19 21:29:17 -04:00
parent 549e5a8e3a
commit c1e68f6044

View File

@@ -860,6 +860,24 @@ emit_children_changed (GtkAtSpiContext *self,
context_ref);
}
static void
emit_focus (GtkAtSpiContext *self,
gboolean focus_in)
{
if (self->connection == NULL)
return;
if (focus_in)
g_dbus_connection_emit_signal (self->connection,
NULL,
self->context_path,
"org.a11y.atspi.Event.Focus",
"Focus",
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,
@@ -1087,6 +1105,7 @@ gtk_at_spi_context_platform_change (GtkATContext *ctx,
gboolean state = gtk_accessible_get_platform_state (GTK_ACCESSIBLE (widget),
GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED);
emit_state_changed (self, "focused", state);
emit_focus (self, state);
}
if (changed_platform & GTK_ACCESSIBLE_PLATFORM_CHANGE_ACTIVE)