[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/1] input-linux: provide hotkeys for evdev toggle
From: |
byxk |
Subject: |
[Qemu-devel] [PATCH 1/1] input-linux: provide hotkeys for evdev toggle |
Date: |
Sun, 7 Jan 2018 03:13:41 -0800 |
---
include/ui/input.h | 3 +++
qemu-options.hx | 13 +++++++++++++
ui/input-linux.c | 4 ++--
vl.c | 8 ++++++++
4 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/include/ui/input.h b/include/ui/input.h
index 5cc76d6e41..94b1468159 100644
--- a/include/ui/input.h
+++ b/include/ui/input.h
@@ -80,4 +80,7 @@ extern const guint16 qemu_input_map_qnum_to_qcode[];
extern const guint qemu_input_map_qcode_to_linux_len;
extern const guint16 qemu_input_map_qcode_to_linux[];
+extern int qemu_evdev_rhotkey;
+extern int qemu_evdev_lhotkey;
+
#endif /* INPUT_H */
diff --git a/qemu-options.hx b/qemu-options.hx
index 94647e21e3..56cafd7592 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -4264,6 +4264,19 @@ contents of @code{iv.b64} to the second secret
ETEXI
+DEF("evdev-lhotkey", HAS_ARG, QEMU_OPTION_evdev_lhotkey, "--evdev-lhotkey
left hotkey for evdev input toggle, default=LEFTCTRL(29)\n", QEMU_ARCH_ALL)
+STEXI
address@hidden --evdev-lhotkey @var{evdevLHotkey}
address@hidden --evdev-lhotkey
+Left keycode to use in toggling evdev
+ETEXI
+
+DEF("evdev-rhotkey", HAS_ARG, QEMU_OPTION_evdev_rhotkey, "--evdev-rhotkey
right hotkey for evdev input toggle, default=RIGHTCTRL(97)\n", QEMU_ARCH_ALL)
+STEXI
address@hidden --evdev-rhotkey @var{evdevRHotkey}
address@hidden --evdev-rhotkey
+Right keycode to use in toggling evdev
+ETEXI
HXCOMM This is the last statement. Insert new options before this line!
STEXI
diff --git a/ui/input-linux.c b/ui/input-linux.c
index 9720333b2c..8af1450dce 100644
--- a/ui/input-linux.c
+++ b/ui/input-linux.c
@@ -134,8 +134,8 @@ static void input_linux_handle_keyboard(InputLinux *il,
}
/* hotkey -> record switch request ... */
- if (il->keydown[KEY_LEFTCTRL] &&
- il->keydown[KEY_RIGHTCTRL]) {
+ if (il->keydown[qemu_evdev_lhotkey] &&
+ il->keydown[qemu_evdev_rhotkey]) {
il->grab_request = true;
}
diff --git a/vl.c b/vl.c
index d3a5c5d021..7bdf6030cf 100644
--- a/vl.c
+++ b/vl.c
@@ -184,6 +184,8 @@ bool boot_strict;
uint8_t *boot_splash_filedata;
size_t boot_splash_filedata_size;
uint8_t qemu_extra_params_fw[2];
+int qemu_evdev_lhotkey = 29; /* LEFTCONTROL */
+int qemu_evdev_rhotkey = 97; /* RIGHTCONTROL */
int icount_align_option;
@@ -3378,6 +3380,12 @@ int main(int argc, char **argv, char **envp)
qemu_opts_set(qemu_find_opts("machine"), 0, "initrd", optarg,
&error_abort);
break;
+ case QEMU_OPTION_evdev_rhotkey:
+ qemu_evdev_rhotkey = strtol(optarg, NULL, 0);
+ break;
+ case QEMU_OPTION_evdev_lhotkey:
+ qemu_evdev_lhotkey = strtol(optarg, NULL, 0);
+ break;
case QEMU_OPTION_append:
qemu_opts_set(qemu_find_opts("machine"), 0, "append", optarg,
&error_abort);
--
2.15.1