Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.

Commit d23bdb9

Browse files
Fix(gui event processor): remove double clicks, handle all res when tracking still finger, instant clicks (#5635)
1 parent 856bace commit d23bdb9

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public InGUIEventProcessor(float scaleFactor) {
2929

3030
@Override
3131
public boolean processTouchEvent(MotionEvent motionEvent) {
32+
boolean singleTap = mSingleTapDetector.onTouchEvent(motionEvent);
33+
3234
switch (motionEvent.getActionMasked()) {
3335
case MotionEvent.ACTION_DOWN:
3436
mTracker.startTracking(motionEvent);
@@ -66,13 +68,17 @@ public boolean processTouchEvent(MotionEvent motionEvent) {
6668
case MotionEvent.ACTION_UP:
6769
mScroller.resetScrollOvershoot();
6870
mTracker.cancelTracking();
71+
72+
// Handle single tap on gestures
73+
if((!LauncherPreferences.PREF_DISABLE_GESTURES || touchpadDisplayed()) && !mIsMouseDown && singleTap) {
74+
CallbackBridge.putMouseEventWithCoords(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_LEFT, CallbackBridge.mouseX, CallbackBridge.mouseY);
75+
}
76+
6977
if(mIsMouseDown) disableMouse();
7078
resetGesture();
7179
}
7280

73-
if((!LauncherPreferences.PREF_DISABLE_GESTURES || touchpadDisplayed()) && mSingleTapDetector.onTouchEvent(motionEvent)) {
74-
clickMouse();
75-
}
81+
7682
return true;
7783
}
7884

@@ -98,14 +104,9 @@ private void disableMouse() {
98104
mIsMouseDown = false;
99105
}
100106

101-
private void clickMouse() {
102-
CallbackBridge.sendMouseButton(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_LEFT, true);
103-
CallbackBridge.sendMouseButton(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_LEFT, false);
104-
}
105-
106107
private void setGestureStart(MotionEvent event) {
107-
mStartX = event.getX();
108-
mStartY = event.getY();
108+
mStartX = event.getX() * mScaleFactor;
109+
mStartY = event.getY() * mScaleFactor;
109110
}
110111

111112
private void resetGesture() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class TapDetector {
2020
public final static int DETECTION_METHOD_UP = 0x2;
2121
public final static int DETECTION_METHOD_BOTH = 0x3; //Unused for now
2222

23-
private final static int TAP_MIN_DELTA_MS = 10;
23+
private final static int TAP_MIN_DELTA_MS = -1;
2424
private final static int TAP_MAX_DELTA_MS = 300;
2525
private final static int TAP_SLOP_SQUARE_PX = (int) Tools.dpToPx(2500);
2626

0 commit comments

Comments
 (0)