-
-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dex touchpad fix: orientation, click, gesture, etc. #617
Conversation
6fbd8c8
to
1a94082
Compare
Force pushed fix to crash in "Automatic (for touchpad)" mode mentioned in #419. |
@twaik perhaps we should rehthink the gesture, though I do not have a concrete idea in mind. After some time testing this PR with soft touchpad in DeX, I found that there are not enough gesture/button to accomplish all four features below.
|
The touchpad handling code is created for both Dex and real touchpad cases. And there may be physical touchpad, mice and touchpad connected to the same device at the same time. That is a reason I am invoking the code handling touchpads and Dex in separate TouchInputHandler instance with forced trackpad mode. mInputStrategy overriding will break this case. |
I am indeed well aware of the fact that touchpad + mouse should be fine, but in touchpad + mouse + touchscreen (in DeX) or perhaps simply touchscreen in DeX, the touchscreen mode would be completely overridden. Besides, I am not sure how touchscreen can behave under onscreen DeX mode (as a touchpad? or mouse? does Termux:X11 touchscreen mode work?) which is only available to Tablet user and I don't own one. It is just that
So it will require some more changes to your code base (probably a real It's up to you. Want me to implement it (though not any time soon) or you change it directly? Or is it still acceptable as is? |
Ok, probably it is a good time to make a rebase.
In the case if you detect event came from touchpad you should redirect it to mTouchpadHandler immediately (in TouchInputHandler::onTouch). About
I still think it is a good idea to use About
I still think it is a good idea to move it out from switch. There are some weird firmwares with custom actions hardcoded. Sending event will not be triggered in the case if button state is not changed so it should be safe. Also be aware of new preferences making possible to configure three-finger swipes, back button, volume keys actions. Also there is new option to toggle soft keyboard from additional keyboard bar (enabled by default) so the changes overriding default actions in dex mode should be removed. |
Rebased and addressed all your comments.
Sounds smart and requires minimal changes. I frontload the
Thanks. While
I moved it out of the switch statement. See if you may want to invite other users to conduct a final UAT cuz I don't own a tablet.
I am fine with new preferences and now this PR leaves the three-finger swipe gestures untouched. Cuz I found that under DeX soft touchpad mode, I can escape the pointer capture by swipe up at the bottom of phone screen. That will bring up the bottom "navigation gesture bar" (not sure the correct name) and escape pointer capture. Nonetheless, it assumes new Termux:X11 user to know such trick, and perhaps some first time user would be panic and ends up unplugging the HDMI cable to escape. Well... perhaps this app has already made quite some assumptions about new users when we don't have a starter guide LOL. For example, I discovered preferences page can be triggered from notification bar after few weeks of use, or perhaps I am stupid haha. |
By the way,
|
Not stupid. I have some troubles with writing user manuals.
I already checked it when tried to fix touchpad by myself. It breaks touchpads on other devices.
I think it will be enough to change the summary of preference when it changes. I'll do that a bit later. |
Probably polling for display rotation with |
I tested this build on Galaxy Tab S8+ bookcover keyboard, with trackpad, capturing external pointer, and automatic point movements mode. Touch gestures (tap, two-finger tap to right click, two-finger scroll, click buttons, long tap to drag, tap-to-move), scroll axis, pointer movement axis, pointer speed are all normal and work perfectly. Thanks for a great job! |
@twaik just pushed a commit to update rotation using |
In short, it should fix #419. The suggested changes should have no impact on existing functionality. If you need to review the code changes and features added, I hope below explanation helps and won't be too long.
Root Causes of #419
mTouchpadHandler.handleTouchEvent()
will handle pointer inputs as hardware mouse, callingmHMListener.onTouch
because of the "if condition" (|| (event.getPointerCount() == 1 && mTouchpadHandler == null && (event.getSource() & InputDevice.SOURCE_TOUCHPAD) == InputDevice.SOURCE_TOUCHPAD)
) being positive.My solution
TrackpadInputStrategy
. Note that we could not simply create another variable to be invoked because the code logics testmInputStrategy
at multiple places. I found it easiest to just overridemInputStrategy
in DeX (SamsungDexUtils.checkDeXEnabled(mContext)
). This makes sense because (1) finger input in DeX can only be touchpad not touchscreen, and (2) mouse input handler in DeX is also overrided.ID 1 (primary display I believe)will be checked and motion input will be handled accordingly. Hopefully this could handle both Pad and DeX touchpad issue.