Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ui/vc: rename kbd_put to qemu_text_console functions
They are QemuTextConsole functions, let's make it clear.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
  • Loading branch information
elmarco committed Sep 12, 2023
1 parent f5360a0 commit cc6ba2c
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 43 deletions.
6 changes: 3 additions & 3 deletions include/ui/console.h
Expand Up @@ -112,9 +112,9 @@ bool qemu_mouse_set(int index, Error **errp);
#define QEMU_KEY_CTRL_PAGEUP 0xe406
#define QEMU_KEY_CTRL_PAGEDOWN 0xe407

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 qemu_text_console_put_keysym(QemuTextConsole *s, int keysym);
bool qemu_text_console_put_qcode(QemuTextConsole *s, int qcode, bool ctrl);
void qemu_text_console_put_string(QemuTextConsole *s, const char *str, int len);

/* Touch devices */
typedef struct touch_slot {
Expand Down
2 changes: 1 addition & 1 deletion ui/cocoa.m
Expand Up @@ -784,7 +784,7 @@ - (void) handleMonitorInput:(NSEvent *)event
}

if (keysym) {
kbd_put_keysym_console(NULL, keysym);
qemu_text_console_put_keysym(NULL, keysym);
}
}

Expand Down
10 changes: 5 additions & 5 deletions ui/console.c
Expand Up @@ -1135,7 +1135,7 @@ static void kbd_send_chars(QemuTextConsole *s)
}

/* called when an ascii key is pressed */
void kbd_put_keysym_console(QemuTextConsole *s, int keysym)
void qemu_text_console_put_keysym(QemuTextConsole *s, int keysym)
{
uint8_t buf[16], *q;
int c;
Expand Down Expand Up @@ -1217,24 +1217,24 @@ static const int ctrl_qcode_to_keysym[Q_KEY_CODE__MAX] = {
[Q_KEY_CODE_PGDN] = QEMU_KEY_CTRL_PAGEDOWN,
};

bool kbd_put_qcode_console(QemuTextConsole *s, int qcode, bool ctrl)
bool qemu_text_console_put_qcode(QemuTextConsole *s, int qcode, bool ctrl)
{
int keysym;

keysym = ctrl ? ctrl_qcode_to_keysym[qcode] : qcode_to_keysym[qcode];
if (keysym == 0) {
return false;
}
kbd_put_keysym_console(s, keysym);
qemu_text_console_put_keysym(s, keysym);
return true;
}

void kbd_put_string_console(QemuTextConsole *s, const char *str, int len)
void qemu_text_console_put_string(QemuTextConsole *s, const char *str, int len)
{
int i;

for (i = 0; i < len && str[i]; i++) {
kbd_put_keysym_console(s, str[i]);
qemu_text_console_put_keysym(s, str[i]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion ui/curses.c
Expand Up @@ -400,7 +400,7 @@ static void curses_refresh(DisplayChangeListener *dcl)
if (keysym == -1)
keysym = chr;

kbd_put_keysym_console(NULL, keysym);
qemu_text_console_put_keysym(NULL, keysym);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions ui/gtk.c
Expand Up @@ -1190,12 +1190,12 @@ static gboolean gd_text_key_down(GtkWidget *widget,
QemuTextConsole *con = QEMU_TEXT_CONSOLE(vc->gfx.dcl.con);

if (key->keyval == GDK_KEY_Delete) {
kbd_put_qcode_console(con, Q_KEY_CODE_DELETE, false);
qemu_text_console_put_qcode(con, Q_KEY_CODE_DELETE, false);
} else if (key->length) {
kbd_put_string_console(con, key->string, key->length);
qemu_text_console_put_string(con, key->string, key->length);
} else {
int qcode = gd_map_keycode(gd_get_keycode(key));
kbd_put_qcode_console(con, qcode, false);
qemu_text_console_put_qcode(con, qcode, false);
}
return TRUE;
}
Expand Down
4 changes: 2 additions & 2 deletions ui/sdl2-input.c
Expand Up @@ -49,10 +49,10 @@ void sdl2_process_key(struct sdl2_console *scon,
if (ev->type == SDL_KEYDOWN) {
switch (qcode) {
case Q_KEY_CODE_RET:
kbd_put_keysym_console(s, '\n');
qemu_text_console_put_keysym(s, '\n');
break;
default:
kbd_put_qcode_console(s, qcode, ctrl);
qemu_text_console_put_qcode(s, qcode, ctrl);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion ui/sdl2.c
Expand Up @@ -484,7 +484,7 @@ static void handle_textinput(SDL_Event *ev)
}

if (QEMU_IS_TEXT_CONSOLE(con)) {
kbd_put_string_console(QEMU_TEXT_CONSOLE(con), ev->text.text, strlen(ev->text.text));
qemu_text_console_put_string(QEMU_TEXT_CONSOLE(con), ev->text.text, strlen(ev->text.text));
}
}

Expand Down
54 changes: 27 additions & 27 deletions ui/vnc.c
Expand Up @@ -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_console(NULL, QEMU_KEY_UP);
qemu_text_console_put_keysym(NULL, QEMU_KEY_UP);
break;
case 0xd0:
kbd_put_keysym_console(NULL, QEMU_KEY_DOWN);
qemu_text_console_put_keysym(NULL, QEMU_KEY_DOWN);
break;
case 0xcb:
kbd_put_keysym_console(NULL, QEMU_KEY_LEFT);
qemu_text_console_put_keysym(NULL, QEMU_KEY_LEFT);
break;
case 0xcd:
kbd_put_keysym_console(NULL, QEMU_KEY_RIGHT);
qemu_text_console_put_keysym(NULL, QEMU_KEY_RIGHT);
break;
case 0xd3:
kbd_put_keysym_console(NULL, QEMU_KEY_DELETE);
qemu_text_console_put_keysym(NULL, QEMU_KEY_DELETE);
break;
case 0xc7:
kbd_put_keysym_console(NULL, QEMU_KEY_HOME);
qemu_text_console_put_keysym(NULL, QEMU_KEY_HOME);
break;
case 0xcf:
kbd_put_keysym_console(NULL, QEMU_KEY_END);
qemu_text_console_put_keysym(NULL, QEMU_KEY_END);
break;
case 0xc9:
kbd_put_keysym_console(NULL, QEMU_KEY_PAGEUP);
qemu_text_console_put_keysym(NULL, QEMU_KEY_PAGEUP);
break;
case 0xd1:
kbd_put_keysym_console(NULL, QEMU_KEY_PAGEDOWN);
qemu_text_console_put_keysym(NULL, QEMU_KEY_PAGEDOWN);
break;

case 0x47:
kbd_put_keysym_console(NULL, numlock ? '7' : QEMU_KEY_HOME);
qemu_text_console_put_keysym(NULL, numlock ? '7' : QEMU_KEY_HOME);
break;
case 0x48:
kbd_put_keysym_console(NULL, numlock ? '8' : QEMU_KEY_UP);
qemu_text_console_put_keysym(NULL, numlock ? '8' : QEMU_KEY_UP);
break;
case 0x49:
kbd_put_keysym_console(NULL, numlock ? '9' : QEMU_KEY_PAGEUP);
qemu_text_console_put_keysym(NULL, numlock ? '9' : QEMU_KEY_PAGEUP);
break;
case 0x4b:
kbd_put_keysym_console(NULL, numlock ? '4' : QEMU_KEY_LEFT);
qemu_text_console_put_keysym(NULL, numlock ? '4' : QEMU_KEY_LEFT);
break;
case 0x4c:
kbd_put_keysym_console(NULL, '5');
qemu_text_console_put_keysym(NULL, '5');
break;
case 0x4d:
kbd_put_keysym_console(NULL, numlock ? '6' : QEMU_KEY_RIGHT);
qemu_text_console_put_keysym(NULL, numlock ? '6' : QEMU_KEY_RIGHT);
break;
case 0x4f:
kbd_put_keysym_console(NULL, numlock ? '1' : QEMU_KEY_END);
qemu_text_console_put_keysym(NULL, numlock ? '1' : QEMU_KEY_END);
break;
case 0x50:
kbd_put_keysym_console(NULL, numlock ? '2' : QEMU_KEY_DOWN);
qemu_text_console_put_keysym(NULL, numlock ? '2' : QEMU_KEY_DOWN);
break;
case 0x51:
kbd_put_keysym_console(NULL, numlock ? '3' : QEMU_KEY_PAGEDOWN);
qemu_text_console_put_keysym(NULL, numlock ? '3' : QEMU_KEY_PAGEDOWN);
break;
case 0x52:
kbd_put_keysym_console(NULL, '0');
qemu_text_console_put_keysym(NULL, '0');
break;
case 0x53:
kbd_put_keysym_console(NULL, numlock ? '.' : QEMU_KEY_DELETE);
qemu_text_console_put_keysym(NULL, numlock ? '.' : QEMU_KEY_DELETE);
break;

case 0xb5:
kbd_put_keysym_console(NULL, '/');
qemu_text_console_put_keysym(NULL, '/');
break;
case 0x37:
kbd_put_keysym_console(NULL, '*');
qemu_text_console_put_keysym(NULL, '*');
break;
case 0x4a:
kbd_put_keysym_console(NULL, '-');
qemu_text_console_put_keysym(NULL, '-');
break;
case 0x4e:
kbd_put_keysym_console(NULL, '+');
qemu_text_console_put_keysym(NULL, '+');
break;
case 0x9c:
kbd_put_keysym_console(NULL, '\n');
qemu_text_console_put_keysym(NULL, '\n');
break;

default:
if (control) {
kbd_put_keysym_console(NULL, sym & 0x1f);
qemu_text_console_put_keysym(NULL, sym & 0x1f);
} else {
kbd_put_keysym_console(NULL, sym);
qemu_text_console_put_keysym(NULL, sym);
}
break;
}
Expand Down

0 comments on commit cc6ba2c

Please sign in to comment.