qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Stefan Weil" <sw@weilnetz.de>,
	"Volker Rümelin" <vr_qemu@t-online.de>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [PULL 11/11] ui: increase min required GTK version to 3.22.0
Date: Wed, 20 May 2020 10:43:16 +0200	[thread overview]
Message-ID: <20200520084316.22057-12-kraxel@redhat.com> (raw)
In-Reply-To: <20200520084316.22057-1-kraxel@redhat.com>

From: Volker Rümelin <vr_qemu@t-online.de>

Based on a mail on the qemu-devel mailing list at
https://lists.nongnu.org/archive/html/qemu-devel/2020-05/msg02909.html
and some internet research the GTK3 versions on supported
platforms are:

    RHEL-7.4: 3.22.10
    RHEL-7.5: 3.22.26
    Debian (Stretch): 3.22.11
    Debian (Buster): 3.24.5
    OpenBSD (Ports): 3.22.30
    FreeBSD (Ports): 3.22.29
    OpenSUSE Leap 15: 3.22.30
    SLE12-SP2: Unknown
    SLE15: 3.22.30
    Ubuntu (Bionic): 3.22.30
    Ubuntu (Focal): 3.24.18
    macOS (Homebrew): 3.22.30

This justifies increasing the minimum required GTK version in
QEMU to 3.22.0.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 20200516072014.7766-11-vr_qemu@t-online.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 configure |  2 +-
 ui/gtk.c  | 91 +++++--------------------------------------------------
 2 files changed, 9 insertions(+), 84 deletions(-)

diff --git a/configure b/configure
index 26084fc53ad1..2fc05c4465cb 100755
--- a/configure
+++ b/configure
@@ -2897,7 +2897,7 @@ fi
 if test "$gtk" != "no"; then
     gtkpackage="gtk+-3.0"
     gtkx11package="gtk+-x11-3.0"
-    gtkversion="3.14.0"
+    gtkversion="3.22.0"
     if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
         gtk_cflags=$($pkg_config --cflags $gtkpackage)
         gtk_libs=$($pkg_config --libs $gtkpackage)
diff --git a/ui/gtk.c b/ui/gtk.c
index 68a5b901c72d..d4b49bd7dafe 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -490,12 +490,7 @@ static void gd_refresh(DisplayChangeListener *dcl)
 
 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,
@@ -877,27 +872,18 @@ 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);
+        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;
         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
+        gdk_monitor_get_geometry(monitor, &geometry);
+        screen_width = geometry.width;
+        screen_height = geometry.height;
 
         /* In relative mode check to see if client pointer hit
          * one of the screen edges, and if so move it back by
@@ -1026,13 +1012,8 @@ static const guint16 *gd_get_keymap(size_t *maplen)
 #ifdef GDK_WINDOWING_WIN32
     if (GDK_IS_WIN32_DISPLAY(dpy)) {
         trace_gd_keymap_windowing("win32");
-#if GTK_CHECK_VERSION(3, 22, 0)
         *maplen = qemu_input_map_atset1_to_qcode_len;
         return qemu_input_map_atset1_to_qcode;
-#else
-        *maplen = qemu_input_map_win32_to_qcode_len;
-        return qemu_input_map_win32_to_qcode;
-#endif
     }
 #endif
 
@@ -1080,7 +1061,7 @@ static int gd_map_keycode(int scancode)
 
 static int gd_get_keycode(GdkEventKey *key)
 {
-#if defined G_OS_WIN32 && GTK_CHECK_VERSION(3, 22, 0)
+#ifdef G_OS_WIN32
     int scancode = gdk_event_get_scancode((GdkEvent *)key);
 
     /* translate Windows native scancodes to atset1 keycodes */
@@ -1437,7 +1418,6 @@ static void gd_menu_zoom_fit(GtkMenuItem *item, void *opaque)
     gd_update_full_redraw(vc);
 }
 
-#if GTK_CHECK_VERSION(3, 20, 0)
 static void gd_grab_update(VirtualConsole *vc, bool kbd, bool ptr)
 {
     GdkDisplay *display = gtk_widget_get_display(vc->gfx.drawing_area);
@@ -1461,32 +1441,6 @@ static void gd_grab_update(VirtualConsole *vc, bool kbd, bool ptr)
         gdk_seat_ungrab(seat);
     }
 }
-#else
-static void gd_grab_devices(VirtualConsole *vc, bool grab,
-                            GdkInputSource source, GdkEventMask mask,
-                            GdkCursor *cursor)
-{
-    GdkDisplay *display = gtk_widget_get_display(vc->gfx.drawing_area);
-    GdkDeviceManager *mgr = gdk_display_get_device_manager(display);
-    GList *devs = gdk_device_manager_list_devices(mgr, GDK_DEVICE_TYPE_MASTER);
-    GList *tmp = devs;
-
-    for (tmp = devs; tmp; tmp = tmp->next) {
-        GdkDevice *dev = tmp->data;
-        if (gdk_device_get_source(dev) != source) {
-            continue;
-        }
-        if (grab) {
-            GdkWindow *win = gtk_widget_get_window(vc->gfx.drawing_area);
-            gdk_device_grab(dev, win, GDK_OWNERSHIP_NONE, FALSE,
-                            mask, cursor, GDK_CURRENT_TIME);
-        } else {
-            gdk_device_ungrab(dev, GDK_CURRENT_TIME);
-        }
-    }
-    g_list_free(devs);
-}
-#endif
 
 static void gd_grab_keyboard(VirtualConsole *vc, const char *reason)
 {
@@ -1499,13 +1453,7 @@ static void gd_grab_keyboard(VirtualConsole *vc, const char *reason)
     }
 
     win32_kbd_set_grab(true);
-#if GTK_CHECK_VERSION(3, 20, 0)
     gd_grab_update(vc, true, vc->s->ptr_owner == vc);
-#else
-    gd_grab_devices(vc, true, GDK_SOURCE_KEYBOARD,
-                   GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
-                   NULL);
-#endif
     vc->s->kbd_owner = vc;
     gd_update_caption(vc->s);
     trace_gd_grab(vc->label, "kbd", reason);
@@ -1521,11 +1469,7 @@ static void gd_ungrab_keyboard(GtkDisplayState *s)
     s->kbd_owner = NULL;
 
     win32_kbd_set_grab(false);
-#if GTK_CHECK_VERSION(3, 20, 0)
     gd_grab_update(vc, false, vc->s->ptr_owner == vc);
-#else
-    gd_grab_devices(vc, false, GDK_SOURCE_KEYBOARD, 0, NULL);
-#endif
     gd_update_caption(s);
     trace_gd_ungrab(vc->label, "kbd");
 }
@@ -1542,21 +1486,9 @@ static void gd_grab_pointer(VirtualConsole *vc, const char *reason)
         }
     }
 
-#if GTK_CHECK_VERSION(3, 20, 0)
     gd_grab_update(vc, vc->s->kbd_owner == vc, true);
     gdk_device_get_position(gd_get_pointer(display),
                             NULL, &vc->s->grab_x_root, &vc->s->grab_y_root);
-#else
-    gd_grab_devices(vc, true, GDK_SOURCE_MOUSE,
-                    GDK_POINTER_MOTION_MASK |
-                    GDK_BUTTON_PRESS_MASK |
-                    GDK_BUTTON_RELEASE_MASK |
-                    GDK_BUTTON_MOTION_MASK |
-                    GDK_SCROLL_MASK,
-                    vc->s->null_cursor);
-    gdk_device_get_position(gd_get_pointer(display),
-                            NULL, &vc->s->grab_x_root, &vc->s->grab_y_root);
-#endif
     vc->s->ptr_owner = vc;
     gd_update_caption(vc->s);
     trace_gd_grab(vc->label, "ptr", reason);
@@ -1573,17 +1505,10 @@ static void gd_ungrab_pointer(GtkDisplayState *s)
     s->ptr_owner = NULL;
 
     display = gtk_widget_get_display(vc->gfx.drawing_area);
-#if GTK_CHECK_VERSION(3, 20, 0)
     gd_grab_update(vc, vc->s->kbd_owner == vc, false);
     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
-    gd_grab_devices(vc, false, GDK_SOURCE_MOUSE, 0, NULL);
-    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);
-#endif
     gd_update_caption(s);
     trace_gd_ungrab(vc->label, "ptr");
 }
-- 
2.18.4



  parent reply	other threads:[~2020-05-20  8:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-20  8:43 [PULL 00/11] Ui 20200520 patches Gerd Hoffmann
2020-05-20  8:43 ` [PULL 01/11] ui/win32-kbd-hook: handle AltGr in a hook procedure Gerd Hoffmann
2020-05-22 17:15   ` Philippe Mathieu-Daudé
2020-05-20  8:43 ` [PULL 02/11] ui/gtk: fix handling of AltGr key on Windows Gerd Hoffmann
2020-05-20  8:43 ` [PULL 03/11] ui/gkt: release all keys on grab-broken-event Gerd Hoffmann
2020-05-20  8:43 ` [PULL 04/11] ui/gtk: remove unused code Gerd Hoffmann
2020-05-20  8:43 ` [PULL 05/11] ui/gtk: remove unused variable ignore_keys Gerd Hoffmann
2020-05-20  8:43 ` [PULL 06/11] ui/sdl2: fix handling of AltGr key on Windows Gerd Hoffmann
2020-05-20  8:43 ` [PULL 07/11] ui/sdl2: start in full screen with grab enabled Gerd Hoffmann
2020-05-20  8:43 ` [PULL 08/11] ui/sdl2-input: use trace-events to debug key events Gerd Hoffmann
2020-05-20  8:43 ` [PULL 09/11] ui/gtk: don't pass on win keys without keyboard grab Gerd Hoffmann
2020-05-20  8:43 ` [PULL 10/11] ui/gtk: use native keyboard scancodes on Windows Gerd Hoffmann
2020-05-20  8:43 ` Gerd Hoffmann [this message]
2020-05-21 15:46 ` [PULL 00/11] Ui 20200520 patches 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=20200520084316.22057-12-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    --cc=vr_qemu@t-online.de \
    /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).