SD mode respect mouse speed preferences

This commit is contained in:
downthecrop 2023-11-01 22:25:57 -07:00
parent 793d2e4ba1
commit aed8217b81
2 changed files with 6 additions and 2 deletions

1
.gitignore vendored
View file

@ -2,6 +2,7 @@
/build /build
/*/build /*/build
app_pojavlauncher/src/main/assets/components/jre app_pojavlauncher/src/main/assets/components/jre
app_pojavlauncher/src/main/assets/components/lwjgl3/version
local.properties local.properties
.idea/ .idea/
.DS_Store .DS_Store

View file

@ -1,6 +1,7 @@
package net.kdt.pojavlaunch; package net.kdt.pojavlaunch;
import static net.kdt.pojavlaunch.MainActivity.fullyExit; import static net.kdt.pojavlaunch.MainActivity.fullyExit;
import static net.kdt.pojavlaunch.Tools.currentDisplayMetrics;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.ClipboardManager; import android.content.ClipboardManager;
@ -101,11 +102,13 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTouc
// interested in events where the touch position changed. // interested in events where the touch position changed.
// int index = event.getActionIndex(); // int index = event.getActionIndex();
int action = event.getActionMasked(); int action = event.getActionMasked();
float mouseSpeed = LauncherPreferences.PREF_MOUSESPEED;
float x = event.getX(); float x = event.getX();
float y = event.getY(); float y = event.getY();
float mouseX, mouseY; float mouseX, mouseY;
// Scale the mouse speed
mouseX = mMousePointerImageView.getX(); mouseX = mMousePointerImageView.getX();
mouseY = mMousePointerImageView.getY(); mouseY = mMousePointerImageView.getY();
@ -117,8 +120,8 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTouc
} }
} else { } else {
if (action == MotionEvent.ACTION_MOVE) { // 2 if (action == MotionEvent.ACTION_MOVE) { // 2
mouseX = Math.max(0, Math.min(CallbackBridge.physicalWidth, mouseX + x - prevX)); mouseX = Math.max(0, Math.min(currentDisplayMetrics.widthPixels, mouseX + (x - prevX) * LauncherPreferences.PREF_MOUSESPEED));
mouseY = Math.max(0, Math.min(CallbackBridge.physicalHeight, mouseY + y - prevY)); mouseY = Math.max(0, Math.min(currentDisplayMetrics.heightPixels, mouseY + (y - prevY) * LauncherPreferences.PREF_MOUSESPEED));
placeMouseAt(mouseX, mouseY); placeMouseAt(mouseX, mouseY);
sendScaledMousePosition(mouseX, mouseY); sendScaledMousePosition(mouseX, mouseY);
} }