summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-03-23 17:18:55 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-03-24 20:49:08 -0400
commit3d37f08f38c10923cc8b1e5fcc999b8b76d75533 (patch)
tree2a082260ca105447b633d1af8d1ac0c2969b6ba1 /gdk
parent160f1e581aa100378691da135cc99b2c11c82cc1 (diff)
downloadgtk+-3d37f08f38c10923cc8b1e5fcc999b8b76d75533.tar.gz
Remove gdk_device_warp
This was only ever implemented on X11, and is not something we want to encourage apps to do, ever.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/broadway/gdkdevice-broadway.c11
-rw-r--r--gdk/gdkdevice.c28
-rw-r--r--gdk/gdkdevice.h5
-rw-r--r--gdk/gdkdeviceprivate.h3
-rw-r--r--gdk/wayland/gdkdevice-wayland.c8
-rw-r--r--gdk/x11/gdkdevice-core-x11.c24
-rw-r--r--gdk/x11/gdkdevice-xi2.c22
-rw-r--r--gdk/x11/gdkdrag-x11.c16
8 files changed, 15 insertions, 102 deletions
diff --git a/gdk/broadway/gdkdevice-broadway.c b/gdk/broadway/gdkdevice-broadway.c
index 563002c704..2171ca90f6 100644
--- a/gdk/broadway/gdkdevice-broadway.c
+++ b/gdk/broadway/gdkdevice-broadway.c
@@ -36,9 +36,6 @@ static void gdk_broadway_device_get_state (GdkDevice *device,
static void gdk_broadway_device_set_surface_cursor (GdkDevice *device,
GdkSurface *surface,
GdkCursor *cursor);
-static void gdk_broadway_device_warp (GdkDevice *device,
- gdouble x,
- gdouble y);
static void gdk_broadway_device_query_state (GdkDevice *device,
GdkSurface *surface,
GdkSurface **child_surface,
@@ -73,7 +70,6 @@ gdk_broadway_device_class_init (GdkBroadwayDeviceClass *klass)
device_class->get_history = gdk_broadway_device_get_history;
device_class->get_state = gdk_broadway_device_get_state;
device_class->set_surface_cursor = gdk_broadway_device_set_surface_cursor;
- device_class->warp = gdk_broadway_device_warp;
device_class->query_state = gdk_broadway_device_query_state;
device_class->grab = gdk_broadway_device_grab;
device_class->ungrab = gdk_broadway_device_ungrab;
@@ -127,13 +123,6 @@ gdk_broadway_device_set_surface_cursor (GdkDevice *device,
}
static void
-gdk_broadway_device_warp (GdkDevice *device,
- gdouble x,
- gdouble y)
-{
-}
-
-static void
gdk_broadway_device_query_state (GdkDevice *device,
GdkSurface *surface,
GdkSurface **child_surface,
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index 54bcc0b344..7544c4e012 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -1425,34 +1425,6 @@ gdk_device_ungrab (GdkDevice *device,
GDK_DEVICE_GET_CLASS (device)->ungrab (device, time_);
}
-/**
- * gdk_device_warp:
- * @device: the device to warp.
- * @x: the X coordinate of the destination.
- * @y: the Y coordinate of the destination.
- *
- * Warps @device in @display to the point @x,@y,
- * unless the device is confined to a surface by a grab,
- * in which case it will be moved
- * as far as allowed by the grab. Warping the pointer
- * creates events as if the user had moved the mouse
- * instantaneously to the destination.
- *
- * Note that the pointer should normally be under the
- * control of the user. This function was added to cover
- * some rare use cases like keyboard navigation support
- * for the color picker in the #GtkColorSelectionDialog.
- **/
-void
-gdk_device_warp (GdkDevice *device,
- gint x,
- gint y)
-{
- g_return_if_fail (GDK_IS_DEVICE (device));
-
- GDK_DEVICE_GET_CLASS (device)->warp (device, x, y);
-}
-
/* Private API */
void
_gdk_device_reset_axes (GdkDevice *device)
diff --git a/gdk/gdkdevice.h b/gdk/gdkdevice.h
index c52ddababa..f491189fdf 100644
--- a/gdk/gdkdevice.h
+++ b/gdk/gdkdevice.h
@@ -237,11 +237,6 @@ void gdk_device_ungrab (GdkDevice *device,
guint32 time_);
GDK_AVAILABLE_IN_ALL
-void gdk_device_warp (GdkDevice *device,
- gint x,
- gint y);
-
-GDK_AVAILABLE_IN_ALL
GdkSurface *gdk_device_get_last_event_surface (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
diff --git a/gdk/gdkdeviceprivate.h b/gdk/gdkdeviceprivate.h
index 0fef98bb00..70c29b7e85 100644
--- a/gdk/gdkdeviceprivate.h
+++ b/gdk/gdkdeviceprivate.h
@@ -86,9 +86,6 @@ struct _GdkDeviceClass
GdkSurface *surface,
GdkCursor *cursor);
- void (* warp) (GdkDevice *device,
- gdouble x,
- gdouble y);
void (* query_state) (GdkDevice *device,
GdkSurface *surface,
GdkSurface **child_surface,
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index f1dab93f1b..317a285f96 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -518,13 +518,6 @@ gdk_wayland_device_set_surface_cursor (GdkDevice *device,
}
static void
-gdk_wayland_device_warp (GdkDevice *device,
- gdouble x,
- gdouble y)
-{
-}
-
-static void
get_coordinates (GdkDevice *device,
double *x,
double *y,
@@ -871,7 +864,6 @@ gdk_wayland_device_class_init (GdkWaylandDeviceClass *klass)
device_class->get_history = gdk_wayland_device_get_history;
device_class->get_state = gdk_wayland_device_get_state;
device_class->set_surface_cursor = gdk_wayland_device_set_surface_cursor;
- device_class->warp = gdk_wayland_device_warp;
device_class->query_state = gdk_wayland_device_query_state;
device_class->grab = gdk_wayland_device_grab;
device_class->ungrab = gdk_wayland_device_ungrab;
diff --git a/gdk/x11/gdkdevice-core-x11.c b/gdk/x11/gdkdevice-core-x11.c
index 58196e43e6..0b8bd8d4f7 100644
--- a/gdk/x11/gdkdevice-core-x11.c
+++ b/gdk/x11/gdkdevice-core-x11.c
@@ -52,9 +52,6 @@ static void gdk_x11_device_core_get_state (GdkDevice *device,
static void gdk_x11_device_core_set_surface_cursor (GdkDevice *device,
GdkSurface *surface,
GdkCursor *cursor);
-static void gdk_x11_device_core_warp (GdkDevice *device,
- gdouble x,
- gdouble y);
static void gdk_x11_device_core_query_state (GdkDevice *device,
GdkSurface *surface,
GdkSurface **child_surface,
@@ -88,7 +85,6 @@ gdk_x11_device_core_class_init (GdkX11DeviceCoreClass *klass)
device_class->get_history = gdk_x11_device_core_get_history;
device_class->get_state = gdk_x11_device_core_get_state;
device_class->set_surface_cursor = gdk_x11_device_core_set_surface_cursor;
- device_class->warp = gdk_x11_device_core_warp;
device_class->query_state = gdk_x11_device_core_query_state;
device_class->grab = gdk_x11_device_core_grab;
device_class->ungrab = gdk_x11_device_core_ungrab;
@@ -224,26 +220,6 @@ gdk_x11_device_core_set_surface_cursor (GdkDevice *device,
}
static void
-gdk_x11_device_core_warp (GdkDevice *device,
- gdouble x,
- gdouble y)
-{
- GdkDisplay *display;
- Display *xdisplay;
- Window dest;
- GdkX11Screen *screen;
-
- display = gdk_device_get_display (device);
- xdisplay = GDK_DISPLAY_XDISPLAY (display);
- screen = GDK_X11_DISPLAY (display)->screen;
- dest = GDK_SCREEN_XROOTWIN (screen);
-
- XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0,
- round (x * screen->surface_scale),
- round (y * screen->surface_scale));
-}
-
-static void
gdk_x11_device_core_query_state (GdkDevice *device,
GdkSurface *surface,
GdkSurface **child_surface,
diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c
index 9abb0e82dd..255cad2ba4 100644
--- a/gdk/x11/gdkdevice-xi2.c
+++ b/gdk/x11/gdkdevice-xi2.c
@@ -77,9 +77,6 @@ static void gdk_x11_device_xi2_get_state (GdkDevice *device,
static void gdk_x11_device_xi2_set_surface_cursor (GdkDevice *device,
GdkSurface *surface,
GdkCursor *cursor);
-static void gdk_x11_device_xi2_warp (GdkDevice *device,
- gdouble x,
- gdouble y);
static void gdk_x11_device_xi2_query_state (GdkDevice *device,
GdkSurface *surface,
GdkSurface **child_surface,
@@ -123,7 +120,6 @@ gdk_x11_device_xi2_class_init (GdkX11DeviceXI2Class *klass)
device_class->get_state = gdk_x11_device_xi2_get_state;
device_class->set_surface_cursor = gdk_x11_device_xi2_set_surface_cursor;
- device_class->warp = gdk_x11_device_xi2_warp;
device_class->query_state = gdk_x11_device_xi2_query_state;
device_class->grab = gdk_x11_device_xi2_grab;
device_class->ungrab = gdk_x11_device_xi2_ungrab;
@@ -293,24 +289,6 @@ gdk_x11_device_xi2_set_surface_cursor (GdkDevice *device,
}
static void
-gdk_x11_device_xi2_warp (GdkDevice *device,
- gdouble x,
- gdouble y)
-{
- GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
- GdkDisplay *display = gdk_device_get_display (device);
- GdkX11Screen *screen = GDK_X11_DISPLAY (display)->screen;
- Window dest = GDK_DISPLAY_XROOTWIN (display);
-
- XIWarpPointer (GDK_SCREEN_XDISPLAY (screen),
- device_xi2->device_id,
- None, dest,
- 0, 0, 0, 0,
- round (x * screen->surface_scale),
- round (y * screen->surface_scale));
-}
-
-static void
gdk_x11_device_xi2_query_state (GdkDevice *device,
GdkSurface *surface,
GdkSurface **child_surface,
diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c
index 57fff0c696..db2abcdc5c 100644
--- a/gdk/x11/gdkdrag-x11.c
+++ b/gdk/x11/gdkdrag-x11.c
@@ -41,6 +41,7 @@
#include "gdkselectioninputstream-x11.h"
#include "gdkselectionoutputstream-x11.h"
+#include <math.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
@@ -2342,9 +2343,22 @@ gdk_dnd_handle_key_event (GdkDrag *drag,
if (dx != 0 || dy != 0)
{
+ GdkDisplay *display;
+ Display *xdisplay;
+ GdkX11Screen *screen;
+ Window dest;
+
x11_drag->last_x += dx;
x11_drag->last_y += dy;
- gdk_device_warp (pointer, x11_drag->last_x, x11_drag->last_y);
+
+ display = gdk_event_get_display ((GdkEvent *)event);
+ xdisplay = GDK_DISPLAY_XDISPLAY (display);
+ screen = GDK_X11_DISPLAY (display)->screen;
+ dest = GDK_SCREEN_XROOTWIN (screen);
+
+ XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0,
+ round (x11_drag->last_x * screen->surface_scale),
+ round (x11_drag->last_y * screen->surface_scale));
}
gdk_drag_update (drag, x11_drag->last_x, x11_drag->last_y, state,