Remove gdk_device_warp

This was only ever implemented on X11, and is
not something we want to encourage apps to do, ever.
This commit is contained in:
Matthias Clasen 2019-03-23 17:18:55 -04:00
parent 160f1e581a
commit 3d37f08f38
9 changed files with 15 additions and 103 deletions

View File

@ -502,7 +502,6 @@ gdk_device_get_has_cursor
gdk_device_get_n_axes gdk_device_get_n_axes
gdk_device_get_n_keys gdk_device_get_n_keys
gdk_device_get_axes gdk_device_get_axes
gdk_device_warp
gdk_device_get_seat gdk_device_get_seat
<SUBSECTION> <SUBSECTION>

View File

@ -36,9 +36,6 @@ static void gdk_broadway_device_get_state (GdkDevice *device,
static void gdk_broadway_device_set_surface_cursor (GdkDevice *device, static void gdk_broadway_device_set_surface_cursor (GdkDevice *device,
GdkSurface *surface, GdkSurface *surface,
GdkCursor *cursor); GdkCursor *cursor);
static void gdk_broadway_device_warp (GdkDevice *device,
gdouble x,
gdouble y);
static void gdk_broadway_device_query_state (GdkDevice *device, static void gdk_broadway_device_query_state (GdkDevice *device,
GdkSurface *surface, GdkSurface *surface,
GdkSurface **child_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_history = gdk_broadway_device_get_history;
device_class->get_state = gdk_broadway_device_get_state; device_class->get_state = gdk_broadway_device_get_state;
device_class->set_surface_cursor = gdk_broadway_device_set_surface_cursor; 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->query_state = gdk_broadway_device_query_state;
device_class->grab = gdk_broadway_device_grab; device_class->grab = gdk_broadway_device_grab;
device_class->ungrab = gdk_broadway_device_ungrab; device_class->ungrab = gdk_broadway_device_ungrab;
@ -126,13 +122,6 @@ gdk_broadway_device_set_surface_cursor (GdkDevice *device,
{ {
} }
static void
gdk_broadway_device_warp (GdkDevice *device,
gdouble x,
gdouble y)
{
}
static void static void
gdk_broadway_device_query_state (GdkDevice *device, gdk_broadway_device_query_state (GdkDevice *device,
GdkSurface *surface, GdkSurface *surface,

View File

@ -1425,34 +1425,6 @@ gdk_device_ungrab (GdkDevice *device,
GDK_DEVICE_GET_CLASS (device)->ungrab (device, time_); 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 */ /* Private API */
void void
_gdk_device_reset_axes (GdkDevice *device) _gdk_device_reset_axes (GdkDevice *device)

View File

@ -236,11 +236,6 @@ GDK_DEPRECATED_FOR(gdk_seat_ungrab)
void gdk_device_ungrab (GdkDevice *device, void gdk_device_ungrab (GdkDevice *device,
guint32 time_); guint32 time_);
GDK_AVAILABLE_IN_ALL
void gdk_device_warp (GdkDevice *device,
gint x,
gint y);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GdkSurface *gdk_device_get_last_event_surface (GdkDevice *device); GdkSurface *gdk_device_get_last_event_surface (GdkDevice *device);

View File

@ -86,9 +86,6 @@ struct _GdkDeviceClass
GdkSurface *surface, GdkSurface *surface,
GdkCursor *cursor); GdkCursor *cursor);
void (* warp) (GdkDevice *device,
gdouble x,
gdouble y);
void (* query_state) (GdkDevice *device, void (* query_state) (GdkDevice *device,
GdkSurface *surface, GdkSurface *surface,
GdkSurface **child_surface, GdkSurface **child_surface,

View File

@ -517,13 +517,6 @@ gdk_wayland_device_set_surface_cursor (GdkDevice *device,
gdk_wayland_device_update_surface_cursor (device); gdk_wayland_device_update_surface_cursor (device);
} }
static void
gdk_wayland_device_warp (GdkDevice *device,
gdouble x,
gdouble y)
{
}
static void static void
get_coordinates (GdkDevice *device, get_coordinates (GdkDevice *device,
double *x, double *x,
@ -871,7 +864,6 @@ gdk_wayland_device_class_init (GdkWaylandDeviceClass *klass)
device_class->get_history = gdk_wayland_device_get_history; device_class->get_history = gdk_wayland_device_get_history;
device_class->get_state = gdk_wayland_device_get_state; device_class->get_state = gdk_wayland_device_get_state;
device_class->set_surface_cursor = gdk_wayland_device_set_surface_cursor; 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->query_state = gdk_wayland_device_query_state;
device_class->grab = gdk_wayland_device_grab; device_class->grab = gdk_wayland_device_grab;
device_class->ungrab = gdk_wayland_device_ungrab; device_class->ungrab = gdk_wayland_device_ungrab;

View File

@ -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, static void gdk_x11_device_core_set_surface_cursor (GdkDevice *device,
GdkSurface *surface, GdkSurface *surface,
GdkCursor *cursor); 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, static void gdk_x11_device_core_query_state (GdkDevice *device,
GdkSurface *surface, GdkSurface *surface,
GdkSurface **child_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_history = gdk_x11_device_core_get_history;
device_class->get_state = gdk_x11_device_core_get_state; device_class->get_state = gdk_x11_device_core_get_state;
device_class->set_surface_cursor = gdk_x11_device_core_set_surface_cursor; 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->query_state = gdk_x11_device_core_query_state;
device_class->grab = gdk_x11_device_core_grab; device_class->grab = gdk_x11_device_core_grab;
device_class->ungrab = gdk_x11_device_core_ungrab; device_class->ungrab = gdk_x11_device_core_ungrab;
@ -223,26 +219,6 @@ gdk_x11_device_core_set_surface_cursor (GdkDevice *device,
xcursor); xcursor);
} }
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 static void
gdk_x11_device_core_query_state (GdkDevice *device, gdk_x11_device_core_query_state (GdkDevice *device,
GdkSurface *surface, GdkSurface *surface,

View File

@ -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, static void gdk_x11_device_xi2_set_surface_cursor (GdkDevice *device,
GdkSurface *surface, GdkSurface *surface,
GdkCursor *cursor); 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, static void gdk_x11_device_xi2_query_state (GdkDevice *device,
GdkSurface *surface, GdkSurface *surface,
GdkSurface **child_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->get_state = gdk_x11_device_xi2_get_state;
device_class->set_surface_cursor = gdk_x11_device_xi2_set_surface_cursor; 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->query_state = gdk_x11_device_xi2_query_state;
device_class->grab = gdk_x11_device_xi2_grab; device_class->grab = gdk_x11_device_xi2_grab;
device_class->ungrab = gdk_x11_device_xi2_ungrab; device_class->ungrab = gdk_x11_device_xi2_ungrab;
@ -292,24 +288,6 @@ gdk_x11_device_xi2_set_surface_cursor (GdkDevice *device,
GDK_SURFACE_XID (surface)); GDK_SURFACE_XID (surface));
} }
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 static void
gdk_x11_device_xi2_query_state (GdkDevice *device, gdk_x11_device_xi2_query_state (GdkDevice *device,
GdkSurface *surface, GdkSurface *surface,

View File

@ -41,6 +41,7 @@
#include "gdkselectioninputstream-x11.h" #include "gdkselectioninputstream-x11.h"
#include "gdkselectionoutputstream-x11.h" #include "gdkselectionoutputstream-x11.h"
#include <math.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
@ -2342,9 +2343,22 @@ gdk_dnd_handle_key_event (GdkDrag *drag,
if (dx != 0 || dy != 0) if (dx != 0 || dy != 0)
{ {
GdkDisplay *display;
Display *xdisplay;
GdkX11Screen *screen;
Window dest;
x11_drag->last_x += dx; x11_drag->last_x += dx;
x11_drag->last_y += dy; 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, gdk_drag_update (drag, x11_drag->last_x, x11_drag->last_y, state,