ui/hmp: move index_from_key() where it is used
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Marc-André Lureau committed
Jun 8, 2026 at 17:09 UTC
074c48e51ec21659e3f8635808c5dbc4a05d695c
3 files changed
+15
-18
include/ui/console.h
-3
@@ -450,9 +450,6 @@ bool vnc_display_reload_certs(const char *id, Error **errp);
450
bool vnc_display_update(DisplayUpdateOptionsVNC *arg, Error **errp);
451
void vnc_cleanup(void);
452
453
-/* input.c */
454
-int index_from_key(const char *key, size_t key_length);
455
-
453
#ifdef CONFIG_LINUX
454
/* udmabuf.c */
455
int udmabuf_fd(void);
ui/input-legacy.c
-15
@@ -56,21 +56,6 @@ struct QEMUPutLEDEntry {
56
static QTAILQ_HEAD(, QEMUPutLEDEntry) led_handlers =
57
QTAILQ_HEAD_INITIALIZER(led_handlers);
58
59
-int index_from_key(const char *key, size_t key_length)
60
-{
61
- int i;
62
-
63
- for (i = 0; i < Q_KEY_CODE__MAX; i++) {
64
- if (!strncmp(key, QKeyCode_str(i), key_length) &&
65
- !QKeyCode_str(i)[key_length]) {
66
- break;
67
- }
68
- }
69
-
70
- /* Return Q_KEY_CODE__MAX if the key is invalid */
71
- return i;
72
-}
73
-
59
void qmp_send_key(KeyValueList *keys, bool has_hold_time, int64_t hold_time,
60
Error **errp)
61
{
ui/ui-hmp-cmds.c
+15
@@ -350,6 +350,21 @@ void hmp_change_vnc(Monitor *mon, const char *device, const char *target,
350
}
351
#endif
352
353
+static int index_from_key(const char *key, size_t key_length)
354
+{
355
+ int i;
356
+
357
+ for (i = 0; i < Q_KEY_CODE__MAX; i++) {
358
+ if (!strncmp(key, QKeyCode_str(i), key_length) &&
359
+ !QKeyCode_str(i)[key_length]) {
360
+ break;
361
+ }
362
+ }
363
+
364
+ /* Return Q_KEY_CODE__MAX if the key is invalid */
365
+ return i;
366
+}
367
+
368
void hmp_sendkey(Monitor *mon, const QDict *qdict)
369
{
370
const char *keys = qdict_get_str(qdict, "keys");