From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Alberto Garcia <berto@igalia.com>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 3/6] gtk: fix compilation warning with gtk 3.22.2
Date: Fri, 28 Oct 2016 14:11:35 +0200 [thread overview]
Message-ID: <1477656698-13569-4-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1477656698-13569-1-git-send-email-kraxel@redhat.com>
From: Alberto Garcia <berto@igalia.com>
gdk_screen_get_width() is deprecated since gtk 3.22.2, use
gdk_monitor_get_geometry() instead if it's available.
Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: 20161026152108.12364-1-berto@igalia.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/gtk.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index 25e6d99..dd13982 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -912,9 +912,28 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,
if (!qemu_input_is_absolute() && s->ptr_owner == vc) {
GdkScreen *screen = gtk_widget_get_screen(vc->gfx.drawing_area);
+ int screen_width, screen_height;
+
int x = (int)motion->x_root;
int y = (int)motion->y_root;
+#if GTK_CHECK_VERSION(3, 22, 0)
+ {
+ GdkDisplay *dpy = gtk_widget_get_display(widget);
+ GdkWindow *win = gtk_widget_get_window(widget);
+ GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
+ GdkRectangle geometry;
+ gdk_monitor_get_geometry(monitor, &geometry);
+ screen_width = geometry.width;
+ screen_height = geometry.height;
+ }
+#else
+ {
+ screen_width = gdk_screen_get_width(screen);
+ screen_height = gdk_screen_get_height(screen);
+ }
+#endif
+
/* In relative mode check to see if client pointer hit
* one of the screen edges, and if so move it back by
* 200 pixels. This is important because the pointer
@@ -928,10 +947,10 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,
if (y == 0) {
y += 200;
}
- if (x == (gdk_screen_get_width(screen) - 1)) {
+ if (x == (screen_width - 1)) {
x -= 200;
}
- if (y == (gdk_screen_get_height(screen) - 1)) {
+ if (y == (screen_height - 1)) {
y -= 200;
}
--
1.8.3.1
next prev parent reply other threads:[~2016-10-28 12:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-28 12:11 [Qemu-devel] [PULL 0/6] ui patch queue Gerd Hoffmann
2016-10-28 12:11 ` [Qemu-devel] [PULL 1/6] Add dots keypresses support to the baum braille device Gerd Hoffmann
2016-10-28 12:11 ` [Qemu-devel] [PULL 2/6] Defer BrlAPI tty acquisition to when guest starts using device Gerd Hoffmann
2016-10-28 12:11 ` Gerd Hoffmann [this message]
2016-10-28 12:11 ` [Qemu-devel] [PULL 4/6] ui/gtk: Fix non-working DELETE key Gerd Hoffmann
2016-10-28 12:11 ` [Qemu-devel] [PULL 5/6] curses: fix left/right arrow translation Gerd Hoffmann
2016-10-28 12:11 ` [Qemu-devel] [PULL 6/6] curses: Use cursesw instead of curses Gerd Hoffmann
2016-10-31 11:45 ` Cornelia Huck
2016-10-31 12:01 ` Samuel Thibault
2016-10-31 12:05 ` Samuel Thibault
2016-10-31 12:08 ` Cornelia Huck
2016-10-31 12:16 ` Samuel Thibault
2016-10-31 12:39 ` Samuel Thibault
2016-10-31 12:48 ` Cornelia Huck
2016-10-31 14:03 ` Samuel Thibault
2016-10-31 13:08 ` Cornelia Huck
2016-10-31 15:39 ` Samuel Thibault
2016-11-02 9:09 ` Cornelia Huck
2016-10-28 17:55 ` [Qemu-devel] [PULL 0/6] ui patch queue Peter Maydell
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=1477656698-13569-4-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=berto@igalia.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).