From: Igor Mitsyanko <i.mitsyanko@gmail.com>
To: qemu-devel@nongnu.org
Cc: i.mitsyanko@gmail.com, aliguori@us.ibm.com, kraxel@redhat.com
Subject: [Qemu-devel] [PATCH] ui/gtk.c: do not use gdk_display_warp_pointer when GTK ver >3.0
Date: Fri, 10 May 2013 18:59:45 +0400 [thread overview]
Message-ID: <1368197985-44608-1-git-send-email-i.mitsyanko@gmail.com> (raw)
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>
---
ui/gtk.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/ui/gtk.c b/ui/gtk.c
index e12f228..841f912 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)
--
1.8.1.4
next reply other threads:[~2013-05-10 15:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-10 14:59 Igor Mitsyanko [this message]
2013-05-13 16:46 ` [Qemu-devel] [PATCH] ui/gtk.c: do not use gdk_display_warp_pointer when GTK ver >3.0 Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1368197985-44608-1-git-send-email-i.mitsyanko@gmail.com \
--to=i.mitsyanko@gmail.com \
--cc=aliguori@us.ibm.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).