From f4670d8df384650b011635ea4e512b233571fdf1 Mon Sep 17 00:00:00 2001 From: Xtr126 <80520774+Xtr126@users.noreply.github.com> Date: Sat, 5 Oct 2024 09:14:08 +0530 Subject: [PATCH] Add WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR to fix cursor position on small screen devices --- app/src/main/java/xtr/keymapper/TouchPointer.java | 1 + app/src/main/java/xtr/keymapper/server/RemoteService.java | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/xtr/keymapper/TouchPointer.java b/app/src/main/java/xtr/keymapper/TouchPointer.java index 09713d5f..0e3383e4 100644 --- a/app/src/main/java/xtr/keymapper/TouchPointer.java +++ b/app/src/main/java/xtr/keymapper/TouchPointer.java @@ -236,6 +236,7 @@ public void enablePointer() { WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | + WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, // Make the underlying application window visible // through the cursor diff --git a/app/src/main/java/xtr/keymapper/server/RemoteService.java b/app/src/main/java/xtr/keymapper/server/RemoteService.java index 24ad839c..ce305564 100644 --- a/app/src/main/java/xtr/keymapper/server/RemoteService.java +++ b/app/src/main/java/xtr/keymapper/server/RemoteService.java @@ -125,7 +125,7 @@ private void addCursorView() { PixelFormat.TRANSLUCENT); try { windowManager.addView(cursorView, params); - } catch (IllegalStateException e) { + } catch (IllegalStateException e) { // A14 QPR3 https://gist.github.com/RikkaW/be3fe4178903702c54ec73b2fc1187fe Log.e(TAG, e.getMessage(), e); cursorView = null; } @@ -147,6 +147,9 @@ public static void loadLibraries() { System.loadLibrary("touchpad_relative"); } + /** + * Executes getevent command and processes the output + */ void start_getevent() { new Thread(() -> { try {