From d4c199566f6fa5de4afa344712462cfd322de9d0 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Tue, 19 Mar 2024 12:08:40 +0900 Subject: ui/vnc: Do not use console_select() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Marc-André Lureau Message-Id: <20240319-console-v2-2-3fd6feef321a@daynix.com> --- ui/console.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'ui/console.c') diff --git a/ui/console.c b/ui/console.c index 832055675c..fbc1b9b8b5 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1325,6 +1325,18 @@ void graphic_console_close(QemuConsole *con) dpy_gfx_replace_surface(con, surface); } +QemuConsole *qemu_console_lookup_default(void) +{ + QemuConsole *con; + + QTAILQ_FOREACH(con, &consoles, next) { + if (QEMU_IS_GRAPHIC_CONSOLE(con)) { + return con; + } + } + return QTAILQ_FIRST(&consoles); +} + QemuConsole *qemu_console_lookup_by_index(unsigned int index) { QemuConsole *con; -- cgit 1.4.1