Closed AlphaBs closed 4 months ago
I did not dive deep to changes but I already can say that kt will break support for other dex devices. Replacing one constant (0x14000000
) with another one (0x10000000
) is not an option.
Not going to be merged in the current state.
okay do we need completely different way to detect gestures? or just hasFlags(e, 0x10000000) || hasFlags(e, 0x14000000)
is enough? (looks like logically same code?)
Again, I did not dive deep to the code. But it will be the first step.
I reverted the constant
Ok, I need to test this on my device and request test from one other guy.
Ok, it works fine on Samsung Galaxy S20 FE (SM-G780F).
Can you please investigate why it does not work with Capture external mouse when possible
?
Sure, but my device behaves very strangely (inversed X/Y axis, can't use any gestures) when I turn that option on, even before the PR code.
AFAIK it should be handled by HardwareMouseListener
. And I am not sure why it inverts X/Y axis, I probably will implement options like External mouse rotation
to сompensate this. But gestures are still unhandled and I do not really have resources to fix this. If you fix it (in another PR) and it will not break existing mice support I will merge it.
I'm just curious, why trackpad need captured pointer? I'm not sure what the expected behavior is.
The "Captured Pointer" feature offers several advantages. Firstly, the navigation and status bars do not appear when the mouse touches the top or bottom edges of the screen. Secondly, Android sends relative mouse events instead of the absolute ones typical in regular mode. This is particularly important in scenarios like 3D games or 3D editors, or in any other situation where an X11 application manipulates the cursor's position, and this behavior needs to be taken into account.
in my device, just removing below code fixes the issue.
TouchInputHandler.java:
// Regular touchpads and Dex touchpad send events as finger too,
// but they should be handled as touchscreens with trackpad mode.
if (mTouchpadHandler != null && (event.getSource() & InputDevice.SOURCE_TOUCHPAD) == InputDevice.SOURCE_TOUCHPAD) {
return mTouchpadHandler.handleTouchEvent(view, view, event);
}
With trackpad mode, all gestures including tap, long tap to drag, two-finger tap, two-finger scroll, even three-finger tap are handled well. With direct touch mode, pinch to zoom and multi touch are available.
but X/Y axis are still ininverted. It looks like Android or my trackpad is reporting the wrong MotionEvent. As you said we might need an option to invert this.
MotionEvent
from my touchpad with captured pointer should be handled by mInputStrategy
and gesture detectors. I don't know why it was handled by mHMListener
. Maybe there was an another touchpad that should be handled by HardwareMouseListener
? I don't have another touchpad I can't test futher.
There is no two-finger drag
feature in the original code. I will not merge it.
Or it is only for the case of Dex? Yeah, it seems like yes.
My device supports two-finger dragging. I can use this gesture in any android app, not just termux-x11.
This gesture is useful when I need to drag a very long distance accurately.
And I was able to achieve this by simply keeping the onTap
state when ACTION_BUTTON_PRESS. (the real event is ACTION_HOVER_EXIT -> ACTION_DOWN -> ACTION_BUTTON_PRESS -> ACTION_MOVE(dragging) -> ACTION_BUTTON_RELEASE -> ACTION_UP
)
Is this a potential backwards compatibility breaker?
I am not really sure about this. Need some check.
Or it is only for the case of Dex? Yeah, it seems like yes.
yes! Is there anything else I need to do before it merges?
Currenly I have to do some checks on real device.
Probably that is safe, but I can not reproduce two-finger drag behaviour.
add some gestures of Samsung Galaxy Tab trackpad (SEC-EFDT970).
tested on Samsung Galaxy Tab S8+ (SM-X800), Android 14, OneUI 6.0
I also recorded
MotionEvent
s when I gesture: