Avoid duplicate Button presses from touch-emulated mouse - #120852
Avoid duplicate Button presses from touch-emulated mouse#120852KurodaKayn wants to merge 2 commits into
Conversation
|
Did you use AI tools to write any part of this code or the description for the PR? If so you need to disclose this, and significant amounts of generated code is not allowed |
Jesus, my bad—the PR title, PR description, and commit message were indeed written by AI. |
|
Please rewrite the PR description, using AI to write it is not permitted as per our guidelines (see this) |
syntaxerror247
left a comment
There was a problem hiding this comment.
The approach doesn't look good to me.
Why are you creating emulated_from_touch when there's already InputEvent::DEVICE_ID_EMULATION?
2e4fdac to
892744c
Compare
I added Goal was: ignore mouse events paired with real touch, but not block other emulated input. Broadly ignoring Your point makes sense though. Extra flag not needed. I updated PR to use |
Wait I don't understand how this doesn't cause a regression now, because it looks like you're just ignoring all emulated mouse events again. Is it not desirable to have user emulated mouse events trigger button presses? Because it looks like you added a test case to verify exactly the opposite of that. |
892744c to
849efbf
Compare
Good catch. I replaced the broad |
Yes, but when you combine it with input event type then it's the same.
I'm not sure why simply returning for DEVICE_ID_EMULATION would cause any issue. Below logic look specific to mouse input so ignoring it for touch shouldn't be an issue. @Nintorch can you clarify here? Edit: opened #120864, I haven't tested if it fixes the issue or not, but double handling of touch/drag event is indeed a problem here. |
Thanks for checking. The early return approach in the draft you opened(#120864) would also skip regular emulated mouse/button events before the mouse/ui_accept logic. That is the behavior covered by the added regression test: a DEVICE_ID_EMULATION mouse button mapped to ui_accept should still be able to press a Button. The marker is only used for mouse events generated from |
Your draft solves this problem and is clearer than mine. However, it makes mouse and ui_accept of So that's why I created emulated_from_touch.
|
|
superseded by #120864 |
Close #120439.
Touch input with mouse emulation enabled can make
BaseButtonhandle both the generated mouse event and the original touch event, causingpressedto emit twice.This marks mouse events generated from touch and makes
BaseButtonignore them, including theui_acceptpath.Regular emulated mouse events still work. Regression tests were added for the duplicate press case and the emulated mouse boundary.