mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-23 08:46:40 +00:00
Send the touchpad button on the gamepad even when using the touchpad for mouse control
This commit is contained in:
@@ -1482,11 +1482,6 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bail if the user wants gamepad touchpads to control the mouse
|
|
||||||
if (prefConfig.gamepadTouchpadAsMouse) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only get a context if one already exists. We want to ensure we don't report non-gamepads.
|
// Only get a context if one already exists. We want to ensure we don't report non-gamepads.
|
||||||
InputDeviceContext context = inputDeviceContexts.get(event.getDeviceId());
|
InputDeviceContext context = inputDeviceContexts.get(event.getDeviceId());
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
@@ -1522,7 +1517,7 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && event.getActionButton() == MotionEvent.BUTTON_PRIMARY) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && event.getActionButton() == MotionEvent.BUTTON_PRIMARY) {
|
||||||
context.inputMap |= ControllerPacket.TOUCHPAD_FLAG;
|
context.inputMap |= ControllerPacket.TOUCHPAD_FLAG;
|
||||||
sendControllerInputPacket(context);
|
sendControllerInputPacket(context);
|
||||||
return true;
|
return !prefConfig.gamepadTouchpadAsMouse; // Report as unhandled event to trigger mouse handling
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -1530,7 +1525,7 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && event.getActionButton() == MotionEvent.BUTTON_PRIMARY) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && event.getActionButton() == MotionEvent.BUTTON_PRIMARY) {
|
||||||
context.inputMap &= ~ControllerPacket.TOUCHPAD_FLAG;
|
context.inputMap &= ~ControllerPacket.TOUCHPAD_FLAG;
|
||||||
sendControllerInputPacket(context);
|
sendControllerInputPacket(context);
|
||||||
return true;
|
return !prefConfig.gamepadTouchpadAsMouse; // Report as unhandled event to trigger mouse handling
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -1538,6 +1533,15 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bail if the user wants gamepad touchpads to control the mouse
|
||||||
|
//
|
||||||
|
// NB: We do this after processing ACTION_BUTTON_PRESS and ACTION_BUTTON_RELEASE
|
||||||
|
// because we want to still send the touchpad button via the gamepad even when
|
||||||
|
// configured to use the touchpad for mouse control.
|
||||||
|
if (prefConfig.gamepadTouchpadAsMouse) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// If we don't have X and Y ranges, we can't process this event
|
// If we don't have X and Y ranges, we can't process this event
|
||||||
if (context.touchpadXRange == null || context.touchpadYRange == null) {
|
if (context.touchpadXRange == null || context.touchpadYRange == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user