ui/gtk.c: do not use gdk_display_warp_pointer when GTK ver >3.0

Commit 9697f5d2d3 "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>
This commit is contained in:
Igor Mitsyanko 2013-05-10 18:59:45 +04:00 committed by Anthony Liguori
parent 9e1c2ec8fd
commit b087143b4d

View File

@ -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)