qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] chardev/char-win-stdio: Fix keyboard input after exit Qemu on


From: Irina Ryapolova
Subject: [PATCH] chardev/char-win-stdio: Fix keyboard input after exit Qemu on
Date: Sun, 24 Mar 2024 18:21:50 +0300

After exit Qemu need to return the terminal to the default state.

Signed-off-by: Irina Ryapolova <irina.ryapolova@syntacore.com>
---
 chardev/char-win-stdio.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/chardev/char-win-stdio.c b/chardev/char-win-stdio.c
index 1a18999e78..4fa2c3de8b 100644
--- a/chardev/char-win-stdio.c
+++ b/chardev/char-win-stdio.c
@@ -220,6 +220,7 @@ err1:
 static void char_win_stdio_finalize(Object *obj)
 {
     WinStdioChardev *stdio = WIN_STDIO_CHARDEV(obj);
+    DWORD dwMode;
 
     if (stdio->hInputReadyEvent != INVALID_HANDLE_VALUE) {
         CloseHandle(stdio->hInputReadyEvent);
@@ -230,6 +231,10 @@ static void char_win_stdio_finalize(Object *obj)
     if (stdio->hInputThread != INVALID_HANDLE_VALUE) {
         TerminateThread(stdio->hInputThread, 0);
     }
+
+    GetConsoleMode(stdio->hStdIn, &dwMode);
+    dwMode &= ~ENABLE_VIRTUAL_TERMINAL_INPUT;
+    SetConsoleMode(stdio->hStdIn, dwMode);
 }
 
 static int win_stdio_write(Chardev *chr, const uint8_t *buf, int len)
-- 
2.25.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]