Skip to content

Commit fbf71f4

Browse files
committed
fix(Pointer/Capture): Make non-opportunistic grabbing opt-in
Adds a new config option whether or not you want your mouse to be able to click your touch controls! Default is you can! Should also now let DeX users get their cursor out of the window by just moving it by default. This reverts commit 7631e3c.
1 parent 9c15bba commit fbf71f4

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/mouse/AndroidPointerCapture.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ private void enableTouchpadIfNecessary() {
3939
}
4040

4141
public void handleAutomaticCapture() {
42+
if (LauncherPreferences.DEFAULT_PREF.getBoolean("always_grab_mouse", false)) {
43+
if (!CallbackBridge.isGrabbing()) return;
44+
if (mHostView.hasPointerCapture()) {
45+
enableTouchpadIfNecessary();
46+
return;
47+
}
48+
}
4249
if(!mHostView.hasWindowFocus()) {
4350
mHostView.requestFocus();
4451
} else {

app_pojavlauncher/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,4 +469,6 @@
469469
<string name="preference_force_enable_touchcontroller_description">Force enable TouchController integration, even if mod file is not found.</string>
470470
<string name="preference_touchcontroller_vibrate_length_title">TouchController vibrate length</string>
471471
<string name="preference_touchcontroller_vibrate_length_description">Set the length of the vibration when using TouchController.</string>
472+
<string name="mcl_setting_title_grab_mouse">Force mouse grabbing</string>
473+
<string name="mcl_setting_subtitle_grab_mouse">Forcefully grabs the mouse to ensure it stays inside the game window. Prevents mouse from clicking touch control layout.</string>
472474
</resources>

app_pojavlauncher/src/main/res/xml/pref_control.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@
9797
android:title="@string/preference_mouse_start_title"
9898
android:summary="@string/preference_mouse_start_description"
9999
/>
100+
<SwitchPreference
101+
android:key="always_grab_mouse"
102+
android:title="@string/mcl_setting_title_grab_mouse"
103+
android:summary="@string/mcl_setting_subtitle_grab_mouse"
104+
android:defaultValue="false"/>
100105
</PreferenceCategory>
101106

102107
<PreferenceCategory

0 commit comments

Comments
 (0)