diff options
author | Timm Bäder <mail@baedert.org> | 2019-02-03 06:47:57 +0100 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2019-02-04 17:05:30 +0100 |
commit | 47ba423eca27be751a8fb9a3ad2f73fb483b67e6 (patch) | |
tree | 544a207635bbca826a9cb952fa07223235aa2c9b /gtk/gtktooltip.c | |
parent | 489e87baea75ba003746f6ab958793ff0c5e261d (diff) | |
download | gtk+-47ba423eca27be751a8fb9a3ad2f73fb483b67e6.tar.gz |
tooltip: Use gtk_widget_compute_bounds to get tootip widget anchor
Instead of using gtk_widget_get_allocated_width/height, which might
return the wrong box for the tooltip widget.
Diffstat (limited to 'gtk/gtktooltip.c')
-rw-r--r-- | gtk/gtktooltip.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c index 07f535ada5..2b9e6c0a2e 100644 --- a/gtk/gtktooltip.c +++ b/gtk/gtktooltip.c @@ -570,6 +570,7 @@ gtk_tooltip_position (GtkTooltip *tooltip, GdkDevice *device) { GtkSettings *settings; + graphene_rect_t anchor_bounds; GdkRectangle anchor_rect; GdkSurface *surface; GdkSurface *effective_toplevel; @@ -584,12 +585,11 @@ gtk_tooltip_position (GtkTooltip *tooltip, tooltip->tooltip_widget = new_tooltip_widget; toplevel = _gtk_widget_get_toplevel (new_tooltip_widget); - gtk_widget_translate_coordinates (new_tooltip_widget, toplevel, - 0, 0, - &anchor_rect.x, &anchor_rect.y); - - anchor_rect.width = gtk_widget_get_allocated_width (new_tooltip_widget); - anchor_rect.height = gtk_widget_get_allocated_height (new_tooltip_widget); + gtk_widget_compute_bounds (new_tooltip_widget, toplevel, &anchor_bounds); + anchor_rect = (GdkRectangle) { + floorf (anchor_bounds.origin.x), floorf (anchor_bounds.origin.y), + ceilf (anchor_bounds.size.width), ceilf (anchor_bounds.size.height) + }; settings = gtk_settings_get_for_display (display); g_object_get (settings, |