aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorIgor Mitsyanko <i.mitsyanko@gmail.com>2013-05-10 18:59:45 +0400
committerAnthony Liguori <aliguori@us.ibm.com>2013-05-13 09:52:49 -0500
commitb087143b4d010451208264b7c841436aafe1cbb1 (patch)
tree861fd1462a9c3678613f75a37ea66e7f88045993 /ui
parent9e1c2ec8fd8d9a9ee299ea86c5f6c986fe25e838 (diff)
ui/gtk.c: do not use gdk_display_warp_pointer when GTK ver >3.0
Commit 9697f5d2d38e5dd1e64e8e0d64436e6d44e7b1fe "gtk: custom cursor support" introduced unconditional usage of gdk_display_warp_pointer(). This function is marked as deprecated since GTK-3.0, and triggers warning (error with -Werror) during compilation. Conditionally change gdk_display_warp_pointer() method usage to gdk_device_warp usage, as suggested by compiler. Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com> Message-id: 1368197985-44608-1-git-send-email-i.mitsyanko@gmail.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/ui/gtk.c b/ui/gtk.c
index e12f22838e..841f912146 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -331,6 +331,24 @@ static void gd_refresh(DisplayChangeListener *dcl)
graphic_hw_update(dcl->con);
}
+#if GTK_CHECK_VERSION(3, 0, 0)
+static void gd_mouse_set(DisplayChangeListener *dcl,
+ int x, int y, int visible)
+{
+ GtkDisplayState *s = container_of(dcl, GtkDisplayState, dcl);
+ GdkDisplay *dpy;
+ GdkDeviceManager *mgr;
+ gint x_root, y_root;
+
+ dpy = gtk_widget_get_display(s->drawing_area);
+ mgr = gdk_display_get_device_manager(dpy);
+ gdk_window_get_root_coords(gtk_widget_get_window(s->drawing_area),
+ x, y, &x_root, &y_root);
+ gdk_device_warp(gdk_device_manager_get_client_pointer(mgr),
+ gtk_widget_get_screen(s->drawing_area),
+ x, y);
+}
+#else
static void gd_mouse_set(DisplayChangeListener *dcl,
int x, int y, int visible)
{
@@ -343,6 +361,7 @@ static void gd_mouse_set(DisplayChangeListener *dcl,
gtk_widget_get_screen(s->drawing_area),
x_root, y_root);
}
+#endif
static void gd_cursor_define(DisplayChangeListener *dcl,
QEMUCursor *c)