Merge branch 'a11y-debug' into 'master'

testatcontext: Print out platform changes

See merge request GNOME/gtk!3451
This commit is contained in:
Matthias Clasen 2021-04-17 16:39:20 +00:00
commit 1530c90e37
3 changed files with 32 additions and 1 deletions

View File

@ -252,6 +252,7 @@ handle_cache_method (GDBusConnection *connection,
if (g_strcmp0 (method_name, "GetItems") == 0)
{
GVariantBuilder builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("(" GET_ITEMS_SIGNATURE ")"));
GVariant *items;
/* Prevent the emission os signals while collecting accessible
* objects as the result of walking the accessible tree
@ -261,10 +262,14 @@ handle_cache_method (GDBusConnection *connection,
g_variant_builder_open (&builder, G_VARIANT_TYPE (GET_ITEMS_SIGNATURE));
collect_cached_objects (self, &builder);
g_variant_builder_close (&builder);
items = g_variant_builder_end (&builder);
self->in_get_items = FALSE;
g_dbus_method_invocation_return_value (invocation, g_variant_builder_end (&builder));
GTK_NOTE (A11Y,
g_message ("Returning %lu items\n", g_variant_n_children (items)));
g_dbus_method_invocation_return_value (invocation, items);
}
}

View File

@ -463,6 +463,8 @@ handle_accessible_method (GDBusConnection *connection,
{
GtkAtSpiContext *self = user_data;
GTK_NOTE (A11Y, g_message ("handling %s on %s", method_name, object_path));
if (g_strcmp0 (method_name, "GetRole") == 0)
{
guint atspi_role = gtk_atspi_role_for_context (GTK_AT_CONTEXT (self));
@ -666,6 +668,8 @@ handle_accessible_get_property (GDBusConnection *connection,
GtkAccessible *accessible = gtk_at_context_get_accessible (GTK_AT_CONTEXT (self));
GTK_NOTE (A11Y, g_message ("handling GetProperty %s on %s", property_name, object_path));
if (g_strcmp0 (property_name, "Name") == 0)
{
char *label = gtk_at_context_get_name (GTK_AT_CONTEXT (self));

View File

@ -78,12 +78,34 @@ gtk_test_at_context_state_change (GtkATContext *self,
}
}
static void
gtk_test_at_context_platform_change (GtkATContext *self,
GtkAccessiblePlatformChange changed_platform)
{
if (GTK_DEBUG_CHECK (A11Y))
{
GtkAccessible *accessible;
accessible = gtk_at_context_get_accessible (self);
g_print ("*** Accessible platform state changed for accessible “%s”:\n",
G_OBJECT_TYPE_NAME (accessible));
if (changed_platform & GTK_ACCESSIBLE_PLATFORM_CHANGE_FOCUSABLE)
g_print ("*** focusable = %d\n",
gtk_accessible_get_platform_state (accessible, GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSABLE));
if (changed_platform & GTK_ACCESSIBLE_PLATFORM_CHANGE_FOCUSED)
g_print ("*** focused = %d\n",
gtk_accessible_get_platform_state (accessible, GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED));
}
}
static void
gtk_test_at_context_class_init (GtkTestATContextClass *klass)
{
GtkATContextClass *context_class = GTK_AT_CONTEXT_CLASS (klass);
context_class->state_change = gtk_test_at_context_state_change;
context_class->platform_change = gtk_test_at_context_platform_change;
}
static void