Win/Super key not working correctly under Windows hosts
Host environment
- Operating system: Windows 11 Pro
- OS/kernel version: 23H2 22631.3447
- Architecture: x86_64
- QEMU flavor: qemu-system-i386, qemu-system-x86_64
- QEMU version: QEMU emulator version 9.0.0 (from qemu-9.0.0.tar.xz)
- QEMU command line:
Fedora 39
qemu-system-x86_64.exe -nodefaults -display sdl,gl=on -M q35,accel=whpx -m 3G -L share\OVMF -bios OVMF.fd -cpu Cascadelake-Server,-vmx,-monitor -device virtio-vga-gl -device qemu-xhci -device usb-tablet -device usb-kbd -cdrom "E:\Fedora-Workstation-Live-x86_64-39-1.5.iso"
WinXP
qemu-system-i386.exe -nodefaults -display sdl -M pc -m 1024M -accel whpx,kernel-irqchip=off -cpu qemu32 -device VGA -hda wxp.vhdx
Emulated/Virtualized environment
- Operating system: WinXP/Fedora 39
- OS/kernel version: WinXP SP3/ Fedora 39 6.5.6-300.fc39.x86_64
- Architecture: x86
Description of problem
I accidentally noticed Win key (VK_LWIN) not working correctly on Windows hosts, more specifically:
- It is impossible to "hold"
Win. If one presses and holdsWin, the guest is spammed withWinkeypresses, instead of receiving a singleWinkeypress at the point of releasing the button (VK_LWIN button up). - It is impossible to make key combinations (shortcuts, hotkeys etc.) that involve the
Win/Superkey. Maybe implicitly solved by fixing #1.
This behavior is present starting from bc8e8830 (ui/sdl2: disable SDL_HINT_GRAB_KEYBOARD on Windows). Before it, on the SDL2 keyboard hook Win/Super key worked correctly. I demonstrate the problem on Fedora/WinXP, but it affects all guests.
Steps to reproduce
- (see additional information)
Additional information
Short video demonstration on a WinXP guest and a Fedora 39 guest. The qemus used are (qemu-8.0.2 e0968d21; working correctly) and (qemu-9.0.0 from the release tarball qemu-9.0.0.tar.xz; buggy)
-
In the WinXP video, I'm pressing and holding the
Winkey for about 3 seconds. In the correct version, the start menu is opened only at the point of release. In the buggy version, the start menu is opened repeatedly tens of times (flickering). You can see the point of release in Nirsoft's KeyboardStateView, when VK_LWIN loses the "pressed" asterisk.At the end of the video I'm trying to use the
Win+eshortcut for WinExplorer. In the buggy version, Outlook is opened instead. This is because the keypresses are processed individually, firstWinopens the start menu and theneopens email application (in this case outlook). In the correct version WinExplorer is opened. -
In the Fedora video, I'm trying to set up a simple shortcut, I'm pressing on my keyboard
LCTRL+LALT+Super+E. In the buggy version, theSuperkey is not picked up. All the shortcut combinations involvingSuperare therefore not working.