On 2023/02/24 20:01, Philippe Mathieu-Daudé wrote:
> QAPI seems designed to maintain such enums,
> so convert QKbdModifier to be QAPI generated.
> Besides, this is how QKeyCode is maintained.
I recognize QkbdModifier as more like an internal detail of displays so
I'm not convinced it should be converted to QAPI.
The interface of QEMU's input subsystem is so simple: send key up or key
down events for QKeyCode. The modifiers are not exceptions. However,
some display backends (cocoa, sdl2, and vnc) are not designed this way,
and has internal states for modifiers. For such displays, QkbdState
maintains the states to help them convert their internal key state
representation to key up/down events of QKeyCode.
QKbdModifier is used by displays only to query these internal states
QkbdState holds. As such, the definition of QKbdModifier is very
dependent of the internal working of displays. It is particularly
designed to match the needs of vnc, and I even wonder if the modifier
state tracking should be moved away from the common code of QkbdState to
vnc.
Regards,
Akihiko Odaki
>
> Philippe Mathieu-Daudé (2):
> ui/kbd-state: Rename QKbdModifier enum definitions
> ui/kbd-state: QAPI'fy QKbdModifier
>
> include/ui/kbd-state.h | 16 ----------------
> qapi/ui.json | 10 ++++++++++
> ui/cocoa.m | 2 +-
> ui/kbd-state.c | 14 +++++++-------
> ui/keymaps.c | 6 +++---
> ui/sdl2-input.c | 2 +-
> ui/vnc.c | 16 ++++++++--------
> 7 files changed, 30 insertions(+), 36 deletions(-)
>