Skip to contentSkip to conversation

Ui 20200520 patches

GIT PULL Applied Gerd Hoffmann 3 participants 14 messages May 20, 2020 – May 22, 2020

lore
Share & tools
lore
#0 lore raw

The following changes since commit debe78ce14bf8f8940c2bdf3ef387505e9e035a9:

Merge remote-tracking branch 'remotes/rth/tags/pull-fpu-20200515' into staging (2020-05-15 19:51:16 +0100)

are available in the Git repository at:

git://git.kraxel.org/qemu tags/ui-20200520-pull-request

for you to fetch changes up to 7b23d121f913709306e678a3289edc813f3a7463:

ui: increase min required GTK version to 3.22.0 (2020-05-19 09:06:44 +0200)

----------------------------------------------------------------
ui: windows keyboard fixes for gtk & sdl.
ui: require GTK 3.22 or newer.

----------------------------------------------------------------

Volker Rümelin (11):
ui/win32-kbd-hook: handle AltGr in a hook procedure ui/gtk: fix handling of AltGr key on Windows ui/gkt: release all keys on grab-broken-event ui/gtk: remove unused code
ui/gtk: remove unused variable ignore_keys ui/sdl2: fix handling of AltGr key on Windows ui/sdl2: start in full screen with grab enabled ui/sdl2-input: use trace-events to debug key events ui/gtk: don't pass on win keys without keyboard grab ui/gtk: use native keyboard scancodes on Windows
ui: increase min required GTK version to 3.22.0

 configure                   |   2 +-
 include/ui/win32-kbd-hook.h |  14 +++
 stubs/win32-kbd-hook.c      |  18 ++++
 ui/gtk.c                    | 194 +++++++++++++++++-------------------
 ui/sdl2-input.c             |   3 +
 ui/sdl2.c                   |  33 +++++-
 ui/win32-kbd-hook.c         | 102 +++++++++++++++++++
 stubs/Makefile.objs         |   1 +
 ui/Makefile.objs            |   3 +
 ui/trace-events             |   3 +
 10 files changed, 264 insertions(+), 109 deletions(-)
 create mode 100644 include/ui/win32-kbd-hook.h
 create mode 100644 stubs/win32-kbd-hook.c
 create mode 100644 ui/win32-kbd-hook.c
Signature · 1 line
2.18.4
#1 lore raw

[PULL 05/11] ui/gtk: remove unused variable ignore_keys

From: Volker Rümelin <[email protected]>

Since the removal of GTK2 code in commit 89d85cde75 the code around ignore_keys is unused. See commit 1a01716a30 "gtk: Avoid accel key leakage into guest on console switch" why it was only needed for GTK2.

Message-id: [email protected]

---
 ui/gtk.c | 9 ---------
 1 file changed, 9 deletions(-)
ui/gtk.c +0 -9
index 0e9503a0d1d9..354dd90e1898 100644
@@ -168,8 +168,6 @@ struct GtkDisplayState {
 
     bool external_pause_update;
 
-    bool ignore_keys;
-
     DisplayOptions *opts;
 };
 
@@ -1095,14 +1093,8 @@ static gboolean gd_text_key_down(GtkWidget *widget,
 static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
 {
     VirtualConsole *vc = opaque;
-    GtkDisplayState *s = vc->s;
     int qcode;
 
-    if (s->ignore_keys) {
-        s->ignore_keys = (key->type == GDK_KEY_PRESS);
-        return TRUE;
-    }
-
 #ifdef WIN32
     /* on windows, we ought to ignore the reserved key event? */
     if (key->hardware_keycode == 0xff)
@@ -1204,7 +1196,6 @@ static void gd_menu_switch_vc(GtkMenuItem *item, void *opaque)
         gtk_notebook_set_current_page(nb, page);
         gtk_widget_grab_focus(vc->focus);
     }
-    s->ignore_keys = false;
 }
 
 static void gd_accel_switch_vc(void *opaque)
Signature · 1 line
2.18.4
#2 lore raw

[PULL 02/11] ui/gtk: fix handling of AltGr key on Windows

In reply to Gerd Hoffmann

From: Volker Rümelin <[email protected]>

Wire up the keyboard hooking code on Windows to fix the AltGr key and improve keyboard grabbing.

Message-id: [email protected]

---
 ui/gtk.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
ui/gtk.c +29 -1
index 83f2f5d49b2a..a0b10a140330 100644
@@ -38,6 +38,10 @@
 
 #include "ui/console.h"
 #include "ui/gtk.h"
+#ifdef G_OS_WIN32
+#include <gdk/gdkwin32.h>
+#endif
+#include "ui/win32-kbd-hook.h"
 
 #include <glib/gi18n.h>
 #include <locale.h>
@@ -428,6 +432,16 @@ static void gd_widget_reparent(GtkWidget *from, GtkWidget *to,
     g_object_unref(G_OBJECT(widget));
 }
 
+static void *gd_win32_get_hwnd(VirtualConsole *vc)
+{
+#ifdef G_OS_WIN32
+    return gdk_win32_window_get_impl_hwnd(
+        gtk_widget_get_window(vc->window ? vc->window : vc->s->window));
+#else
+    return NULL;
+#endif
+}
+
 /** DisplayState Callbacks **/
 
 static void gd_update(DisplayChangeListener *dcl,
@@ -1451,6 +1465,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
@@ -1472,6 +1487,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
@@ -1614,12 +1630,22 @@ static gboolean gd_leave_event(GtkWidget *widget, GdkEventCrossing *crossing,
     return TRUE;
 }
 
+static gboolean gd_focus_in_event(GtkWidget *widget,
+                                  GdkEventFocus *event, gpointer opaque)
+{
+    VirtualConsole *vc = opaque;
+
+    win32_kbd_set_window(gd_win32_get_hwnd(vc));
+    return TRUE;
+}
+
 static gboolean gd_focus_out_event(GtkWidget *widget,
-                                   GdkEventCrossing *crossing, gpointer opaque)
+                                   GdkEventFocus *event, gpointer opaque)
 {
     VirtualConsole *vc = opaque;
     GtkDisplayState *s = vc->s;
 
+    win32_kbd_set_window(NULL);
     gtk_release_modifiers(s);
     return TRUE;
 }
@@ -1878,6 +1904,8 @@ static void gd_connect_vc_gfx_signals(VirtualConsole *vc)
                          G_CALLBACK(gd_enter_event), vc);
         g_signal_connect(vc->gfx.drawing_area, "leave-notify-event",
                          G_CALLBACK(gd_leave_event), vc);
+        g_signal_connect(vc->gfx.drawing_area, "focus-in-event",
+                         G_CALLBACK(gd_focus_in_event), vc);
         g_signal_connect(vc->gfx.drawing_area, "focus-out-event",
                          G_CALLBACK(gd_focus_out_event), vc);
         g_signal_connect(vc->gfx.drawing_area, "configure-event",
Signature · 1 line
2.18.4
#3 lore raw

[PULL 04/11] ui/gtk: remove unused code

In reply to Gerd Hoffmann

From: Volker Rümelin <[email protected]>

This code was last used before commit 2ec78706d1 "ui: convert GTK and SDL1 frontends to keycodemapdb".

Message-id: [email protected]

---
 ui/gtk.c | 9 ---------
 1 file changed, 9 deletions(-)
ui/gtk.c +0 -9
index 655b26de384e..0e9503a0d1d9 100644
@@ -112,15 +112,6 @@
 # define VTE_CHECK_VERSION(a, b, c) 0
 #endif
 
-/* Some older mingw versions lack this constant or have
- * it conditionally defined */
-#ifdef _WIN32
-# ifndef MAPVK_VK_TO_VSC
-#  define MAPVK_VK_TO_VSC 0
-# endif
-#endif
-
-
 #define HOTKEY_MODIFIERS        (GDK_CONTROL_MASK | GDK_MOD1_MASK)
 
 static const guint16 *keycode_map;
Signature · 1 line
2.18.4
#4 lore raw

[PULL 09/11] ui/gtk: don't pass on win keys without keyboard grab

In reply to Gerd Hoffmann

From: Volker Rümelin <[email protected]>

Without keyboard grab Windows currently handles the two win keys and the key events are also sent to the guest. This is undesir- able. Only one program should handle key events. This patch ap- plies commit c68f74b02e "win32: do not handle win keys when the keyboard is not grabbed" from project spice-gtk to ui/gtk.c to fix this problem.

Message-id: [email protected]

---
 ui/gtk.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
ui/gtk.c +8 -1
index 354dd90e1898..1d51e14bb58d 100644
@@ -1095,10 +1095,17 @@ static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
     VirtualConsole *vc = opaque;
     int qcode;
 
-#ifdef WIN32
+#ifdef G_OS_WIN32
     /* on windows, we ought to ignore the reserved key event? */
     if (key->hardware_keycode == 0xff)
         return false;
+
+    if (!vc->s->kbd_owner) {
+        if (key->hardware_keycode == VK_LWIN ||
+            key->hardware_keycode == VK_RWIN) {
+            return FALSE;
+        }
+    }
 #endif
 
     if (key->keyval == GDK_KEY_Pause
Signature · 1 line
2.18.4
#5 lore raw

[PULL 10/11] ui/gtk: use native keyboard scancodes on Windows

In reply to Gerd Hoffmann

From: Volker Rümelin <[email protected]>

Since GTK 3.22 the function gdk_event_get_scancode() is available. On Windows this function returns keyboard scancodes and some extended flags. These raw keyboard scancodes are much better suited for this use case than the half-cooked win32 virtual-key codes because scancodes report the key position on the keyboard and the positions are independent of national language settings.

Message-id: [email protected]

---
 ui/gtk.c | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)
ui/gtk.c +29 -4
index 1d51e14bb58d..68a5b901c72d 100644
@@ -1026,8 +1026,13 @@ 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
 
@@ -1073,6 +1078,25 @@ static int gd_map_keycode(int scancode)
     return keycode_map[scancode];
 }
 
+static int gd_get_keycode(GdkEventKey *key)
+{
+#if defined G_OS_WIN32 && GTK_CHECK_VERSION(3, 22, 0)
+    int scancode = gdk_event_get_scancode((GdkEvent *)key);
+
+    /* translate Windows native scancodes to atset1 keycodes */
+    switch (scancode & (KF_EXTENDED | 0xff)) {
+    case 0x145:     /* NUMLOCK */
+        return scancode & 0xff;
+    }
+
+    return scancode & KF_EXTENDED ?
+        0xe000 | (scancode & 0xff) : scancode & 0xff;
+
+#else
+    return key->hardware_keycode;
+#endif
+}
+
 static gboolean gd_text_key_down(GtkWidget *widget,
                                  GdkEventKey *key, void *opaque)
 {
@@ -1084,7 +1108,7 @@ static gboolean gd_text_key_down(GtkWidget *widget,
     } else if (key->length) {
         kbd_put_string_console(con, key->string, key->length);
     } else {
-        int qcode = gd_map_keycode(key->hardware_keycode);
+        int qcode = gd_map_keycode(gd_get_keycode(key));
         kbd_put_qcode_console(con, qcode, false);
     }
     return TRUE;
@@ -1093,7 +1117,7 @@ static gboolean gd_text_key_down(GtkWidget *widget,
 static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
 {
     VirtualConsole *vc = opaque;
-    int qcode;
+    int keycode, qcode;
 
 #ifdef G_OS_WIN32
     /* on windows, we ought to ignore the reserved key event? */
@@ -1121,9 +1145,10 @@ static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
         return TRUE;
     }
 
-    qcode = gd_map_keycode(key->hardware_keycode);
+    keycode = gd_get_keycode(key);
+    qcode = gd_map_keycode(keycode);
 
-    trace_gd_key_event(vc->label, key->hardware_keycode, qcode,
+    trace_gd_key_event(vc->label, keycode, qcode,
                        (key->type == GDK_KEY_PRESS) ? "down" : "up");
 
     qkbd_state_key_event(vc->gfx.kbd, qcode,
Signature · 1 line
2.18.4
#6 lore raw

[PULL 06/11] ui/sdl2: fix handling of AltGr key on Windows

In reply to Gerd Hoffmann

From: Volker Rümelin <[email protected]>

Wire up the keyboard hooking code on Windows to fix the AltGr key and improve keyboard grabbing.

Message-id: [email protected]

---
 ui/sdl2.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
ui/sdl2.c +24 -0
index 61c7956da334..79c1ea29d223 100644
@@ -30,6 +30,7 @@
 #include "ui/sdl2.h"
 #include "sysemu/runstate.h"
 #include "sysemu/sysemu.h"
+#include "ui/win32-kbd-hook.h"
 
 static int sdl2_num_outputs;
 static struct sdl2_console *sdl2_console;
@@ -220,6 +221,7 @@ static void sdl_grab_start(struct sdl2_console *scon)
     }
     SDL_SetWindowGrab(scon->real_window, SDL_TRUE);
     gui_grab = 1;
+    win32_kbd_set_grab(true);
     sdl_update_caption(scon);
 }
 
@@ -227,6 +229,7 @@ static void sdl_grab_end(struct sdl2_console *scon)
 {
     SDL_SetWindowGrab(scon->real_window, SDL_FALSE);
     gui_grab = 0;
+    win32_kbd_set_grab(false);
     sdl_show_cursor(scon);
     sdl_update_caption(scon);
 }
@@ -325,6 +328,19 @@ static int get_mod_state(void)
     }
 }
 
+static void *sdl2_win32_get_hwnd(struct sdl2_console *scon)
+{
+#ifdef CONFIG_WIN32
+    SDL_SysWMinfo info;
+
+    SDL_VERSION(&info.version);
+    if (SDL_GetWindowWMInfo(scon->real_window, &info)) {
+        return info.info.win.window;
+    }
+#endif
+    return NULL;
+}
+
 static void handle_keydown(SDL_Event *ev)
 {
     int win;
@@ -544,6 +560,11 @@ static void handle_windowevent(SDL_Event *ev)
         sdl2_redraw(scon);
         break;
     case SDL_WINDOWEVENT_FOCUS_GAINED:
+        win32_kbd_set_grab(gui_grab);
+        if (qemu_console_is_graphic(scon->dcl.con)) {
+            win32_kbd_set_window(sdl2_win32_get_hwnd(scon));
+        }
+        /* fall through */
     case SDL_WINDOWEVENT_ENTER:
         if (!gui_grab && (qemu_input_is_absolute() || absolute_enabled)) {
             absolute_mouse_grab(scon);
@@ -558,6 +579,9 @@ static void handle_windowevent(SDL_Event *ev)
         scon->ignore_hotkeys = get_mod_state();
         break;
     case SDL_WINDOWEVENT_FOCUS_LOST:
+        if (qemu_console_is_graphic(scon->dcl.con)) {
+            win32_kbd_set_window(NULL);
+        }
         if (gui_grab && !gui_fullscreen) {
             sdl_grab_end(scon);
         }
Signature · 1 line
2.18.4
#7 lore raw

[PULL 03/11] ui/gkt: release all keys on grab-broken-event

In reply to Gerd Hoffmann

From: Volker Rümelin <[email protected]>

There is no way to grab the Ctrl-Alt-Del key combination on Windows. This key combination will leave all three keys in a stuck condition. This patch uses the grab-broken-event to release the keys.

Message-id: [email protected]

---
 ui/gtk.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
ui/gtk.c +21 -0
index a0b10a140330..655b26de384e 100644
@@ -1142,6 +1142,25 @@ static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
     return TRUE;
 }
 
+static gboolean gd_grab_broken_event(GtkWidget *widget,
+                                     GdkEventGrabBroken *event, void *opaque)
+{
+#ifdef CONFIG_WIN32
+    /*
+     * On Windows the Ctrl-Alt-Del key combination can't be grabbed. This
+     * key combination leaves all three keys in a stuck condition. We use
+     * the grab-broken-event to release all keys.
+     */
+    if (event->keyboard) {
+        VirtualConsole *vc = opaque;
+        GtkDisplayState *s = vc->s;
+
+        gtk_release_modifiers(s);
+    }
+#endif
+    return TRUE;
+}
+
 static gboolean gd_event(GtkWidget *widget, GdkEvent *event, void *opaque)
 {
     if (event->type == GDK_MOTION_NOTIFY) {
@@ -1910,6 +1929,8 @@ static void gd_connect_vc_gfx_signals(VirtualConsole *vc)
                          G_CALLBACK(gd_focus_out_event), vc);
         g_signal_connect(vc->gfx.drawing_area, "configure-event",
                          G_CALLBACK(gd_configure), vc);
+        g_signal_connect(vc->gfx.drawing_area, "grab-broken-event",
+                         G_CALLBACK(gd_grab_broken_event), vc);
     } else {
         g_signal_connect(vc->gfx.drawing_area, "key-press-event",
                          G_CALLBACK(gd_text_key_down), vc);
Signature · 1 line
2.18.4
#8 lore raw

[PULL 01/11] ui/win32-kbd-hook: handle AltGr in a hook procedure

In reply to Gerd Hoffmann

From: Volker Rümelin <[email protected]>

Import win32 keyboard hooking code from project spice-gtk. This patch removes the extra left control key up/down input events inserted by Windows for the right alt key up/down input events with international keyboard layouts. Additionally there's some code to grab the keyboard.

The next patches will use this code.

Only Windows needs this.

Message-id: [email protected]

---
 include/ui/win32-kbd-hook.h |  14 +++++
 stubs/win32-kbd-hook.c      |  18 +++++++
 ui/win32-kbd-hook.c         | 102 ++++++++++++++++++++++++++++++++++++
 stubs/Makefile.objs         |   1 +
 ui/Makefile.objs            |   3 ++
 5 files changed, 138 insertions(+)
 create mode 100644 include/ui/win32-kbd-hook.h
 create mode 100644 stubs/win32-kbd-hook.c
 create mode 100644 ui/win32-kbd-hook.c
include/ui/win32-kbd-hook.h new file +14 -0
new file mode 100644
index 000000000000..4bd9f00f973f
@@ -0,0 +1,14 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef UI_WIN32_KBD_HOOK_H
+#define UI_WIN32_KBD_HOOK_H
+
+void win32_kbd_set_window(void *hwnd);
+void win32_kbd_set_grab(bool grab);
+
+#endif
stubs/win32-kbd-hook.c new file +18 -0
new file mode 100644
index 000000000000..1a084b081ab6
@@ -0,0 +1,18 @@
+/*
+ * Win32 keyboard hook stubs
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or
+ * (at your option) any later version.  See the COPYING file in the
+ * top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "ui/win32-kbd-hook.h"
+
+void win32_kbd_set_window(void *hwnd)
+{
+}
+
+void win32_kbd_set_grab(bool grab)
+{
+}
ui/win32-kbd-hook.c new file +102 -0

102 lines not on this page · raw message

stubs/Makefile.objs +1 -0
index 45be5dc0ed78..6a9e3135e8f9 100644
@@ -32,6 +32,7 @@ stub-obj-y += trace-control.o
 stub-obj-y += uuid.o
 stub-obj-y += vm-stop.o
 stub-obj-y += vmstate.o
+stub-obj-y += win32-kbd-hook.o
 stub-obj-y += fd-register.o
 stub-obj-y += qmp_memory_device.o
 stub-obj-y += target-monitor-defs.o
ui/Makefile.objs +3 -0
index e6da6ff047fd..504b19647977 100644
@@ -15,6 +15,9 @@ common-obj-$(CONFIG_SPICE) += spice-core.o spice-input.o spice-display.o
 common-obj-$(CONFIG_COCOA) += cocoa.o
 common-obj-$(CONFIG_VNC) += $(vnc-obj-y)
 common-obj-$(call lnot,$(CONFIG_VNC)) += vnc-stubs.o
+ifneq (,$(findstring m,$(CONFIG_SDL)$(CONFIG_GTK)))
+common-obj-$(CONFIG_WIN32) += win32-kbd-hook.o
+endif
 
 # ui-sdl module
 common-obj-$(CONFIG_SDL) += sdl.mo
Signature · 1 line
2.18.4
#10 lore raw

[PULL 07/11] ui/sdl2: start in full screen with grab enabled

In reply to Gerd Hoffmann

From: Volker Rümelin <[email protected]>

QEMU with SDL 1.2 display used to enable keyboard and mouse grab- bing when started in full screen. The SDL 2.0 code tries to do the same but fails to enable grabbing because sdl_grab_start(0) returns early. To do it's work the sdl_grab_start() function needs a pointer to a sdl2_console structure.

Message-id: [email protected]

---
 ui/sdl2.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
ui/sdl2.c +4 -5
index 79c1ea29d223..b23a8f0a8ebf 100644
@@ -881,17 +881,16 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
         SDL_SetWindowIcon(sdl2_console[0].real_window, icon);
     }
 
-    gui_grab = 0;
-    if (gui_fullscreen) {
-        sdl_grab_start(0);
-    }
-
     mouse_mode_notifier.notify = sdl_mouse_mode_change;
     qemu_add_mouse_mode_change_notifier(&mouse_mode_notifier);
 
     sdl_cursor_hidden = SDL_CreateCursor(&data, &data, 8, 1, 0, 0);
     sdl_cursor_normal = SDL_GetCursor();
 
+    if (gui_fullscreen) {
+        sdl_grab_start(&sdl2_console[0]);
+    }
+
     atexit(sdl_cleanup);
 }
 
Signature · 1 line
2.18.4
#11 lore raw

[PULL 11/11] ui: increase min required GTK version to 3.22.0

In reply to Gerd Hoffmann

From: Volker Rümelin <[email protected]>

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.

Message-id: [email protected]

---
 configure |  2 +-
 ui/gtk.c  | 91 +++++--------------------------------------------------
 2 files changed, 9 insertions(+), 84 deletions(-)
configure +1 -1
index 26084fc53ad1..2fc05c4465cb 100755
@@ -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)
ui/gtk.c +8 -83

168 lines not on this page · raw message

Signature · 1 line
2.18.4
#12 lore raw

[PULL 08/11] ui/sdl2-input: use trace-events to debug key events

In reply to Gerd Hoffmann

From: Volker Rümelin <[email protected]>

Message-id: [email protected]

---
 ui/sdl2-input.c | 3 +++
 ui/trace-events | 3 +++
 2 files changed, 6 insertions(+)
ui/sdl2-input.c +3 -0
index 1f9fe831b30d..f068382209cc 100644
@@ -27,6 +27,7 @@
 #include "ui/console.h"
 #include "ui/input.h"
 #include "ui/sdl2.h"
+#include "trace.h"
 
 void sdl2_process_key(struct sdl2_console *scon,
                       SDL_KeyboardEvent *ev)
@@ -38,6 +39,8 @@ void sdl2_process_key(struct sdl2_console *scon,
         return;
     }
     qcode = qemu_input_map_usb_to_qcode[ev->keysym.scancode];
+    trace_sdl2_process_key(ev->keysym.scancode, qcode,
+                           ev->type == SDL_KEYDOWN ? "down" : "up");
     qkbd_state_key_event(scon->kbd, qcode, ev->type == SDL_KEYDOWN);
 
     if (!qemu_console_is_graphic(con)) {
ui/trace-events +3 -0
index 0dcda393c1d6..5367fd3f1668 100644
@@ -75,6 +75,9 @@ input_event_abs(int conidx, const char *axis, int value) "con %d, axis %s, value
 input_event_sync(void) ""
 input_mouse_mode(int absolute) "absolute %d"
 
+# sdl2-input.c
+sdl2_process_key(int sdl_scancode, int qcode, const char *action) "translated SDL scancode %d to QKeyCode %d (%s)"
+
 # spice-display.c
 qemu_spice_add_memslot(int qid, uint32_t slot_id, unsigned long virt_start, unsigned long virt_end, int async) "%d %u: host virt 0x%lx - 0x%lx async=%d"
 qemu_spice_del_memslot(int qid, uint32_t gid, uint32_t slot_id) "%d gid=%u sid=%u"
Signature · 1 line
2.18.4
#13 lore raw
In reply to Gerd Hoffmann
Quoted 9 lines · Gerd Hoffmann

The following changes since commit debe78ce14bf8f8940c2bdf3ef387505e9e035a9:

Merge remote-tracking branch 'remotes/rth/tags/pull-fpu-20200515' into staging (2020-05-15 19:51:16 +0100)

are available in the Git repository at:

git://git.kraxel.org/qemu tags/ui-20200520-pull-request

Quoted 8 lines

for you to fetch changes up to 7b23d121f913709306e678a3289edc813f3a7463:

ui: increase min required GTK version to 3.22.0 (2020-05-19 09:06:44 +0200)

----------------------------------------------------------------
ui: windows keyboard fixes for gtk & sdl.
ui: require GTK 3.22 or newer.

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1
for any user-visible changes.

-- PMM

#9 lore raw

Re: [PULL 01/11] ui/win32-kbd-hook: handle AltGr in a hook procedure

In reply to Gerd Hoffmann
Quoted 8 lines · Gerd Hoffmann

From: Volker Rümelin <[email protected]>

Import win32 keyboard hooking code from project spice-gtk. This patch removes the extra left control key up/down input events inserted by Windows for the right alt key up/down input events with international keyboard layouts. Additionally there's some code to grab the keyboard.

Quoted 6 lines

The next patches will use this code.

Only Windows needs this.

Message-id: [email protected]

This patch content doesn't match exactly the content of the message-id.

There are some build-sys changes.

Quoted 11 lines
---
 include/ui/win32-kbd-hook.h |  14 +++++
 stubs/win32-kbd-hook.c      |  18 +++++++
 ui/win32-kbd-hook.c         | 102 ++++++++++++++++++++++++++++++++++++
 stubs/Makefile.objs         |   1 +
 ui/Makefile.objs            |   3 ++
 5 files changed, 138 insertions(+)
 create mode 100644 include/ui/win32-kbd-hook.h
 create mode 100644 stubs/win32-kbd-hook.c
 create mode 100644 ui/win32-kbd-hook.c

[...]

Quoted 17 lines
stubs/Makefile.objs +1 -0
index 45be5dc0ed78..6a9e3135e8f9 100644
@@ -32,6 +32,7 @@ stub-obj-y += trace-control.o
 stub-obj-y += uuid.o
 stub-obj-y += vm-stop.o
 stub-obj-y += vmstate.o
+stub-obj-y += win32-kbd-hook.o
 stub-obj-y += fd-register.o
 stub-obj-y += qmp_memory_device.o
 stub-obj-y += target-monitor-defs.o
ui/Makefile.objs +0 -0
index e6da6ff047fd..504b19647977 100644

ui/Makefile.objs common-obj-$(CONFIG_SPICE) += spice-core.o spice-input.o spice-display.o · line 18

Quoted 4 lines
ui/Makefile.objs +1 -0
@@ -15,6 +15,9 @@ common-obj-$(CONFIG_SPICE) += spice-core.o spice-input.o spice-display.o
 common-obj-$(CONFIG_COCOA) += cocoa.o
 common-obj-$(CONFIG_VNC) += $(vnc-obj-y)
 common-obj-$(call lnot,$(CONFIG_VNC)) += vnc-stubs.o
+ifneq (,$(findstring m,$(CONFIG_SDL)$(CONFIG_GTK)))

If we limit this object compilation, shouldn't we also limit the stub?

Quoted 6 lines
ui/Makefile.objs +2 -0
+common-obj-$(CONFIG_WIN32) += win32-kbd-hook.o
+endif
 
 # ui-sdl module
 common-obj-$(CONFIG_SDL) += sdl.mo