ui/input: Decouple internal and QAPI input events
Get series with b4
b4 am [email protected] change-id 20260428-input-9b94f389ea55Versions newest first
- v3 Latest29 patches 1 replyIn review
- v229 patches 1 replySuperseded
- v1 RFC28 patches 7 repliesSuperseded
Changes in v3 from the cover letter
- Fixed qemu_input_event_send_key_number() to send the converted Linux key
code directly.
- Updated tools/qemu-vnc for the input event API changes.
- Prevented ui/kbd-state from reading or writing past its key bitmap
when given a key code outside the defined range.
- Changed Linux key code variables to use unsigned int.
- Link to v2: https://lore.kernel.org/qemu-devel/[email protected]
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/29 | ui/input: Introduce QemuInputEvent typedefchardev/ chardev/ hw/ +19 more | +47 | 0 replies | |
| 2/29 | ui/input: Remove QAPI wrappers from QemuInputEventchardev/ chardev/ hw/ +16 more | +299 | 0 replies | |
| 3/29 | ui/input: Store QKeyCode directly in QemuInputKeyEventhw/ hw/ hw/ +11 more | +29 | 0 replies | |
| 4/29 | ui/input: Use Linux key codes for internal key eventshw/ hw/ hw/ +13 more | +151 | 0 replies | |
| 5/29 | ui/input: Prohibit sending KEY_RESERVEDui/ | +4 | 0 replies | |
| 6/29 | ui/console: Add qemu_text_console_put_linux()include/ ui/ | +46 | 0 replies | |
| 7/29 | ui/kbd-state: Use Linux key codesinclude/ ui/ ui/ +5 more | +108 | 0 replies | |
| 8/29 | hw/arm/musicpal: Use Linux key codeshw/ | +10 | 0 replies | |
| 9/29 | hw/char/escc: Use Linux key codeshw/ | +5 | 0 replies | |
| 10/29 | hw/display/xenfb: Use Linux key codeshw/ | +3 | 0 replies | |
| 11/29 | hw/input/adb-kbd: Use Linux key codeshw/ | +120 | 0 replies | |
| 12/29 | hw/input/hid: Use Linux key codeshw/ | +1 | 0 replies | |
| 13/29 | hw/input/ps2: Use Linux key codeshw/ hw/ | +26 | 0 replies | |
| 14/29 | hw/input/virtio-input: Use Linux key codeshw/ | +23 | 0 replies | |
| 15/29 | hw/m68k/next-kbd: Use Linux key codeshw/ | +59 | 0 replies | |
| 16/29 | replay: Use Linux key codesreplay/ replay/ | +4 | 0 replies | |
| 17/29 | ui/cocoa: Use Linux key codesui/ | +148 | 0 replies | |
| 18/29 | ui/dbus: Use Linux key codesui/ | +4 | 0 replies | |
| 19/29 | ui/gtk: Use Linux key codesui/ ui/ ui/ +1 more | +45 | 0 replies | |
| 20/29 | ui/input-barrier: Use Linux key codesui/ | +13 | 0 replies | |
| 21/29 | ui/input-legacy: Use Linux key codesui/ | +5 | 0 replies | |
| 22/29 | ui/input-linux: Use Linux key codesui/ | +1 | 0 replies | |
| 23/29 | ui/keymaps: Use Linux key codesui/ | +1 | 0 replies | |
| 24/29 | ui/sdl2: Use Linux key codesui/ ui/ | +10 | 0 replies | |
| 25/29 | ui/spice: Use Linux key codesui/ | +2 | 0 replies | |
| 26/29 | ui/vnc: Use Linux key codesui/ | +13 | 0 replies | |
| 27/29 | qemu-keymap: Use Linux key codesqemu-keymap.c | +20 | 0 replies | |
| 28/29 | ui/console: Remove qemu_text_console_put_qcode()include/ ui/ | +0 | 0 replies | |
| 29/29 | ui/input: Remove unused QKeyCode helpers and keymapsinclude/ tools/ ui/ +2 more | +0 | 0 replies |
Reviews trailers per patch
None of the 29 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Marc-André Lureau |
|---|---|
| Series | R-b |
| 1/29 | |
| 2/29 | |
| 3/29 | |
| 4/29 | |
| 5/29 | |
| 6/29 | |
| 7/29 | |
| 8/29 | |
| 9/29 | |
| 10/29 | |
| 11/29 | |
| 12/29 | |
| 13/29 | |
| 14/29 | |
| 15/29 | |
| 16/29 | |
| 17/29 | |
| 18/29 | |
| 19/29 | |
| 20/29 | |
| 21/29 | |
| 22/29 | |
| 23/29 | |
| 24/29 | |
| 25/29 | |
| 26/29 | |
| 27/29 | |
| 28/29 | |
| 29/29 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 00/29] ui/input: Decouple internal and QAPI input events
The internal input event representation has different requirements from the QAPI representation. Using QAPI types directly spreads QAPI-specific constraints throughout the internal input code. Keep that impact localized by decoupling the two representations with a dedicated conversion layer. The decoupled internal representation has the following benefits:
- It avoids wrapper structs and pointer indirections required by QAPI. They are useful at the QMP boundary, but unnecessary for internal input events and make handlers more verbose.
- It enforces a single key code set while QAPI input events allow key codes to be stored either as qnum or qcode. Having two code sets is useful for QMP compatibility, but complicates internal input handling. Commit af07e5ff02ae ("ui: convert key events to QKeyCodes immediately") made qcode the only key code set used internally, but the QAPI type does not enforce that and accessing the key code is still tedious.
- It uses Linux key codes. They cover all keys represented by qcodes, include additional keys, and allow QEMU to pass codes through from Linux hosts to Linux guests. This also simplifies the code by avoiding qcode aliases and matches the approach used by virtio and Xen. Since this is an internal representation, QEMU can extend the key code set if a QEMU-specific need arises.
Only the switch to Linux key codes is intended to change functional behavior. The interfaces that require QKeyCode are still preserved and QKeyCode_str() is still used to query key names. Changing QAPI to accept Linux key codes is possible, but out of scope for this series.
This series is organized as follows:
Patches 1-6 convert the internal interfaces.
Patches 7-26 convert their users.
Patches 27-28 remove the old internal interfaces.
---
Changes in v3:
- Fixed qemu_input_event_send_key_number() to send the converted Linux key
code directly.
- Updated tools/qemu-vnc for the input event API changes.
- Prevented ui/kbd-state from reading or writing past its key bitmap
when given a key code outside the defined range.
- Changed Linux key code variables to use unsigned int.
- Link to v2: https://lore.kernel.org/qemu-devel/[email protected]
Changes in v2:
- Fixed an accidental overwrite of the key value in patch
"ui/input: Remove QAPI wrappers from QemuInputEvent".
- Added patch "ui/input: Prohibit sending KEY_RESERVED".
- Removed remaining unintended QKeyCode occurrences.
- Link to v1: https://lore.kernel.org/qemu-devel/[email protected]
To: [email protected]
Cc: Marc-André Lureau <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Jan Kiszka <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Anthony PERARD <[email protected]>
Cc: "Edgar E. Iglesias" <[email protected]>
Cc: Mark Cave-Ayland <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Thomas Huth <[email protected]>
Cc: Alex Bennée <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Akihiko Odaki <[email protected]>
---
Akihiko Odaki (29):
ui/input: Introduce QemuInputEvent typedef ui/input: Remove QAPI wrappers from QemuInputEvent ui/input: Store QKeyCode directly in QemuInputKeyEvent ui/input: Use Linux key codes for internal key events ui/input: Prohibit sending KEY_RESERVED ui/console: Add qemu_text_console_put_linux() ui/kbd-state: Use Linux key codes hw/arm/musicpal: Use Linux key codes hw/char/escc: Use Linux key codes hw/display/xenfb: Use Linux key codes hw/input/adb-kbd: Use Linux key codes hw/input/hid: Use Linux key codes hw/input/ps2: Use Linux key codes hw/input/virtio-input: Use Linux key codes hw/m68k/next-kbd: Use Linux key codes
replay: Use Linux key codes
ui/cocoa: Use Linux key codes
ui/dbus: Use Linux key codes
ui/gtk: Use Linux key codes ui/input-barrier: Use Linux key codes ui/input-legacy: Use Linux key codes ui/input-linux: Use Linux key codes ui/keymaps: Use Linux key codes
ui/sdl2: Use Linux key codes
ui/spice: Use Linux key codes
ui/vnc: Use Linux key codes
qemu-keymap: Use Linux key codes
ui/console: Remove qemu_text_console_put_qcode() ui/input: Remove unused QKeyCode helpers and keymaps
include/qemu/typedefs.h | 1 + include/system/replay.h | 2 +- include/ui/console.h | 3 +- include/ui/input.h | 92 ++++++++------ include/ui/kbd-state.h | 12 +- replay/replay-internal.h | 6 +- ui/x_keymap.h | 3 +- chardev/msmouse.c | 12 +- chardev/wctablet.c | 10 +- hw/arm/musicpal.c | 31 +++-- hw/char/escc.c | 45 +++---- hw/display/xenfb.c | 51 +++----- hw/input/adb-kbd.c | 246 ++++++++++++++++++------------------ hw/input/adb-mouse.c | 22 ++-- hw/input/hid.c | 41 +++--- hw/input/ps2.c | 118 +++++++++--------- hw/input/stellaris_gamepad.c | 11 +- hw/input/virtio-input-hid.c | 89 +++++++------ hw/m68k/next-kbd.c | 128 +++++++++---------- qemu-keymap.c | 41 +++--- replay/replay-events.c | 6 +- replay/replay-input.c | 117 ++++++------------ replay/replay.c | 2 +- replay/stubs-system.c | 2 +- tools/qemu-vnc/input.c | 9 +- ui/console.c | 62 ++++++---- ui/dbus-console.c | 8 +- ui/gtk.c | 50 ++++---- ui/input-barrier.c | 26 ++-- ui/input-keymap.c | 74 +++++------ ui/input-legacy.c | 47 +++---- ui/input-linux.c | 3 +- ui/input.c | 214 ++++++++++++++------------------ ui/kbd-state.c | 61 +++++---- ui/keymaps.c | 4 +- ui/sdl2-input.c | 17 +-- ui/spice-input.c | 3 +- ui/vdagent.c | 20 ++- ui/vnc.c | 25 ++-- ui/x_keymap.c | 24 ++-- hw/input/trace-events | 2 +- tools/qemu-vnc/trace-events | 2 +- ui/cocoa.m | 289 ++++++++++++++++++++++--------------------- ui/meson.build | 29 +++-- ui/trace-events | 5 +- 45 files changed, 980 insertions(+), 1085 deletions(-)
---
base-commit: e89049b3ba5f1f0468bc0d294173345597514a1b
change-id: 20260428-input-9b94f389ea55
Best regards,
Signature · 1 line
Akihiko Odaki <[email protected]>