summaryrefslogtreecommitdiff
path: root/gtk/gtktexthandle.c
diff options
context:
space:
mode:
Diffstat (limited to 'gtk/gtktexthandle.c')
-rw-r--r--gtk/gtktexthandle.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c
index a373c6527c..40e6c9c191 100644
--- a/gtk/gtktexthandle.c
+++ b/gtk/gtktexthandle.c
@@ -131,15 +131,26 @@ gtk_text_handle_present_surface (GtkTextHandle *handle)
GdkRectangle rect;
GtkRequisition req;
GtkWidget *parent;
+ GtkNative *native;
+ graphene_point_t point = GRAPHENE_POINT_INIT (handle->pointing_to.x, handle->pointing_to.y);
+ graphene_point_t transformed;
+ double nx, ny;
gtk_widget_get_preferred_size (widget, NULL, &req);
gtk_text_handle_get_padding (handle, &handle->border);
parent = gtk_widget_get_parent (widget);
- gtk_widget_get_surface_allocation (parent, &rect);
- rect.x += handle->pointing_to.x;
- rect.y += handle->pointing_to.y + handle->pointing_to.height - handle->border.top;
+ native = gtk_widget_get_native (parent);
+ gtk_native_get_surface_transform (native, &nx, &ny);
+
+ if (!gtk_widget_compute_point (parent, GTK_WIDGET (native),
+ &point, &transformed))
+ transformed = point;
+
+ rect.x = (int)(transformed.x + nx);
+ rect.y = (int)(transformed.y + ny) + handle->pointing_to.height - handle->border.top;
+
rect.width = req.width - handle->border.left - handle->border.right;
rect.height = 1;