[gtk/wip/matthiasc/popup2] gdk: Stop using gdk_device_get_position



commit 6b06d68258660225a5f43516c69b10b8bc364a14
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Mar 25 20:26:34 2019 -0400

    gdk: Stop using gdk_device_get_position
    
    We should always use the double variant of this api.

 gdk/win32/gdkdrag-win32.c | 7 ++++---
 gdk/x11/gdkdrag-x11.c     | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/gdk/win32/gdkdrag-win32.c b/gdk/win32/gdkdrag-win32.c
index 6b9d115419..5583ac9421 100644
--- a/gdk/win32/gdkdrag-win32.c
+++ b/gdk/win32/gdkdrag-win32.c
@@ -1717,6 +1717,7 @@ _gdk_win32_surface_drag_begin (GdkSurface         *surface,
   GdkDrag *drag;
   GdkWin32Drag *drag_win32;
   GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
+  double px, py;
   int x_root, y_root;
 
   g_return_val_if_fail (surface != NULL, NULL);
@@ -1731,9 +1732,9 @@ _gdk_win32_surface_drag_begin (GdkSurface         *surface,
 
   GDK_NOTE (DND, g_print ("_gdk_win32_surface_drag_begin\n"));
 
-  gdk_device_get_position (device, &x_root, &y_root);
-  x_root += dx;
-  y_root += dy;
+  gdk_device_get_position_double (device, &px, &px);
+  x_root = round (px) + dx;
+  y_root = round (py) + dy;
 
   drag_win32->start_x = x_root;
   drag_win32->start_y = y_root;
diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c
index db2abcdc5c..4305bdaf13 100644
--- a/gdk/x11/gdkdrag-x11.c
+++ b/gdk/x11/gdkdrag-x11.c
@@ -2077,6 +2077,7 @@ _gdk_x11_surface_drag_begin (GdkSurface         *surface,
   GdkX11Drag *x11_drag;
   GdkDrag *drag;
   GdkDisplay *display;
+  double px, py;
   int x_root, y_root;
   Atom xselection;
   GdkSurface *ipc_surface;
@@ -2097,9 +2098,9 @@ _gdk_x11_surface_drag_begin (GdkSurface         *surface,
 
   precache_target_list (drag);
 
-  gdk_device_get_position (device, &x_root, &y_root);
-  x_root += dx;
-  y_root += dy;
+  gdk_device_get_position_double (device, &px, &py);
+  x_root = round (px) + dx;
+  y_root = round (py) + dy;
 
   x11_drag->start_x = x_root;
   x11_drag->start_y = y_root;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]