From aed8217b813ecdaf145c9146ee00754318e585df Mon Sep 17 00:00:00 2001 From: downthecrop Date: Wed, 1 Nov 2023 22:25:57 -0700 Subject: [PATCH] SD mode respect mouse speed preferences --- .gitignore | 1 + .../java/net/kdt/pojavlaunch/JavaGUILauncherActivity.java | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f5de75c1f0..3303a20bbe 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /build /*/build app_pojavlauncher/src/main/assets/components/jre +app_pojavlauncher/src/main/assets/components/lwjgl3/version local.properties .idea/ .DS_Store diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JavaGUILauncherActivity.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JavaGUILauncherActivity.java index bba467323d..00408dc406 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JavaGUILauncherActivity.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/JavaGUILauncherActivity.java @@ -1,6 +1,7 @@ package net.kdt.pojavlaunch; import static net.kdt.pojavlaunch.MainActivity.fullyExit; +import static net.kdt.pojavlaunch.Tools.currentDisplayMetrics; import android.annotation.SuppressLint; import android.content.ClipboardManager; @@ -101,11 +102,13 @@ public boolean onTouch(View v, MotionEvent event) { // interested in events where the touch position changed. // int index = event.getActionIndex(); int action = event.getActionMasked(); + float mouseSpeed = LauncherPreferences.PREF_MOUSESPEED; float x = event.getX(); float y = event.getY(); float mouseX, mouseY; + // Scale the mouse speed mouseX = mMousePointerImageView.getX(); mouseY = mMousePointerImageView.getY(); @@ -117,8 +120,8 @@ public boolean onTouch(View v, MotionEvent event) { } } else { if (action == MotionEvent.ACTION_MOVE) { // 2 - mouseX = Math.max(0, Math.min(CallbackBridge.physicalWidth, mouseX + x - prevX)); - mouseY = Math.max(0, Math.min(CallbackBridge.physicalHeight, mouseY + y - prevY)); + mouseX = Math.max(0, Math.min(currentDisplayMetrics.widthPixels, mouseX + (x - prevX) * LauncherPreferences.PREF_MOUSESPEED)); + mouseY = Math.max(0, Math.min(currentDisplayMetrics.heightPixels, mouseY + (y - prevY) * LauncherPreferences.PREF_MOUSESPEED)); placeMouseAt(mouseX, mouseY); sendScaledMousePosition(mouseX, mouseY); }