summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2013-02-25 15:20:40 +0000
committerAnthony Liguori <aliguori@us.ibm.com>2013-02-26 13:29:52 -0600
commit8906de769be0978fed31a0341d0a5829a4ef7ecf (patch)
tree26cfa6b00b873e265d54ed881977ca7414161744
parent530daf82c129c2a8a6fa757b3ef5a21f1f50f66a (diff)
downloadqemu-8906de769be0978fed31a0341d0a5829a4ef7ecf.tar.gz
qemu-8906de769be0978fed31a0341d0a5829a4ef7ecf.tar.bz2
qemu-8906de769be0978fed31a0341d0a5829a4ef7ecf.zip
Conditionalize use of gdk_display_warp_pointer
In GTK3 the gdk_display_warp_pointer method is deprecated. Instead we should use gdk_device_warp on the GdkDevice instead associated with the event being processed. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1361805646-6425-8-git-send-email-berrange@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--ui/gtk.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ui/gtk.c b/ui/gtk.c
index 182a16cbca..93c3b43fc4 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -501,7 +501,6 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,
}
if (!kbd_mouse_is_absolute() && gd_is_grab_active(s)) {
- GdkDisplay *display = gtk_widget_get_display(s->drawing_area);
GdkScreen *screen = gtk_widget_get_screen(s->drawing_area);
int x = (int)motion->x_root;
int y = (int)motion->y_root;
@@ -527,7 +526,13 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,
}
if (x != (int)motion->x_root || y != (int)motion->y_root) {
+#if GTK_CHECK_VERSION(3, 0, 0)
+ GdkDevice *dev = gdk_event_get_device((GdkEvent *)motion);
+ gdk_device_warp(dev, screen, x, y);
+#else
+ GdkDisplay *display = gtk_widget_get_display(widget);
gdk_display_warp_pointer(display, screen, x, y);
+#endif
s->last_x = -1;
s->last_y = -1;
return FALSE;