From patchwork Fri Oct 28 12:11:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 9401861 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 64FA560231 for ; Fri, 28 Oct 2016 12:15:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 538D62A7E5 for ; Fri, 28 Oct 2016 12:15:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 482002A7E8; Fri, 28 Oct 2016 12:15:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8666E2A7E5 for ; Fri, 28 Oct 2016 12:15:08 +0000 (UTC) Received: from localhost ([::1]:48798 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c063q-0006oc-Ro for patchwork-qemu-devel@patchwork.kernel.org; Fri, 28 Oct 2016 08:15:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c060n-0004vs-PE for qemu-devel@nongnu.org; Fri, 28 Oct 2016 08:11:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c060j-0005TH-IT for qemu-devel@nongnu.org; Fri, 28 Oct 2016 08:11:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35480) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c060j-0005S5-Dc for qemu-devel@nongnu.org; Fri, 28 Oct 2016 08:11:49 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7DC93624BB; Fri, 28 Oct 2016 12:11:47 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-56.ams2.redhat.com [10.36.116.56]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9SCBjD9004681; Fri, 28 Oct 2016 08:11:46 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 3A80780EDE; Fri, 28 Oct 2016 14:11:43 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 28 Oct 2016 14:11:35 +0200 Message-Id: <1477656698-13569-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1477656698-13569-1-git-send-email-kraxel@redhat.com> References: <1477656698-13569-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 28 Oct 2016 12:11:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/6] gtk: fix compilation warning with gtk 3.22.2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alberto Garcia , Gerd Hoffmann Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Alberto Garcia 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 Message-id: 20161026152108.12364-1-berto@igalia.com Signed-off-by: Gerd Hoffmann --- 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; }