diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/mouse/InGUIEventProcessor.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/mouse/InGUIEventProcessor.java index 8e740d7348..16369048a2 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/mouse/InGUIEventProcessor.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/mouse/InGUIEventProcessor.java @@ -29,6 +29,8 @@ public InGUIEventProcessor(float scaleFactor) { @Override public boolean processTouchEvent(MotionEvent motionEvent) { + boolean singleTap = mSingleTapDetector.onTouchEvent(motionEvent); + switch (motionEvent.getActionMasked()) { case MotionEvent.ACTION_DOWN: mTracker.startTracking(motionEvent); @@ -66,13 +68,17 @@ public boolean processTouchEvent(MotionEvent motionEvent) { case MotionEvent.ACTION_UP: mScroller.resetScrollOvershoot(); mTracker.cancelTracking(); + + // Handle single tap on gestures + if((!LauncherPreferences.PREF_DISABLE_GESTURES || touchpadDisplayed()) && !mIsMouseDown && singleTap) { + CallbackBridge.putMouseEventWithCoords(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_LEFT, CallbackBridge.mouseX, CallbackBridge.mouseY); + } + if(mIsMouseDown) disableMouse(); resetGesture(); } - if((!LauncherPreferences.PREF_DISABLE_GESTURES || touchpadDisplayed()) && mSingleTapDetector.onTouchEvent(motionEvent)) { - clickMouse(); - } + return true; } @@ -98,14 +104,9 @@ private void disableMouse() { mIsMouseDown = false; } - private void clickMouse() { - CallbackBridge.sendMouseButton(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_LEFT, true); - CallbackBridge.sendMouseButton(LwjglGlfwKeycode.GLFW_MOUSE_BUTTON_LEFT, false); - } - private void setGestureStart(MotionEvent event) { - mStartX = event.getX(); - mStartY = event.getY(); + mStartX = event.getX() * mScaleFactor; + mStartY = event.getY() * mScaleFactor; } private void resetGesture() { diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/mouse/TapDetector.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/mouse/TapDetector.java index e47d6096b4..1f9c7fd53b 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/mouse/TapDetector.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/mouse/TapDetector.java @@ -20,7 +20,7 @@ public class TapDetector { public final static int DETECTION_METHOD_UP = 0x2; public final static int DETECTION_METHOD_BOTH = 0x3; //Unused for now - private final static int TAP_MIN_DELTA_MS = 10; + private final static int TAP_MIN_DELTA_MS = -1; private final static int TAP_MAX_DELTA_MS = 300; private final static int TAP_SLOP_SQUARE_PX = (int) Tools.dpToPx(2500);