-
Notifications
You must be signed in to change notification settings - Fork 39
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
Prevent phantom clicks when scrolling, clicks when right clicking #69
Conversation
@blankmac any insight on the questions I've added as comments on the PR? Thank you! |
I think you're finding out that making what amounts to a mouse or touchpad input behave like you'd expect a touchscreen to behave is a complicated thing! Unfortunately, I no longer have any hackintosh hardware with a touchscreen. With Apple moving towards their own CPUs I bit the bullet and purchased an M1 based laptop when they came out. I have a friend that still has an HP Elite X2 tho, which is what I originally used to write the touchscreen routines, and will get it from him in a few days and try your revisions. It's been so long since I've dug into this code that there are most certainly redundant portions and errors. It definitely needs an update! Regarding the for loop and the "+1", IIRC that has to do with the transducer ordering. The stylus always comes first but I believe the catch was that it wouldn't appear in the transducers as a contact event until you had actually used it once. You might try using a stylus first and then seeing if your single touch / multi touch input behaves as expected. It's unfortunate that so much complexity has to be added for such a simple thing as double clicking. Through 10.11, double clicking worked just fine and as expected. There's an area property in the HID device that I believe is the root of the problem but I was never successful at widening the area to allow for slightly different locations when executing a double click. Anyway, I should be able to go through your revisions in a couple days. But don't let that stop you if you get it figured out prior to that. Thanks for working on it! |
@blankmac thanks for the insight! I've purchased a Microsoft Surface Pen so I can test stylus interactions. I'll check and see if that |
@lazd Do you any assistance with getting this PR completed? |
@kprinssu actually yeah, I can't get my Surface Go 2's touchscreen to react to a pen in macOS, so there's no way for me to test if pen support is still behaving as expected. I believe that's the only question that remains, the other two items under If touch works, this could be merged. |
Thanks @lazd, I'll take a look sometime this week and will add my comments to this PR. |
@kprinssu I'd say go ahead and get this in for the 2.9 release, this fixes some behavior from my previous PRs. Let's see what users say, and if we broke pens I can fix it. Thank you! |
Thanks @lazd |
Was too busy to debug my tablet recently. I tried the latest master and the touchscreen started to behave like a big touchpad. Single touch won't move the cursor to finger as usual, and swiping translates to relative movement of the cursor. The first commit in this PR started to cause the issue but I didn't dig into the code further. |
Interesting, I'm running this on my Surface Go 2 and the touchscreen works great. It sounds like the driver isn't even being loaded for your touchscreen since it's being treated like a trackpad, perhaps there is a configuration error? |
Was able to dig into the code flow a bit, thanks to the cloudy weather today that blocks the ring of fire :( |
This PR corrects some issues introduced by #67 and #69 where phantom clicks were happening when scrolling and before right clicking.
The fix is twofold:
Because of how this works,
click_tick
is no longer necessary and we're guaranteed to get several hovers before a click or drag happens.Because drags are delayed, we have to be careful about where we start them, so we use the start location of the touch interaction, which seems to work well.
Todo
for
loop from single touch interactionsQuestions about past code that was modified
transducer->tip_switch.value()
for finger touches or ifLEFT_CLICK
is finefor
loop for transducers if there was always onefor
loop went tocount + 1
false
forMULTITOUCH_TIMEOUT
is a problem