forked from AuroraMiddleware/gtk
texthandle: Fix positioning
Use the same approach we use for popovers, using gtk_widget_get_surface_allocation. It works. Fixes: #3319
This commit is contained in:
parent
7624f66fec
commit
ddd16dd312
@ -116,22 +116,19 @@ gtk_text_handle_present_surface (GtkTextHandle *handle)
|
||||
GdkPopupLayout *layout;
|
||||
GdkRectangle rect;
|
||||
GtkRequisition req;
|
||||
double x, y;
|
||||
GtkWidget *parent;
|
||||
|
||||
gtk_widget_get_preferred_size (widget, NULL, &req);
|
||||
gtk_text_handle_get_padding (handle, &handle->border);
|
||||
|
||||
rect.x = handle->pointing_to.x;
|
||||
rect.y = handle->pointing_to.y + handle->pointing_to.height - handle->border.top;
|
||||
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;
|
||||
rect.width = req.width - handle->border.left - handle->border.right;
|
||||
rect.height = 1;
|
||||
|
||||
gtk_widget_translate_coordinates (gtk_widget_get_parent (widget),
|
||||
gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW),
|
||||
rect.x, rect.y, &x, &y);
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
|
||||
if (handle->role == GTK_TEXT_HANDLE_ROLE_CURSOR)
|
||||
rect.x -= rect.width / 2;
|
||||
else if ((handle->role == GTK_TEXT_HANDLE_ROLE_SELECTION_END &&
|
||||
|
Loading…
Reference in New Issue
Block a user