ui/vc: remove kbd_put_keysym() and update function calls

The function calls to `kbd_put_keysym` have been updated to now call
`kbd_put_keysym_console` with a NULL console parameter.

Like most console functions, NULL argument is now for the active console.

This will allow to rename the text console functions in a consistent manner.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
This commit is contained in:
Marc-André Lureau 2023-08-30 13:38:19 +04:00
parent 67a6fcb2b0
commit f5360a0d28
5 changed files with 36 additions and 37 deletions

View File

@ -115,7 +115,6 @@ bool qemu_mouse_set(int index, Error **errp);
void kbd_put_keysym_console(QemuTextConsole *s, int keysym);
bool kbd_put_qcode_console(QemuTextConsole *s, int qcode, bool ctrl);
void kbd_put_string_console(QemuTextConsole *s, const char *str, int len);
void kbd_put_keysym(int keysym);
/* Touch devices */
typedef struct touch_slot {

View File

@ -784,7 +784,7 @@ static CGEventRef handleTapEvent(CGEventTapProxy proxy, CGEventType type, CGEven
}
if (keysym) {
kbd_put_keysym(keysym);
kbd_put_keysym_console(NULL, keysym);
}
}

View File

@ -1141,6 +1141,13 @@ void kbd_put_keysym_console(QemuTextConsole *s, int keysym)
int c;
uint32_t num_free;
if (!s) {
if (!QEMU_IS_TEXT_CONSOLE(active_console)) {
return;
}
s = QEMU_TEXT_CONSOLE(active_console);
}
switch(keysym) {
case QEMU_KEY_CTRL_UP:
console_scroll(s, -1);
@ -1231,13 +1238,6 @@ void kbd_put_string_console(QemuTextConsole *s, const char *str, int len)
}
}
void kbd_put_keysym(int keysym)
{
if (QEMU_IS_TEXT_CONSOLE(active_console)) {
kbd_put_keysym_console(QEMU_TEXT_CONSOLE(active_console), keysym);
}
}
static void text_console_invalidate(void *opaque)
{
QemuTextConsole *s = QEMU_TEXT_CONSOLE(opaque);

View File

@ -400,7 +400,7 @@ static void curses_refresh(DisplayChangeListener *dcl)
if (keysym == -1)
keysym = chr;
kbd_put_keysym(keysym);
kbd_put_keysym_console(NULL, keysym);
}
}
}

View File

@ -1945,88 +1945,88 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym)
case 0xb8: /* Right ALT */
break;
case 0xc8:
kbd_put_keysym(QEMU_KEY_UP);
kbd_put_keysym_console(NULL, QEMU_KEY_UP);
break;
case 0xd0:
kbd_put_keysym(QEMU_KEY_DOWN);
kbd_put_keysym_console(NULL, QEMU_KEY_DOWN);
break;
case 0xcb:
kbd_put_keysym(QEMU_KEY_LEFT);
kbd_put_keysym_console(NULL, QEMU_KEY_LEFT);
break;
case 0xcd:
kbd_put_keysym(QEMU_KEY_RIGHT);
kbd_put_keysym_console(NULL, QEMU_KEY_RIGHT);
break;
case 0xd3:
kbd_put_keysym(QEMU_KEY_DELETE);
kbd_put_keysym_console(NULL, QEMU_KEY_DELETE);
break;
case 0xc7:
kbd_put_keysym(QEMU_KEY_HOME);
kbd_put_keysym_console(NULL, QEMU_KEY_HOME);
break;
case 0xcf:
kbd_put_keysym(QEMU_KEY_END);
kbd_put_keysym_console(NULL, QEMU_KEY_END);
break;
case 0xc9:
kbd_put_keysym(QEMU_KEY_PAGEUP);
kbd_put_keysym_console(NULL, QEMU_KEY_PAGEUP);
break;
case 0xd1:
kbd_put_keysym(QEMU_KEY_PAGEDOWN);
kbd_put_keysym_console(NULL, QEMU_KEY_PAGEDOWN);
break;
case 0x47:
kbd_put_keysym(numlock ? '7' : QEMU_KEY_HOME);
kbd_put_keysym_console(NULL, numlock ? '7' : QEMU_KEY_HOME);
break;
case 0x48:
kbd_put_keysym(numlock ? '8' : QEMU_KEY_UP);
kbd_put_keysym_console(NULL, numlock ? '8' : QEMU_KEY_UP);
break;
case 0x49:
kbd_put_keysym(numlock ? '9' : QEMU_KEY_PAGEUP);
kbd_put_keysym_console(NULL, numlock ? '9' : QEMU_KEY_PAGEUP);
break;
case 0x4b:
kbd_put_keysym(numlock ? '4' : QEMU_KEY_LEFT);
kbd_put_keysym_console(NULL, numlock ? '4' : QEMU_KEY_LEFT);
break;
case 0x4c:
kbd_put_keysym('5');
kbd_put_keysym_console(NULL, '5');
break;
case 0x4d:
kbd_put_keysym(numlock ? '6' : QEMU_KEY_RIGHT);
kbd_put_keysym_console(NULL, numlock ? '6' : QEMU_KEY_RIGHT);
break;
case 0x4f:
kbd_put_keysym(numlock ? '1' : QEMU_KEY_END);
kbd_put_keysym_console(NULL, numlock ? '1' : QEMU_KEY_END);
break;
case 0x50:
kbd_put_keysym(numlock ? '2' : QEMU_KEY_DOWN);
kbd_put_keysym_console(NULL, numlock ? '2' : QEMU_KEY_DOWN);
break;
case 0x51:
kbd_put_keysym(numlock ? '3' : QEMU_KEY_PAGEDOWN);
kbd_put_keysym_console(NULL, numlock ? '3' : QEMU_KEY_PAGEDOWN);
break;
case 0x52:
kbd_put_keysym('0');
kbd_put_keysym_console(NULL, '0');
break;
case 0x53:
kbd_put_keysym(numlock ? '.' : QEMU_KEY_DELETE);
kbd_put_keysym_console(NULL, numlock ? '.' : QEMU_KEY_DELETE);
break;
case 0xb5:
kbd_put_keysym('/');
kbd_put_keysym_console(NULL, '/');
break;
case 0x37:
kbd_put_keysym('*');
kbd_put_keysym_console(NULL, '*');
break;
case 0x4a:
kbd_put_keysym('-');
kbd_put_keysym_console(NULL, '-');
break;
case 0x4e:
kbd_put_keysym('+');
kbd_put_keysym_console(NULL, '+');
break;
case 0x9c:
kbd_put_keysym('\n');
kbd_put_keysym_console(NULL, '\n');
break;
default:
if (control) {
kbd_put_keysym(sym & 0x1f);
kbd_put_keysym_console(NULL, sym & 0x1f);
} else {
kbd_put_keysym(sym);
kbd_put_keysym_console(NULL, sym);
}
break;
}