From 71bad81affe4bbd14ab7b98d617eb10213c4c6bf Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 17 May 2020 17:49:02 -0400 Subject: [PATCH] gdk: Make gdk_drag_begin take doubles This is a better fit to the way we treat coordinates everywhere else. --- gdk/broadway/gdkdnd-broadway.c | 4 ++-- gdk/broadway/gdkprivate-broadway.h | 4 ++-- gdk/gdkdrag.h | 4 ++-- gdk/gdksurface.c | 4 ++-- gdk/gdksurfaceprivate.h | 12 ++++++------ gdk/wayland/gdkdrag-wayland.c | 4 ++-- gdk/wayland/gdkprivate-wayland.h | 4 ++-- gdk/win32/gdkdrag-win32.c | 8 ++++---- gdk/win32/gdkprivate-win32.h | 4 ++-- gdk/x11/gdkdrag-x11.c | 8 ++++---- gdk/x11/gdkprivate-x11.h | 4 ++-- 11 files changed, 30 insertions(+), 30 deletions(-) diff --git a/gdk/broadway/gdkdnd-broadway.c b/gdk/broadway/gdkdnd-broadway.c index 04db887b26..7d7ccdc637 100644 --- a/gdk/broadway/gdkdnd-broadway.c +++ b/gdk/broadway/gdkdnd-broadway.c @@ -87,8 +87,8 @@ _gdk_broadway_surface_drag_begin (GdkSurface *surface, GdkDevice *device, GdkContentProvider *content, GdkDragAction actions, - gint dx, - gint dy) + double dx, + double dy) { GdkDrag *new_context; diff --git a/gdk/broadway/gdkprivate-broadway.h b/gdk/broadway/gdkprivate-broadway.h index 5a4499b408..0a3b6d8b9d 100644 --- a/gdk/broadway/gdkprivate-broadway.h +++ b/gdk/broadway/gdkprivate-broadway.h @@ -51,8 +51,8 @@ GdkDrag * _gdk_broadway_surface_drag_begin (GdkSurface *surface, GdkDevice *device, GdkContentProvider *content, GdkDragAction actions, - gint dx, - gint dy); + double dx, + double dy); void _gdk_broadway_surface_translate (GdkSurface *surface, cairo_region_t *area, gint dx, diff --git a/gdk/gdkdrag.h b/gdk/gdkdrag.h index 2c093c4eb2..a3aea2ad7e 100644 --- a/gdk/gdkdrag.h +++ b/gdk/gdkdrag.h @@ -76,8 +76,8 @@ GdkDrag * gdk_drag_begin (GdkSurface *surface, GdkDevice *device, GdkContentProvider *content, GdkDragAction actions, - gint dx, - gint dy); + double dx, + double dy); GDK_AVAILABLE_IN_ALL void gdk_drag_drop_done (GdkDrag *drag, diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c index 86d6277f7e..7f89bedb8d 100644 --- a/gdk/gdksurface.c +++ b/gdk/gdksurface.c @@ -2398,8 +2398,8 @@ gdk_drag_begin (GdkSurface *surface, GdkDevice *device, GdkContentProvider *content, GdkDragAction actions, - gint dx, - gint dy) + double dx, + double dy) { g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL); g_return_val_if_fail (GDK_IS_DEVICE (device), NULL); diff --git a/gdk/gdksurfaceprivate.h b/gdk/gdksurfaceprivate.h index 5685d781f9..e93fe4f625 100644 --- a/gdk/gdksurfaceprivate.h +++ b/gdk/gdksurfaceprivate.h @@ -149,12 +149,12 @@ struct _GdkSurfaceClass gboolean (* beep) (GdkSurface *surface); void (* destroy_notify) (GdkSurface *surface); - GdkDrag * (* drag_begin) (GdkSurface *surface, - GdkDevice *device, - GdkContentProvider*content, - GdkDragAction actions, - gint dx, - gint dy); + GdkDrag * (* drag_begin) (GdkSurface *surface, + GdkDevice *device, + GdkContentProvider *content, + GdkDragAction actions, + double dx, + double dy); gint (* get_scale_factor) (GdkSurface *surface); void (* get_unscaled_size) (GdkSurface *surface, diff --git a/gdk/wayland/gdkdrag-wayland.c b/gdk/wayland/gdkdrag-wayland.c index 320ae27a9a..e09129f02f 100644 --- a/gdk/wayland/gdkdrag-wayland.c +++ b/gdk/wayland/gdkdrag-wayland.c @@ -352,8 +352,8 @@ _gdk_wayland_surface_drag_begin (GdkSurface *surface, GdkDevice *device, GdkContentProvider *content, GdkDragAction actions, - gint dx, - gint dy) + double dx, + double dy) { GdkWaylandDrag *drag_wayland; GdkDrag *drag; diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h index 47079bcfa6..a824f7bb7d 100644 --- a/gdk/wayland/gdkprivate-wayland.h +++ b/gdk/wayland/gdkprivate-wayland.h @@ -103,8 +103,8 @@ GdkDrag *_gdk_wayland_surface_drag_begin (GdkSurface *surface, GdkDevice *device, GdkContentProvider *content, GdkDragAction actions, - gint dx, - gint dy); + double dx, + double dy); void _gdk_wayland_surface_offset_next_wl_buffer (GdkSurface *surface, int x, int y); diff --git a/gdk/win32/gdkdrag-win32.c b/gdk/win32/gdkdrag-win32.c index c8074444dc..b07f19d24e 100644 --- a/gdk/win32/gdkdrag-win32.c +++ b/gdk/win32/gdkdrag-win32.c @@ -1709,8 +1709,8 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface, GdkDevice *device, GdkContentProvider *content, GdkDragAction actions, - gint dx, - gint dy) + double dx, + double dy) { GdkDrag *drag; GdkWin32Drag *drag_win32; @@ -1731,8 +1731,8 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface, GDK_NOTE (DND, g_print ("_gdk_win32_surface_drag_begin\n")); gdk_device_get_position (device, &px, &py); - x_root = round (px) + dx; - y_root = round (py) + dy; + 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/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h index ea86a917a3..e9d92d0df6 100644 --- a/gdk/win32/gdkprivate-win32.h +++ b/gdk/win32/gdkprivate-win32.h @@ -395,8 +395,8 @@ GdkDrag *_gdk_win32_surface_drag_begin (GdkSurface *window, GdkDevice *device, GdkContentProvider *content, GdkDragAction actions, - gint x_root, - gint y_root); + double x_root, + double y_root); /* Stray GdkWin32Screen members */ gboolean _gdk_win32_get_setting (const gchar *name, GValue *value); diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c index c15673f7ee..cbbe0414ab 100644 --- a/gdk/x11/gdkdrag-x11.c +++ b/gdk/x11/gdkdrag-x11.c @@ -1985,8 +1985,8 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface, GdkDevice *device, GdkContentProvider *content, GdkDragAction actions, - gint dx, - gint dy) + double dx, + double dy) { GdkX11Drag *x11_drag; GdkDrag *drag; @@ -2013,8 +2013,8 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface, _gdk_device_query_state (device, surface, NULL, &px, &py, NULL); gdk_x11_surface_get_root_coords (surface, - round (px) + dx, - round (py) + dy, + round (px + dx), + round (py + dy), &x_root, &y_root); diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h index 667b14a142..7b8fbc7711 100644 --- a/gdk/x11/gdkprivate-x11.h +++ b/gdk/x11/gdkprivate-x11.h @@ -223,8 +223,8 @@ GdkDrag * _gdk_x11_surface_drag_begin (GdkSurface *window, GdkDevice *device, GdkContentProvider *content, GdkDragAction actions, - gint dx, - gint dy); + double dx, + double dy); void gdk_x11_surface_get_root_coords (GdkSurface *surface, gint x,