diff --git a/gtk/a11y/gtkwidgetaccessible.c b/gtk/a11y/gtkwidgetaccessible.c index 84732dcda5..43b9c8cb9a 100644 --- a/gtk/a11y/gtkwidgetaccessible.c +++ b/gtk/a11y/gtkwidgetaccessible.c @@ -54,28 +54,28 @@ notify_cb (GObject *obj, klass->notify_gtk (obj, pspec); } -/* Translate GtkWidget::size-allocate to AtkComponent::bounds-changed */ -static void -size_allocate_cb (GtkWidget *widget, - int width, - int height) +/*< private > + * gtk_widget_accessible_update_bounds: + * @self: a #GtkWidgetAccessible + * + * Updates the bounds of the widget's accessible implementation using + * the widget's allocation. + */ +void +gtk_widget_accessible_update_bounds (GtkWidgetAccessible *self) { - AtkObject* accessible; + GtkAllocation alloc; AtkRectangle rect; - accessible = gtk_widget_get_accessible (widget); - if (ATK_IS_COMPONENT (accessible)) - { - GtkAllocation alloc; - gtk_widget_get_allocation (widget, &alloc); + GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (self)); + gtk_widget_get_allocation (widget, &alloc); - rect.x = alloc.x; - rect.y = alloc.y; - rect.width = alloc.width; - rect.height = alloc.height; + rect.x = alloc.x; + rect.y = alloc.y; + rect.width = alloc.width; + rect.height = alloc.height; - g_signal_emit_by_name (accessible, "bounds-changed", &rect); - } + g_signal_emit_by_name (self, "bounds-changed", &rect); } /* Translate GtkWidget mapped state into AtkObject showing */ @@ -109,7 +109,6 @@ gtk_widget_accessible_initialize (AtkObject *obj, widget = GTK_WIDGET (data); g_signal_connect (widget, "notify", G_CALLBACK (notify_cb), NULL); - g_signal_connect (widget, "size-allocate", G_CALLBACK (size_allocate_cb), NULL); g_signal_connect (widget, "map", G_CALLBACK (map_cb), NULL); g_signal_connect (widget, "unmap", G_CALLBACK (map_cb), NULL); diff --git a/gtk/a11y/gtkwidgetaccessibleprivate.h b/gtk/a11y/gtkwidgetaccessibleprivate.h index 9623429501..ac60f0e43d 100644 --- a/gtk/a11y/gtkwidgetaccessibleprivate.h +++ b/gtk/a11y/gtkwidgetaccessibleprivate.h @@ -25,6 +25,8 @@ G_BEGIN_DECLS void _gtk_widget_accessible_set_layer (GtkWidgetAccessible *accessible, AtkLayer layer); +void gtk_widget_accessible_update_bounds (GtkWidgetAccessible *self); + G_END_DECLS #endif /* __GTK_WIDGET_ACCESSIBLE_PRIVATE_H__ */ diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index f52ef856ce..f873f2b4ff 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -74,7 +74,7 @@ #include "gtknativeprivate.h" #include "gtkconstraint.h" -#include "a11y/gtkwidgetaccessible.h" +#include "a11y/gtkwidgetaccessibleprivate.h" #include "inspector/window.h" #include "gdk/gdkeventsprivate.h" @@ -4123,6 +4123,9 @@ gtk_widget_allocate (GtkWidget *widget, gtk_widget_update_paintables (widget); + if (priv->accessible != NULL) + gtk_widget_accessible_update_bounds (GTK_WIDGET_ACCESSIBLE (priv->accessible)); + skip_allocate: if (size_changed || baseline_changed) gtk_widget_queue_draw (widget);