Skip to content

Commit

Permalink
detect eventsource 20482
Browse files Browse the repository at this point in the history
  • Loading branch information
HEAVYPOLY committed Aug 29, 2024
1 parent 8869f1e commit a3ce4f5
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,10 @@ public boolean onTouchEvent(final MotionEvent event) {
}

if (isMouseEvent(event)) {
Log.d("GodotInputHandler", "on Touch Event mouse");
return handleMouseEvent(event);
}

Log.d("GodotInputHandler", "on Touch Event touch");
return handleTouchEvent(event);
}

Expand All @@ -234,10 +235,10 @@ public boolean onGenericMotionEvent(MotionEvent event) {
return true;
}

if (godotGestureHandler.onMotionEvent(event)) {
// The gesture handler has handled the event.
return true;
}
// if (godotGestureHandler.onMotionEvent(event)) {
// // The gesture handler has handled the event.
// return true;
// }

if (event.isFromSource(InputDevice.SOURCE_JOYSTICK) && event.getActionMasked() == MotionEvent.ACTION_MOVE) {
// Check if the device exists
Expand Down Expand Up @@ -455,11 +456,14 @@ private static boolean isMouseEvent(int eventSource) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mouseSource = mouseSource || ((eventSource & InputDevice.SOURCE_MOUSE_RELATIVE) == InputDevice.SOURCE_MOUSE_RELATIVE);
}
if (eventSource == 20482) {
mouseSource = true;
}
return mouseSource;
}

static boolean handleMotionEvent(final MotionEvent event) {
Log.d("GodotInputHandler", "handleMotionEvent " + event.getPressure());
Log.d("GodotInputHandler", "handle Motion Event " + event.getPressure() + " " + isMouseEvent(event));
if (isMouseEvent(event)) {
return handleMouseEvent(event);
}
Expand Down Expand Up @@ -574,6 +578,7 @@ static boolean handleTouchEvent(final MotionEvent event) {
if (pointerCount == 0) {
return true;
}
Log.d("GodotInputHandler", "handleTouchEvent " + pointerCount);

final float[] positions = new float[pointerCount * 3]; // pointerId1, x1, y1, pointerId2, etc...

Expand Down

0 comments on commit a3ce4f5

Please sign in to comment.