From 7f79283bcdc0bb3cd51ecb3dc3220852a5bea500 Mon Sep 17 00:00:00 2001 From: alexytomi <60690056+alexytomi@users.noreply.github.com> Date: Fri, 25 Jul 2025 17:01:00 +0800 Subject: [PATCH] fix(SideDialog): Didn't properly register AndroidPointerCapture --- .../customcontrols/mouse/AndroidPointerCapture.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/mouse/AndroidPointerCapture.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/mouse/AndroidPointerCapture.java index 4e918cb3b..20b336203 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/mouse/AndroidPointerCapture.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/mouse/AndroidPointerCapture.java @@ -1,9 +1,11 @@ package net.kdt.pojavlaunch.customcontrols.mouse; +import static net.kdt.pojavlaunch.prefs.LauncherPreferences.DEFAULT_PREF; import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_MOUSE_GRAB_FORCE; import android.content.SharedPreferences; import android.os.Build; +import android.util.Log; import android.view.InputDevice; import android.view.MotionEvent; import android.view.View; @@ -37,12 +39,13 @@ public class AndroidPointerCapture implements ViewTreeObserver.OnWindowFocusChan this.mHostView = hostView; hostView.setOnCapturedPointerListener(this); hostView.getViewTreeObserver().addOnWindowFocusChangeListener(this); + DEFAULT_PREF.registerOnSharedPreferenceChangeListener(this); if (!PREF_MOUSE_GRAB_FORCE) CallbackBridge.addGrabListener(this); } private void enableTouchpadIfNecessary() { - if(!mTouchpad.getDisplayState() && !Tools.isPointerDeviceConnected()) mTouchpad.enable(true); + if(!mTouchpad.getDisplayState() && PREF_MOUSE_GRAB_FORCE) mTouchpad.enable(true); } // Needed so it releases the cursor when inside game menu @@ -57,7 +60,7 @@ public class AndroidPointerCapture implements ViewTreeObserver.OnWindowFocusChan } private void updateCursorState(boolean isGrabbing) { if (!isGrabbing // Only capture if not in menu and user said so - && !PREF_MOUSE_GRAB_FORCE) { + && !PREF_MOUSE_GRAB_FORCE) { mHostView.releasePointerCapture(); // Release the capture since user said so } // Capture the pointer when not inside a menu @@ -68,6 +71,7 @@ public class AndroidPointerCapture implements ViewTreeObserver.OnWindowFocusChan public void handleAutomaticCapture() { if (!CallbackBridge.isGrabbing() // Only capture if not in menu and user said so && !PREF_MOUSE_GRAB_FORCE) { + mTouchpad.disable(); return; } if (mHostView.hasPointerCapture()) {