From patchwork Fri May 6 18:03:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 67305 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp450000qge; Fri, 6 May 2016 11:10:09 -0700 (PDT) X-Received: by 10.194.81.135 with SMTP id a7mr21262953wjy.170.1462558209519; Fri, 06 May 2016 11:10:09 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u77si12136835wmu.26.2016.05.06.11.10.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 06 May 2016 11:10:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:59622 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aykCG-0007p5-5M for patch@linaro.org; Fri, 06 May 2016 14:09:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayk7K-00078H-Ul for qemu-devel@nongnu.org; Fri, 06 May 2016 14:04:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ayk79-0001Tk-6O for qemu-devel@nongnu.org; Fri, 06 May 2016 14:04:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37542) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ayk78-0001PI-Vr for qemu-devel@nongnu.org; Fri, 06 May 2016 14:04:35 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (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 D4D7462643 for ; Fri, 6 May 2016 18:04:23 +0000 (UTC) Received: from colepc.redhat.com (ovpn-113-44.phx2.redhat.com [10.3.113.44]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u46I4E4j019036; Fri, 6 May 2016 14:04:23 -0400 From: Cole Robinson To: qemu-devel@nongnu.org Date: Fri, 6 May 2016 14:03:14 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 06 May 2016 18:04:23 +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] [PATCH 10/10] ui: gtk: Fix some deprecation warnings 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: Gerd Hoffmann , Cole Robinson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" All device manager APIs are deprecated now. Much of our usage is just to get the current pointer, so centralize that logic and use the new seat APIs Signed-off-by: Cole Robinson --- The remaining warnings look like they'll take a bit more effort ui/gtk.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/ui/gtk.c b/ui/gtk.c index d156c8a..d3d7f62 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -476,12 +476,21 @@ static void gd_refresh(DisplayChangeListener *dcl) } #if GTK_CHECK_VERSION(3, 0, 0) +static GdkDevice *gd_get_pointer(GdkDisplay *dpy) +{ +#if GTK_CHECK_VERSION(3, 20, 0) + return gdk_seat_get_pointer(gdk_display_get_default_seat(dpy)); +#else + return gdk_device_manager_get_client_pointer( + gdk_display_get_device_manager(dpy)); +#endif +} + static void gd_mouse_set(DisplayChangeListener *dcl, int x, int y, int visible) { VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); GdkDisplay *dpy; - GdkDeviceManager *mgr; gint x_root, y_root; if (qemu_input_is_absolute()) { @@ -489,10 +498,9 @@ static void gd_mouse_set(DisplayChangeListener *dcl, } dpy = gtk_widget_get_display(vc->gfx.drawing_area); - mgr = gdk_display_get_device_manager(dpy); gdk_window_get_root_coords(gtk_widget_get_window(vc->gfx.drawing_area), x, y, &x_root, &y_root); - gdk_device_warp(gdk_device_manager_get_client_pointer(mgr), + gdk_device_warp(gd_get_pointer(dpy), gtk_widget_get_screen(vc->gfx.drawing_area), x_root, y_root); vc->s->last_x = x; @@ -1402,7 +1410,6 @@ static void gd_grab_pointer(VirtualConsole *vc, const char *reason) } #if GTK_CHECK_VERSION(3, 0, 0) - GdkDeviceManager *mgr = gdk_display_get_device_manager(display); gd_grab_devices(vc, true, GDK_SOURCE_MOUSE, GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | @@ -1410,7 +1417,7 @@ static void gd_grab_pointer(VirtualConsole *vc, const char *reason) GDK_BUTTON_MOTION_MASK | GDK_SCROLL_MASK, vc->s->null_cursor); - gdk_device_get_position(gdk_device_manager_get_client_pointer(mgr), + gdk_device_get_position(gd_get_pointer(display), NULL, &vc->s->grab_x_root, &vc->s->grab_y_root); #else gdk_pointer_grab(gtk_widget_get_window(vc->gfx.drawing_area), @@ -1442,9 +1449,8 @@ static void gd_ungrab_pointer(GtkDisplayState *s) GdkDisplay *display = gtk_widget_get_display(vc->gfx.drawing_area); #if GTK_CHECK_VERSION(3, 0, 0) - GdkDeviceManager *mgr = gdk_display_get_device_manager(display); gd_grab_devices(vc, false, GDK_SOURCE_MOUSE, 0, NULL); - gdk_device_warp(gdk_device_manager_get_client_pointer(mgr), + gdk_device_warp(gd_get_pointer(display), gtk_widget_get_screen(vc->gfx.drawing_area), vc->s->grab_x_root, vc->s->grab_y_root); #else