[Spice-devel] [PATCH spice-gtk 5/5] gtk: Avoid deprecated gdk_display_warp_pointer
Pavel Grunt
pgrunt at redhat.com
Fri Dec 16 17:46:53 UTC 2016
---
src/spice-widget.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 17cda84..7ebd5f1 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -1113,6 +1113,24 @@ static void try_mouse_grab(SpiceDisplay *display)
d->mouse_last_y = -1;
}
+static void spice_display_warp_pointer(SpiceDisplay *display,
+ GdkScreen *screen,
+ gint x,
+ gint y)
+{
+#if GTK_CHECK_VERSION(3, 20, 0)
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ gdk_device_warp(gdk_seat_get_pointer(spice_display_get_default_seat(display)),
+ screen,
+ x, y);
+ G_GNUC_END_IGNORE_DEPRECATIONS
+#else
+ gdk_display_warp_pointer(gtk_widget_get_display(GTK_WIDGET(display)),
+ screen,
+ x, y);
+#endif
+}
+
static void mouse_wrap(SpiceDisplay *display, GdkEventMotion *motion)
{
SpiceDisplayPrivate *d = display->priv;
@@ -1136,11 +1154,7 @@ static void mouse_wrap(SpiceDisplay *display, GdkEventMotion *motion)
/* FIXME: we try our best to ignore that next pointer move event.. */
gdk_display_sync(gdk_screen_get_display(screen));
- /* FIXME: gdk_display_warp_pointer() is deprecated */
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gdk_display_warp_pointer(gtk_widget_get_display(GTK_WIDGET(display)),
- screen, xr, yr);
- G_GNUC_END_IGNORE_DEPRECATIONS
+ spice_display_warp_pointer(display, screen, xr, yr);
d->mouse_last_x = -1;
d->mouse_last_y = -1;
}
@@ -1179,9 +1193,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
y + d->mouse_guest_y * s,
&x, &y);
- gdk_display_warp_pointer(gtk_widget_get_display(GTK_WIDGET(display)),
- gtk_widget_get_screen(GTK_WIDGET(display)),
- x, y);
+ spice_display_warp_pointer(display, gtk_widget_get_screen(GTK_WIDGET(display)), x, y);
g_signal_emit(display, signals[SPICE_DISPLAY_MOUSE_GRAB], 0, false);
spice_gtk_session_set_pointer_grabbed(d->gtk_session, false);
--
2.11.0
More information about the Spice-devel
mailing list