All of lore.kernel.org
 help / color / mirror / Atom feed
From: byxk <patricktsen@gmail.com>
To: qemu-devel@nongnu.org
Cc: kraxel@redhat.com, byxk <patricktsen@gmail.com>
Subject: [Qemu-devel] [PATCH 1/1] input-linux: provide hotkeys for evdev toggle
Date: Sun,  7 Jan 2018 03:13:41 -0800	[thread overview]
Message-ID: <20180107111341.8879-2-patricktsen@gmail.com> (raw)
In-Reply-To: <20180107111341.8879-1-patricktsen@gmail.com>

---
 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
+@item --evdev-lhotkey @var{evdevLHotkey}
+@findex --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
+@item --evdev-rhotkey @var{evdevRHotkey}
+@findex --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

  reply	other threads:[~2018-01-07 11:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-07 11:13 [Qemu-devel] [PATCH 0/1] input-linux: provide hotkeys for evdev toggle byxk
2018-01-07 11:13 ` byxk [this message]
2018-01-07 11:31 ` no-reply
2018-01-07 11:45   ` Patrick Tseng
  -- strict thread matches above, loose matches on Subject: below --
2018-01-07 22:14 [Qemu-devel] [PATCH v2 " byxk
2018-01-07 22:14 ` [Qemu-devel] [PATCH 1/1] " byxk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180107111341.8879-2-patricktsen@gmail.com \
    --to=patricktsen@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.