From df7b9373613835de90034302512f3821f0df3bae Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Fri, 17 Jul 2026 12:59:26 -0400
Subject: [PATCH] android: Fix pen creating phantom mouse events in relative
mode.
This mostly just unifies code that was handling this case elsewhere already.
Fixes #15620.
---
.../main/java/org/libsdl/app/SDLSurface.java | 40 +------------------
1 file changed, 1 insertion(+), 39 deletions(-)
diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java b/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java
index 5cba07912c02b..6841ed10aaacf 100644
--- a/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java
+++ b/android-project/app/src/main/java/org/libsdl/app/SDLSurface.java
@@ -396,45 +396,7 @@ public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) {
@Override
public boolean onCapturedPointerEvent(MotionEvent event)
{
- int action = event.getActionMasked();
- int pointerCount = event.getPointerCount();
-
- for (int i = 0; i < pointerCount; i++) {
- float x, y;
- switch (action) {
- case MotionEvent.ACTION_SCROLL:
- x = event.getAxisValue(MotionEvent.AXIS_HSCROLL, i);
- y = event.getAxisValue(MotionEvent.AXIS_VSCROLL, i);
- SDLActivity.onNativeMouse(0, action, x, y, false);
- return true;
-
- case MotionEvent.ACTION_HOVER_MOVE:
- case MotionEvent.ACTION_MOVE:
- x = event.getX(i);
- y = event.getY(i);
- SDLActivity.onNativeMouse(0, action, x, y, true);
- return true;
-
- case MotionEvent.ACTION_BUTTON_PRESS:
- case MotionEvent.ACTION_BUTTON_RELEASE:
-
- // Change our action value to what SDL's code expects.
- if (action == MotionEvent.ACTION_BUTTON_PRESS) {
- action = MotionEvent.ACTION_DOWN;
- } else { /* MotionEvent.ACTION_BUTTON_RELEASE */
- action = MotionEvent.ACTION_UP;
- }
-
- x = event.getX(i);
- y = event.getY(i);
- int button = event.getButtonState();
-
- SDLActivity.onNativeMouse(button, action, x, y, true);
- return true;
- }
- }
-
- return false;
+ return SDLActivity.getMotionListener().onGenericMotion(this, event);
}
@Override