mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-26 00:06:02 +00:00
fix: desktop session: Shift no longer stays held after typing capitals on a physical keyboard (#766)
* fix: desktop session: Shift no longer stays held after typing capitals on a physical keyboard Android repeats a held key as more key presses. Those were forwarded to the session as more wl_keyboard presses, and KWin's xkb counts every press of a modifier, so Shift held for a few capitals took several presses and one release and stayed held: digits typed !@#, letters stayed capital. The same applied to Ctrl and Alt. - the compositor no longer sends a press for a key that is already down; releases always go through (clients repeat keys themselves from the repeat_info it already sends) - the app stops forwarding Android's repeat events for keyboard keys Reported by whatsupbros with a Keychron Q7 over USB - thank you. * Remove stale comments from statx patch --------- Co-authored-by: The412Banner <the412banner@users.noreply.github.com> Co-authored-by: xXJsonDeruloXx <danielhimebauch@gmail.com>
This commit is contained in:
3 files changed
+9
-18
No files matched your search
@@ -397,6 +397,7 @@ static struct seat_keyboard g_kbs[MAX_PTRS];
|
|||||||
static int g_nkbs;
|
static int g_nkbs;
|
||||||
static uint32_t g_mods_depressed, g_mods_locked;
|
static uint32_t g_mods_depressed, g_mods_locked;
|
||||||
static uint32_t g_mod_keys_held;
|
static uint32_t g_mod_keys_held;
|
||||||
|
static uint8_t g_keys_down[0x300 / 8];
|
||||||
static struct seat_touch g_touches[MAX_PTRS];
|
static struct seat_touch g_touches[MAX_PTRS];
|
||||||
static int g_ntouches;
|
static int g_ntouches;
|
||||||
|
|
||||||
@@ -2845,6 +2846,11 @@ static int update_modifiers(uint32_t evdev, int pressed) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void key_event(uint32_t evdev, int pressed) {
|
static void key_event(uint32_t evdev, int pressed) {
|
||||||
|
if (evdev < 0x300) {
|
||||||
|
uint8_t bit = (uint8_t)(1u << (evdev & 7));
|
||||||
|
if (pressed && (g_keys_down[evdev >> 3] & bit)) return;
|
||||||
|
if (pressed) g_keys_down[evdev >> 3] |= bit; else g_keys_down[evdev >> 3] &= (uint8_t)~bit;
|
||||||
|
}
|
||||||
int mods_changed = update_modifiers(evdev, pressed);
|
int mods_changed = update_modifiers(evdev, pressed);
|
||||||
struct surface *target = NULL;
|
struct surface *target = NULL;
|
||||||
struct wl_resource *ime = droiddeck_ime_target();
|
struct wl_resource *ime = droiddeck_ime_target();
|
||||||
|
|||||||
@@ -1577,6 +1577,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
|||||||
if (event.keyCode != KeyEvent.KEYCODE_BACK && padBridge?.onKeyEvent(event) == true) return true
|
if (event.keyCode != KeyEvent.KEYCODE_BACK && padBridge?.onKeyEvent(event) == true) return true
|
||||||
if (CompositorHost.isStarted && event.keyCode != KeyEvent.KEYCODE_BACK && !fromController) {
|
if (CompositorHost.isStarted && event.keyCode != KeyEvent.KEYCODE_BACK && !fromController) {
|
||||||
val down = event.action == KeyEvent.ACTION_DOWN
|
val down = event.action == KeyEvent.ACTION_DOWN
|
||||||
|
if (down && event.repeatCount > 0) return true
|
||||||
if (down || event.action == KeyEvent.ACTION_UP) {
|
if (down || event.action == KeyEvent.ACTION_UP) {
|
||||||
var evdev = EvdevKeys.fromKeyCode(event.keyCode)
|
var evdev = EvdevKeys.fromKeyCode(event.keyCode)
|
||||||
val ch = event.unicodeChar
|
val ch = event.unicodeChar
|
||||||
|
|||||||
@@ -11,20 +11,8 @@ diff --git a/src/syscall/seccomp.c b/src/syscall/seccomp.c
|
|||||||
index ee7b8acd68660f38fd52f56e951ffb94e9061d68..ff3a79b60e9092a296bb444c919bb3861338727f 100644
|
index ee7b8acd68660f38fd52f56e951ffb94e9061d68..ff3a79b60e9092a296bb444c919bb3861338727f 100644
|
||||||
--- a/src/syscall/seccomp.c
|
--- a/src/syscall/seccomp.c
|
||||||
+++ b/src/syscall/seccomp.c
|
+++ b/src/syscall/seccomp.c
|
||||||
@@ -738,4 +738,4 @@ int enable_syscall_filtering(const Tracee *tracee)
|
@@ -764 +764 @@ static void drop_unneeded_exit_stops(void)
|
||||||
- * the statx one emulates the call when it fails, which only a kernel
|
|
||||||
- * before 4.11 does for want of it - a statx Android's policy traps is
|
|
||||||
- * emulated from SIGSYS instead. Both stops re-read and re-translate
|
|
||||||
- * the path, and are paid on every call.
|
|
||||||
+ * the statx one emulates the syscall before 4.11 and supplies MNT_ID
|
|
||||||
+ * from fdinfo through 5.7. Android policy traps are still emulated from
|
|
||||||
+ * SIGSYS instead. Both stops re-read and re-translate the path, and are
|
|
||||||
+ * paid on every call.
|
|
||||||
@@ -764 +764,4 @@ static void drop_unneeded_exit_stops(void)
|
|
||||||
- if (major > 4 || (major == 4 && minor >= 11))
|
- if (major > 4 || (major == 4 && minor >= 11))
|
||||||
+ /* Linux 4.11 introduced statx; Linux 5.8 added MNT_ID.
|
|
||||||
+ * Keep its exit stop through 5.7 so the missing ID can be
|
|
||||||
+ * recovered from the descriptor's fdinfo. */
|
|
||||||
+ if (major > 5 || (major == 5 && minor >= 8))
|
+ if (major > 5 || (major == 5 && minor >= 8))
|
||||||
diff --git a/src/tracee/statx.c b/src/tracee/statx.c
|
diff --git a/src/tracee/statx.c b/src/tracee/statx.c
|
||||||
index ca972f892e84461cb694dd13a37bfbc67527b320..824771ccf5934e1f870fc36a29fb22fdcad0a856 100644
|
index ca972f892e84461cb694dd13a37bfbc67527b320..824771ccf5934e1f870fc36a29fb22fdcad0a856 100644
|
||||||
@@ -32,11 +20,7 @@ index ca972f892e84461cb694dd13a37bfbc67527b320..824771ccf5934e1f870fc36a29fb22fd
|
|||||||
+++ b/src/tracee/statx.c
|
+++ b/src/tracee/statx.c
|
||||||
@@ -4,0 +5 @@
|
@@ -4,0 +5 @@
|
||||||
+#include "tracee/statx_mnt_id.h"
|
+#include "tracee/statx_mnt_id.h"
|
||||||
@@ -125,0 +127,9 @@ int handle_statx_syscall(Tracee *tracee, bool from_sigsys) {
|
@@ -125,0 +127,5 @@ int handle_statx_syscall(Tracee *tracee, bool from_sigsys) {
|
||||||
+ /* libglnx chases an already-open fd with AT_EMPTY_PATH and requires a
|
|
||||||
+ * mount ID. Kernels before 5.8 can succeed without returning that field.
|
|
||||||
+ * The tracee is stopped at this syscall exit; accept only the ordinary
|
|
||||||
+ * mount ID and verify the fdinfo inode against the statx result. */
|
|
||||||
+ if (droiddeck_proot_statx_fill_mnt_id(tracee->pid, (int) dirfd,
|
+ if (droiddeck_proot_statx_fill_mnt_id(tracee->pid, (int) dirfd,
|
||||||
+ (int) flags, guest_path, (unsigned int) mask,
|
+ (int) flags, guest_path, (unsigned int) mask,
|
||||||
+ &state.statx_buf))
|
+ &state.statx_buf))
|
||||||
|
|||||||
Reference in new issue
Block a user