summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukáš Tyrychtr <lukastyrychtr@gmail.com>2023-01-05 16:06:24 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2023-02-03 11:49:17 +0100
commit01549e3c91aa823f077cf11a026675577153c01e (patch)
treee89e4963bee7ca2475f28219b0f2c2dd253db960
parentbc48bfc2b63d5be990068872a912108706419efb (diff)
downloadgtk+-01549e3c91aa823f077cf11a026675577153c01e.tar.gz
Take the widget transform into account when computing the bounds for a11y
-rw-r--r--gtk/gtkwidget.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 606f2d352f..4e067f14e7 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -8492,7 +8492,9 @@ gtk_widget_accessible_get_bounds (GtkAccessible *self,
{
GtkWidget *widget;
GtkWidget *parent;
+ GtkWidget *bounds_relative_to;
double translated_x, translated_y;
+ graphene_rect_t *bounds;
widget = GTK_WIDGET (self);
if (!gtk_widget_get_realized (widget))
@@ -8505,12 +8507,20 @@ gtk_widget_accessible_get_bounds (GtkAccessible *self,
gtk_widget_translate_coordinates (widget, parent, 0., 0., &translated_x, &translated_y);
*x = (int)translated_x;
*y = (int)translated_y;
+ bounds_relative_to = parent;
}
else
- *x = *y = 0;
+ {
+ *x = *y = 0;
+ bounds_relative_to = widget;
+ }
- *width = gtk_widget_get_width (widget);
- *height = gtk_widget_get_height (widget);
+ bounds = graphene_rect_alloc ();
+ if (!gtk_widget_compute_bounds (widget, bounds_relative_to, bounds))
+ *width, *height = 0;
+ *width = (int)graphene_rect_get_width (bounds);
+ *height = (int)graphene_rect_get_height (bounds);
+ graphene_rect_free (bounds);
return true;
}