mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 22:20:24 +00:00
Merge branch 'ebassi/lazier-a11y' into 'master'
Lazier accessibility See merge request GNOME/gtk!3102
This commit is contained in:
commit
c46391420f
@ -58,6 +58,9 @@ struct _GtkAtSpiCache
|
|||||||
|
|
||||||
/* HashTable<GtkAtSpiContext, str> */
|
/* HashTable<GtkAtSpiContext, str> */
|
||||||
GHashTable *contexts_to_path;
|
GHashTable *contexts_to_path;
|
||||||
|
|
||||||
|
/* Re-entrancy guard */
|
||||||
|
gboolean in_get_items;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -250,10 +253,17 @@ handle_cache_method (GDBusConnection *connection,
|
|||||||
{
|
{
|
||||||
GVariantBuilder builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("(" GET_ITEMS_SIGNATURE ")"));
|
GVariantBuilder builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("(" GET_ITEMS_SIGNATURE ")"));
|
||||||
|
|
||||||
|
/* Prevent the emission os signals while collecting accessible
|
||||||
|
* objects as the result of walking the accessible tree
|
||||||
|
*/
|
||||||
|
self->in_get_items = TRUE;
|
||||||
|
|
||||||
g_variant_builder_open (&builder, G_VARIANT_TYPE (GET_ITEMS_SIGNATURE));
|
g_variant_builder_open (&builder, G_VARIANT_TYPE (GET_ITEMS_SIGNATURE));
|
||||||
collect_cached_objects (self, &builder);
|
collect_cached_objects (self, &builder);
|
||||||
g_variant_builder_close (&builder);
|
g_variant_builder_close (&builder);
|
||||||
|
|
||||||
|
self->in_get_items = FALSE;
|
||||||
|
|
||||||
g_dbus_method_invocation_return_value (invocation, g_variant_builder_end (&builder));
|
g_dbus_method_invocation_return_value (invocation, g_variant_builder_end (&builder));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,7 +381,11 @@ gtk_at_spi_cache_add_context (GtkAtSpiCache *self,
|
|||||||
|
|
||||||
GTK_NOTE (A11Y, g_message ("Adding context '%s' to cache", path_key));
|
GTK_NOTE (A11Y, g_message ("Adding context '%s' to cache", path_key));
|
||||||
|
|
||||||
emit_add_accessible (self, context);
|
/* GetItems is safe from re-entrancy, but we still don't want to
|
||||||
|
* emit an unnecessary signal while we're collecting ATContexts
|
||||||
|
*/
|
||||||
|
if (!self->in_get_items)
|
||||||
|
emit_add_accessible (self, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2374,7 +2374,7 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
|
|||||||
priv->at_context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (widget));
|
priv->at_context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (widget));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
gtk_widget_realize_at_context (GtkWidget *self)
|
gtk_widget_realize_at_context (GtkWidget *self)
|
||||||
{
|
{
|
||||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (self);
|
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (self);
|
||||||
@ -2383,10 +2383,6 @@ gtk_widget_realize_at_context (GtkWidget *self)
|
|||||||
if (priv->at_context == NULL || gtk_at_context_is_realized (priv->at_context))
|
if (priv->at_context == NULL || gtk_at_context_is_realized (priv->at_context))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Realize the root ATContext first */
|
|
||||||
if (!GTK_IS_ROOT (self))
|
|
||||||
gtk_widget_realize_at_context (GTK_WIDGET (priv->root));
|
|
||||||
|
|
||||||
/* Reset the accessible role to its current value */
|
/* Reset the accessible role to its current value */
|
||||||
if (role == GTK_ACCESSIBLE_ROLE_WIDGET)
|
if (role == GTK_ACCESSIBLE_ROLE_WIDGET)
|
||||||
{
|
{
|
||||||
@ -2400,6 +2396,18 @@ gtk_widget_realize_at_context (GtkWidget *self)
|
|||||||
gtk_at_context_realize (priv->at_context);
|
gtk_at_context_realize (priv->at_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_widget_unrealize_at_context (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||||
|
|
||||||
|
if (priv->at_context != NULL)
|
||||||
|
{
|
||||||
|
gtk_at_context_set_display (priv->at_context, gdk_display_get_default ());
|
||||||
|
gtk_at_context_unrealize (priv->at_context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_widget_root (GtkWidget *widget)
|
gtk_widget_root (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
@ -2428,8 +2436,6 @@ gtk_widget_root (GtkWidget *widget)
|
|||||||
if (priv->layout_manager)
|
if (priv->layout_manager)
|
||||||
gtk_layout_manager_set_root (priv->layout_manager, priv->root);
|
gtk_layout_manager_set_root (priv->layout_manager, priv->root);
|
||||||
|
|
||||||
gtk_widget_realize_at_context (widget);
|
|
||||||
|
|
||||||
GTK_WIDGET_GET_CLASS (widget)->root (widget);
|
GTK_WIDGET_GET_CLASS (widget)->root (widget);
|
||||||
|
|
||||||
if (!GTK_IS_ROOT (widget))
|
if (!GTK_IS_ROOT (widget))
|
||||||
@ -2454,12 +2460,6 @@ gtk_widget_unroot (GtkWidget *widget)
|
|||||||
|
|
||||||
GTK_WIDGET_GET_CLASS (widget)->unroot (widget);
|
GTK_WIDGET_GET_CLASS (widget)->unroot (widget);
|
||||||
|
|
||||||
if (priv->at_context != NULL)
|
|
||||||
{
|
|
||||||
gtk_at_context_set_display (priv->at_context, gdk_display_get_default ());
|
|
||||||
gtk_at_context_unrealize (priv->at_context);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->context)
|
if (priv->context)
|
||||||
gtk_style_context_set_display (priv->context, gdk_display_get_default ());
|
gtk_style_context_set_display (priv->context, gdk_display_get_default ());
|
||||||
|
|
||||||
|
@ -373,6 +373,9 @@ gboolean gtk_widget_focus_self (GtkWidget *widget,
|
|||||||
void gtk_widget_update_orientation (GtkWidget *widget,
|
void gtk_widget_update_orientation (GtkWidget *widget,
|
||||||
GtkOrientation orientation);
|
GtkOrientation orientation);
|
||||||
|
|
||||||
|
void gtk_widget_realize_at_context (GtkWidget *widget);
|
||||||
|
void gtk_widget_unrealize_at_context (GtkWidget *widget);
|
||||||
|
|
||||||
/* inline getters */
|
/* inline getters */
|
||||||
|
|
||||||
static inline GtkWidget *
|
static inline GtkWidget *
|
||||||
|
@ -3806,6 +3806,8 @@ gtk_window_map (GtkWidget *widget)
|
|||||||
|
|
||||||
if (priv->application)
|
if (priv->application)
|
||||||
gtk_application_handle_window_map (priv->application, window);
|
gtk_application_handle_window_map (priv->application, window);
|
||||||
|
|
||||||
|
gtk_widget_realize_at_context (widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3818,6 +3820,8 @@ gtk_window_unmap (GtkWidget *widget)
|
|||||||
GTK_WIDGET_CLASS (gtk_window_parent_class)->unmap (widget);
|
GTK_WIDGET_CLASS (gtk_window_parent_class)->unmap (widget);
|
||||||
gdk_surface_hide (priv->surface);
|
gdk_surface_hide (priv->surface);
|
||||||
|
|
||||||
|
gtk_widget_unrealize_at_context (widget);
|
||||||
|
|
||||||
if (priv->title_box != NULL)
|
if (priv->title_box != NULL)
|
||||||
gtk_widget_unmap (priv->title_box);
|
gtk_widget_unmap (priv->title_box);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user