summary refs log tree commit diff stats
path: root/include/ui/kbd-state.h
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@daynix.com>2024-03-19 12:08:40 +0900
committerMarc-André Lureau <marcandre.lureau@redhat.com>2024-03-20 10:27:54 +0400
commitd4c199566f6fa5de4afa344712462cfd322de9d0 (patch)
treead3c22a1aedc08ddfbd901f2b01e90d215b39855 /include/ui/kbd-state.h
parent271a197425528f4448b3d351be25995abe901374 (diff)
downloadfocaccia-qemu-d4c199566f6fa5de4afa344712462cfd322de9d0.tar.gz
focaccia-qemu-d4c199566f6fa5de4afa344712462cfd322de9d0.zip
ui/vnc: Do not use console_select()
console_select() is shared by other displays and a console_select() call
from one of them triggers console switching also in ui/curses,
circumventing key state reinitialization that needs to be performed in
preparation and resulting in stuck keys.

Use its internal state to track the current active console to prevent
such a surprise console switch.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20240319-console-v2-2-3fd6feef321a@daynix.com>
Diffstat (limited to 'include/ui/kbd-state.h')
-rw-r--r--include/ui/kbd-state.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/ui/kbd-state.h b/include/ui/kbd-state.h
index fb79776128..1f37b932eb 100644
--- a/include/ui/kbd-state.h
+++ b/include/ui/kbd-state.h
@@ -99,4 +99,15 @@ bool qkbd_state_modifier_get(QKbdState *kbd, QKbdModifier mod);
  */
 void qkbd_state_lift_all_keys(QKbdState *kbd);
 
+/**
+ * qkbd_state_switch_console: Switch console.
+ *
+ * This sends key up events to the previous console for all keys which are in
+ * down state to prevent keys being stuck, and remembers the new console.
+ *
+ * @kbd: state tracker state.
+ * @con: new QemuConsole for this state tracker.
+ */
+void qkbd_state_switch_console(QKbdState *kbd, QemuConsole *con);
+
 #endif /* QEMU_UI_KBD_STATE_H */