All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Cole Robinson <crobinso@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 10/12] ui: gtk: Fix some deprecation warnings
Date: Tue, 10 May 2016 07:51:55 +0200	[thread overview]
Message-ID: <1462859517-30207-11-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1462859517-30207-1-git-send-email-kraxel@redhat.com>

From: Cole Robinson <crobinso@redhat.com>

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 <crobinso@redhat.com>
Message-id: d6dec24220a4e1449a0172119c10c48e145c0f6f.1462557436.git.crobinso@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

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
-- 
1.8.3.1

  parent reply	other threads:[~2016-05-10  5:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-10  5:51 [Qemu-devel] [PULL 00/12] ui patch queue Gerd Hoffmann
2016-05-10  5:51 ` [Qemu-devel] [PULL 01/12] ui: gtk: fix crash when terminal inner-border is NULL Gerd Hoffmann
2016-05-10  5:51 ` [Qemu-devel] [PULL 02/12] ui: sdl2: Release grab before opening console window Gerd Hoffmann
2016-05-10  5:51 ` [Qemu-devel] [PULL 03/12] configure: build SDL if only SDL2 available Gerd Hoffmann
2016-05-10  5:51 ` [Qemu-devel] [PULL 04/12] configure: error on unknown --with-sdlabi value Gerd Hoffmann
2016-05-10  5:51 ` [Qemu-devel] [PULL 05/12] configure: add echo_version helper Gerd Hoffmann
2016-05-10  5:51 ` [Qemu-devel] [PULL 06/12] configure: report GTK version Gerd Hoffmann
2016-05-10  5:51 ` [Qemu-devel] [PULL 07/12] configure: report SDL version Gerd Hoffmann
2016-05-10  5:51 ` [Qemu-devel] [PULL 08/12] configure: support vte-2.91 Gerd Hoffmann
2016-05-10  5:51 ` [Qemu-devel] [PULL 09/12] ui: gtk: Fix a runtime warning on vte >= 0.37 Gerd Hoffmann
2016-05-10  5:51 ` Gerd Hoffmann [this message]
2016-05-10  5:51 ` [Qemu-devel] [PULL 11/12] ui/gtk: copy to clipboard support Gerd Hoffmann
2016-05-10  5:51 ` [Qemu-devel] [PULL 12/12] spice/gl: add & use qemu_spice_gl_monitor_config Gerd Hoffmann
2016-05-10 14:08 ` [Qemu-devel] [PULL 00/12] ui patch queue Cole Robinson
2016-05-12 13:26 ` Peter Maydell
2016-05-12 13:57   ` Gerd Hoffmann
2016-05-13  7:56     ` Gerd Hoffmann
2016-05-13 10:13       ` 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=1462859517-30207-11-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=crobinso@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.