summaryrefslogtreecommitdiffstats
path: root/ui/input-linux.c
diff options
context:
space:
mode:
authorPeter Maydell2016-10-13 15:27:58 +0200
committerPeter Maydell2016-10-13 15:27:58 +0200
commit6aa5a3679449cdf0b6fe5a6829b22e642ded57fd (patch)
treefca8e8a96ad2b9aa5a6bf10ce6295d636c87a467 /ui/input-linux.c
parentRevert "char: use a fixed idx for child muxed chr" (diff)
parentinput-linux: initialize key state (diff)
downloadqemu-6aa5a3679449cdf0b6fe5a6829b22e642ded57fd.tar.gz
qemu-6aa5a3679449cdf0b6fe5a6829b22e642ded57fd.tar.xz
qemu-6aa5a3679449cdf0b6fe5a6829b22e642ded57fd.zip
Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20161013-1' into staging
ui: vnc cleanups, input-linux kbd fix. # gpg: Signature made Thu 13 Oct 2016 09:47:43 BST # gpg: using RSA key 0x4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/pull-ui-20161013-1: input-linux: initialize key state ui: rename vnc_init_state to vnc_start_protocol ui: move some initialization out of vnc_init_state ui: remove bogus call to reset_keys() in vnc_init_state ui: remove bogus call to graphic_hw_update() in vnc_listen_io ui: refactor method for setting up VncDisplay auth types ui: rename misleading 'VncDisplay' variables ui: remove 'ws_tls' field from VncState ui: remove 'enabled' and 'ws_enabled' fields from VncState ui: remove misleading comment from vnc_init_state Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui/input-linux.c')
-rw-r--r--ui/input-linux.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/ui/input-linux.c b/ui/input-linux.c
index 0e230ce699..f345317794 100644
--- a/ui/input-linux.c
+++ b/ui/input-linux.c
@@ -347,7 +347,8 @@ static void input_linux_event(void *opaque)
static void input_linux_complete(UserCreatable *uc, Error **errp)
{
InputLinux *il = INPUT_LINUX(uc);
- uint8_t evtmap, relmap, absmap, keymap[KEY_CNT / 8];
+ uint8_t evtmap, relmap, absmap;
+ uint8_t keymap[KEY_CNT / 8], keystate[KEY_CNT / 8];
unsigned int i;
int rc, ver;
@@ -394,6 +395,7 @@ static void input_linux_complete(UserCreatable *uc, Error **errp)
if (evtmap & (1 << EV_KEY)) {
memset(keymap, 0, sizeof(keymap));
rc = ioctl(il->fd, EVIOCGBIT(EV_KEY, sizeof(keymap)), keymap);
+ rc = ioctl(il->fd, EVIOCGKEY(sizeof(keystate)), keystate);
for (i = 0; i < KEY_CNT; i++) {
if (keymap[i / 8] & (1 << (i % 8))) {
if (linux_is_button(i)) {
@@ -401,12 +403,21 @@ static void input_linux_complete(UserCreatable *uc, Error **errp)
} else {
il->num_keys++;
}
+ if (keystate[i / 8] & (1 << (i % 8))) {
+ il->keydown[i] = true;
+ il->keycount++;
+ }
}
}
}
qemu_set_fd_handler(il->fd, input_linux_event, NULL, il);
- input_linux_toggle_grab(il);
+ if (il->keycount) {
+ /* delay grab until all keys are released */
+ il->grab_request = true;
+ } else {
+ input_linux_toggle_grab(il);
+ }
QTAILQ_INSERT_TAIL(&inputs, il, next);
il->initialized = true;
return;