qemu-devel
[Top][All Lists]
Advanced

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

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


From: Marc-André Lureau
Subject: Re: [PATCH] chardev/char-win-stdio: Fix keyboard input after exit Qemu on
Date: Mon, 25 Mar 2024 10:44:59 +0400

Hi

On Sun, Mar 24, 2024 at 7:23 PM Irina Ryapolova
<irina.ryapolova@syntacore.com> wrote:
>
> 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);

I'd suggest saving the mode when opening instead, to make sure we
restore the same value.

thanks

-- 
Marc-André Lureau



reply via email to

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