summaryrefslogtreecommitdiff
path: root/gtk/gtktooltip.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-03-25 08:32:50 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-03-26 18:08:32 -0400
commit2d10a7b9c469d6a48bdd8b5721cc00d437dcfe0a (patch)
tree1f832ba3f5249c7caa35d9a5c0935b86651da96a /gtk/gtktooltip.c
parent54a969e0ad676c63fedc6c2d8e104ef1fa39b107 (diff)
downloadgtk+-2d10a7b9c469d6a48bdd8b5721cc00d437dcfe0a.tar.gz
gtk: Stop using gdk_surface_get_device_position
Use the double version directly.
Diffstat (limited to 'gtk/gtktooltip.c')
-rw-r--r--gtk/gtktooltip.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index ee37687b68..c072d46106 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -618,6 +618,7 @@ gtk_tooltip_position (GtkTooltip *tooltip,
const int max_x_distance = 32;
/* Max 48x48 icon + default padding */
const int max_anchor_rect_height = 48 + 8;
+ double px, py;
int pointer_x, pointer_y;
/*
@@ -633,9 +634,11 @@ gtk_tooltip_position (GtkTooltip *tooltip,
* far away from the pointer position.
*/
effective_toplevel = _gtk_widget_get_surface (toplevel);
- gdk_surface_get_device_position (effective_toplevel,
- device,
- &pointer_x, &pointer_y, NULL);
+ gdk_surface_get_device_position_double (effective_toplevel,
+ device,
+ &px, &py, NULL);
+ pointer_x = round (px);
+ pointer_y = round (py);
if (anchor_rect.height > max_anchor_rect_height)
{
@@ -674,6 +677,7 @@ gtk_tooltip_position (GtkTooltip *tooltip,
static void
gtk_tooltip_show_tooltip (GdkDisplay *display)
{
+ double px, py;
gint x, y;
GdkSurface *surface;
GtkWidget *tooltip_widget;
@@ -693,7 +697,9 @@ gtk_tooltip_show_tooltip (GdkDisplay *display)
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
- gdk_surface_get_device_position (surface, device, &x, &y, NULL);
+ gdk_surface_get_device_position_double (surface, device, &px, &py, NULL);
+ x = round (px);
+ y = round (py);
gdk_surface_get_root_coords (surface, x, y, &tx, &ty);
tooltip_widget = _gtk_widget_find_at_coords (surface, x, y, &x, &y);