summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2023-04-28 13:29:15 -0400
committerMatthias Clasen <mclasen@redhat.com>2023-04-28 15:05:39 -0400
commit37b2b3cb8320da9bc131d03fc5dd85de7d6a34ff (patch)
tree8882b5803b15d0c9a63782c5568e6625d837f601
parent76777cdd1801b450a0ba5fb6d8147045d888c866 (diff)
downloadgtk+-37b2b3cb8320da9bc131d03fc5dd85de7d6a34ff.tar.gz
text: Stop using gtk_widget_get_allocation
-rw-r--r--gtk/gtktext.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 230556c37e..3c30844531 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -6234,7 +6234,7 @@ gtk_text_selection_bubble_popup_show (gpointer user_data)
const int text_width = gtk_widget_get_width (GTK_WIDGET (self));
const int text_height = gtk_widget_get_height (GTK_WIDGET (self));
cairo_rectangle_int_t rect;
- GtkAllocation allocation;
+ graphene_point_t p;
gboolean has_selection;
int start_x, end_x;
GtkWidget *box;
@@ -6279,13 +6279,15 @@ gtk_text_selection_bubble_popup_show (gpointer user_data)
g_object_unref (model);
- gtk_widget_get_allocation (GTK_WIDGET (self), &allocation);
+ if (!gtk_widget_compute_point (GTK_WIDGET (self), gtk_widget_get_parent (GTK_WIDGET (self)),
+ &GRAPHENE_POINT_INIT (0, 0), &p))
+ graphene_point_init (&p, 0, 0);
gtk_text_get_cursor_locations (self, &start_x, NULL);
start_x -= priv->scroll_offset;
start_x = CLAMP (start_x, 0, text_width);
- rect.y = - allocation.y;
+ rect.y = - p.y;
rect.height = text_height;
if (has_selection)
@@ -6293,12 +6295,12 @@ gtk_text_selection_bubble_popup_show (gpointer user_data)
end_x = gtk_text_get_selection_bound_location (self) - priv->scroll_offset;
end_x = CLAMP (end_x, 0, text_width);
- rect.x = - allocation.x + MIN (start_x, end_x);
+ rect.x = - p.x + MIN (start_x, end_x);
rect.width = ABS (end_x - start_x);
}
else
{
- rect.x = - allocation.x + start_x;
+ rect.x = - p.x + start_x;
rect.width = 0;
}