qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] ui/vnc: Respect bound console


From: Marc-André Lureau
Subject: Re: [PATCH] ui/vnc: Respect bound console
Date: Mon, 11 Dec 2023 13:43:55 +0400

On Mon, Dec 11, 2023 at 12:51 PM Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> ui/vnc may have a bound console so pass it to qemu_console_is_graphic()
> and qemu_text_console_put_keysym().
>
> Fixes: 1d0d59fe2919 ("vnc: allow binding servers to qemu consoles")
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  ui/vnc.c | 59 ++++++++++++++++++++++++++++++-----------------------------
>  1 file changed, 30 insertions(+), 29 deletions(-)
>
> diff --git a/ui/vnc.c b/ui/vnc.c
> index 4f23a0fa79..ddab42346f 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -1931,7 +1931,8 @@ static void do_key_event(VncState *vs, int down, int 
> keycode, int sym)
>      }
>
>      qkbd_state_key_event(vs->vd->kbd, qcode, down);
> -    if (!qemu_console_is_graphic(NULL)) {
> +    if (!qemu_console_is_graphic(vs->vd->dcl.con)) {
> +        QemuTextConsole *con = QEMU_TEXT_CONSOLE(vs->vd->dcl.con);
>          bool numlock = qkbd_state_modifier_get(vs->vd->kbd, 
> QKBD_MOD_NUMLOCK);
>          bool control = qkbd_state_modifier_get(vs->vd->kbd, QKBD_MOD_CTRL);
>          /* QEMU console emulation */
> @@ -1945,88 +1946,88 @@ static void do_key_event(VncState *vs, int down, int 
> keycode, int sym)
>              case 0xb8:                          /* Right ALT */
>                  break;
>              case 0xc8:
> -                qemu_text_console_put_keysym(NULL, QEMU_KEY_UP);
> +                qemu_text_console_put_keysym(con, QEMU_KEY_UP);
>                  break;
>              case 0xd0:
> -                qemu_text_console_put_keysym(NULL, QEMU_KEY_DOWN);
> +                qemu_text_console_put_keysym(con, QEMU_KEY_DOWN);
>                  break;
>              case 0xcb:
> -                qemu_text_console_put_keysym(NULL, QEMU_KEY_LEFT);
> +                qemu_text_console_put_keysym(con, QEMU_KEY_LEFT);
>                  break;
>              case 0xcd:
> -                qemu_text_console_put_keysym(NULL, QEMU_KEY_RIGHT);
> +                qemu_text_console_put_keysym(con, QEMU_KEY_RIGHT);
>                  break;
>              case 0xd3:
> -                qemu_text_console_put_keysym(NULL, QEMU_KEY_DELETE);
> +                qemu_text_console_put_keysym(con, QEMU_KEY_DELETE);
>                  break;
>              case 0xc7:
> -                qemu_text_console_put_keysym(NULL, QEMU_KEY_HOME);
> +                qemu_text_console_put_keysym(con, QEMU_KEY_HOME);
>                  break;
>              case 0xcf:
> -                qemu_text_console_put_keysym(NULL, QEMU_KEY_END);
> +                qemu_text_console_put_keysym(con, QEMU_KEY_END);
>                  break;
>              case 0xc9:
> -                qemu_text_console_put_keysym(NULL, QEMU_KEY_PAGEUP);
> +                qemu_text_console_put_keysym(con, QEMU_KEY_PAGEUP);
>                  break;
>              case 0xd1:
> -                qemu_text_console_put_keysym(NULL, QEMU_KEY_PAGEDOWN);
> +                qemu_text_console_put_keysym(con, QEMU_KEY_PAGEDOWN);
>                  break;
>
>              case 0x47:
> -                qemu_text_console_put_keysym(NULL, numlock ? '7' : 
> QEMU_KEY_HOME);
> +                qemu_text_console_put_keysym(con, numlock ? '7' : 
> QEMU_KEY_HOME);
>                  break;
>              case 0x48:
> -                qemu_text_console_put_keysym(NULL, numlock ? '8' : 
> QEMU_KEY_UP);
> +                qemu_text_console_put_keysym(con, numlock ? '8' : 
> QEMU_KEY_UP);
>                  break;
>              case 0x49:
> -                qemu_text_console_put_keysym(NULL, numlock ? '9' : 
> QEMU_KEY_PAGEUP);
> +                qemu_text_console_put_keysym(con, numlock ? '9' : 
> QEMU_KEY_PAGEUP);
>                  break;
>              case 0x4b:
> -                qemu_text_console_put_keysym(NULL, numlock ? '4' : 
> QEMU_KEY_LEFT);
> +                qemu_text_console_put_keysym(con, numlock ? '4' : 
> QEMU_KEY_LEFT);
>                  break;
>              case 0x4c:
> -                qemu_text_console_put_keysym(NULL, '5');
> +                qemu_text_console_put_keysym(con, '5');
>                  break;
>              case 0x4d:
> -                qemu_text_console_put_keysym(NULL, numlock ? '6' : 
> QEMU_KEY_RIGHT);
> +                qemu_text_console_put_keysym(con, numlock ? '6' : 
> QEMU_KEY_RIGHT);
>                  break;
>              case 0x4f:
> -                qemu_text_console_put_keysym(NULL, numlock ? '1' : 
> QEMU_KEY_END);
> +                qemu_text_console_put_keysym(con, numlock ? '1' : 
> QEMU_KEY_END);
>                  break;
>              case 0x50:
> -                qemu_text_console_put_keysym(NULL, numlock ? '2' : 
> QEMU_KEY_DOWN);
> +                qemu_text_console_put_keysym(con, numlock ? '2' : 
> QEMU_KEY_DOWN);
>                  break;
>              case 0x51:
> -                qemu_text_console_put_keysym(NULL, numlock ? '3' : 
> QEMU_KEY_PAGEDOWN);
> +                qemu_text_console_put_keysym(con, numlock ? '3' : 
> QEMU_KEY_PAGEDOWN);
>                  break;
>              case 0x52:
> -                qemu_text_console_put_keysym(NULL, '0');
> +                qemu_text_console_put_keysym(con, '0');
>                  break;
>              case 0x53:
> -                qemu_text_console_put_keysym(NULL, numlock ? '.' : 
> QEMU_KEY_DELETE);
> +                qemu_text_console_put_keysym(con, numlock ? '.' : 
> QEMU_KEY_DELETE);
>                  break;
>
>              case 0xb5:
> -                qemu_text_console_put_keysym(NULL, '/');
> +                qemu_text_console_put_keysym(con, '/');
>                  break;
>              case 0x37:
> -                qemu_text_console_put_keysym(NULL, '*');
> +                qemu_text_console_put_keysym(con, '*');
>                  break;
>              case 0x4a:
> -                qemu_text_console_put_keysym(NULL, '-');
> +                qemu_text_console_put_keysym(con, '-');
>                  break;
>              case 0x4e:
> -                qemu_text_console_put_keysym(NULL, '+');
> +                qemu_text_console_put_keysym(con, '+');
>                  break;
>              case 0x9c:
> -                qemu_text_console_put_keysym(NULL, '\n');
> +                qemu_text_console_put_keysym(con, '\n');
>                  break;
>
>              default:
>                  if (control) {
> -                    qemu_text_console_put_keysym(NULL, sym & 0x1f);
> +                    qemu_text_console_put_keysym(con, sym & 0x1f);
>                  } else {
> -                    qemu_text_console_put_keysym(NULL, sym);
> +                    qemu_text_console_put_keysym(con, sym);
>                  }
>                  break;
>              }
> @@ -2044,7 +2045,7 @@ static void key_event(VncState *vs, int down, uint32_t 
> sym)
>      int keycode;
>      int lsym = sym;
>
> -    if (lsym >= 'A' && lsym <= 'Z' && qemu_console_is_graphic(NULL)) {
> +    if (lsym >= 'A' && lsym <= 'Z' && 
> qemu_console_is_graphic(vs->vd->dcl.con)) {
>          lsym = lsym - 'A' + 'a';
>      }
>
>
> ---
> base-commit: 9c74490bff6c8886a922008d0c9ce6cae70dd17e
> change-id: 20231211-vnc-f9d7b0880acb
>
> Best regards,
> --
> Akihiko Odaki <akihiko.odaki@daynix.com>
>




reply via email to

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