From patchwork Fri May 13 12:32:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 67773 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp244804qge; Fri, 13 May 2016 05:38:43 -0700 (PDT) X-Received: by 10.55.115.69 with SMTP id o66mr15709492qkc.168.1463143123807; Fri, 13 May 2016 05:38:43 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id a204si3289231qkg.246.2016.05.13.05.38.43 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 13 May 2016 05:38:43 -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]:34369 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1CMd-0006BE-CT for patch@linaro.org; Fri, 13 May 2016 08:38:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1CHH-0005CP-2j for qemu-devel@nongnu.org; Fri, 13 May 2016 08:33:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b1CH9-0006kE-0M for qemu-devel@nongnu.org; Fri, 13 May 2016 08:33:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44053) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1CH8-0006j6-NC for qemu-devel@nongnu.org; Fri, 13 May 2016 08:33:02 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 4C7BB627D4 for ; Fri, 13 May 2016 12:33:02 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4DCX1LK011758; Fri, 13 May 2016 08:33:01 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id DFDC181972; Fri, 13 May 2016 14:32:59 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 13 May 2016 14:32:50 +0200 Message-Id: <1463142777-13040-11-git-send-email-kraxel@redhat.com> In-Reply-To: <1463142777-13040-1-git-send-email-kraxel@redhat.com> References: <1463142777-13040-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 13 May 2016 12:33:02 +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 v2 10/17] 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" From: Cole Robinson 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 Message-id: d6dec24220a4e1449a0172119c10c48e145c0f6f.1462557436.git.crobinso@redhat.com Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) -- 1.8.3.1 diff --git a/ui/gtk.c b/ui/gtk.c index 28e7d28..2e360e3 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