[Spice-devel] [PATCH spice-gtk v2 3/5] gtk: Use gdk_device_warp

Pavel Grunt pgrunt at redhat.com
Mon Dec 19 16:26:34 UTC 2016


gdk_display_warp_pointer has been deprecated since Gtk 3.0
---
 src/spice-widget.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/spice-widget.c b/src/spice-widget.c
index ddaa10f..bc705f8 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -119,6 +119,7 @@ static void release_keys(SpiceDisplay *display);
 static void size_allocate(GtkWidget *widget, GtkAllocation *conf, gpointer data);
 static gboolean draw_event(GtkWidget *widget, cairo_t *cr, gpointer data);
 static void update_size_request(SpiceDisplay *display);
+static GdkDevice *spice_display_get_pointer(SpiceDisplay *display);
 
 /* ---------------------------------------------------------------- */
 
@@ -1108,11 +1109,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
+        gdk_device_warp(spice_display_get_pointer(display), screen, xr, yr);
         d->mouse_last_x = -1;
         d->mouse_last_y = -1;
     }
@@ -1148,9 +1145,9 @@ static void try_mouse_ungrab(SpiceDisplay *display)
                                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);
+    gdk_device_warp(spice_display_get_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