[PATCH 0/2] ui/kbd-state: QAPI'fy QKbdModifier

Philippe Mathieu-Daudé posted 2 patches 1 year, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230224110153.8559-1-philmd@linaro.org
Maintainers: Gerd Hoffmann <kraxel@redhat.com>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Akihiko Odaki <akihiko.odaki@gmail.com>
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(-)
[PATCH 0/2] ui/kbd-state: QAPI'fy QKbdModifier
Posted by Philippe Mathieu-Daudé 1 year, 2 months ago
QAPI seems designed to maintain such enums,
so convert QKbdModifier to be QAPI generated.
Besides, this is how QKeyCode is maintained.

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(-)

-- 
2.38.1


Re: [PATCH 0/2] ui/kbd-state: QAPI'fy QKbdModifier
Posted by Akihiko Odaki 1 year, 2 months ago
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(-)
>