[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] input-linux: Delay grab toggle if keys are pressed
From: |
Rainer Müller |
Subject: |
[PATCH 1/2] input-linux: Delay grab toggle if keys are pressed |
Date: |
Sat, 1 May 2021 21:06:21 +0200 |
When multiple keyboards are passed to the guest with input-linux, there
could still be keys pressed on the other keyboard when toggling grab.
Delay toggling grab on the other keyboard until all keys are released,
otherwise keys could be stuck on host without a key up event.
Signed-off-by: Rainer Müller <raimue@codingfarm.de>
---
ui/input-linux.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/ui/input-linux.c b/ui/input-linux.c
index 05c0c98819..47d489d738 100644
--- a/ui/input-linux.c
+++ b/ui/input-linux.c
@@ -89,7 +89,12 @@ static void input_linux_toggle_grab(InputLinux *il)
continue;
}
if (item->grab_active != il->grab_active) {
- input_linux_toggle_grab(item);
+ if (item->keycount) {
+ /* delay grab until all keys are released */
+ item->grab_request = true;
+ } else {
+ input_linux_toggle_grab(item);
+ }
}
}
}
--
2.25.1