Fix BaseButton input when enable_long_press_as_right_click is true - #120962
Conversation
|
I'm curious about how some of this works...
How does that work? I see InputEventScreenTouch has a "canceled" property, but I don't see anywhere in base_button where it's actually checked, so I find it hard to believe it handles everything intently and is left in a good state in all cases. Call it a hunch.
That's also curious. If it ignores emulated events, how does it even respond to the emulated right click? Are emulated right-click events not set as DEVICE_ID_EMULATION? I mean I guess that'd be fine as long as it works, it's just unexpected.
If "always" in this context means even when Button Mask = Mouse Right, that sounds like another regression too. Before multitouch support, a button with Mouse Right would not respond to short taps, but would respond to long presses. (worth noting I didn't explicitly verify that, but it's sensible)
Similarly to the above, this is probably not how it would have behaved before multitouch support. |
Code checks for
Yes, right click generated by
Yes, button mask is ignored for touch input. This does sounds like a regression but I'm not sure what we can do here, you know touch have no concept of button mask. |
Ohh that makes sense, I was not aware that is_released is cancel aware. 👍
If I were to make a proposal... In terms of regression minimization, I think treating touch inputs as left mouse events would be simple. That would be intuitive enough, I certainly wouldn't expect a touch input to be able to press a button coded to respond only to right mouse. Alternatively... What about adding "touch" as a potential mask option? That way buttons can be individually set to respond to whatever sorts of inputs the user wants. For example I could set a button to respond to mouse events only (which also works as a compatibility setting) or respond to touch and right mouse, touch and right and left mouse, or any combination. |
m4gr3d
left a comment
There was a problem hiding this comment.
The code change looks good.
I personally like this option, but final call on this would be from |
Gotcha, proposal opened here: |
|
Thanks! |
|
Cherry-picked for 4.7.2. |
Fix `BaseButton` input when `enable_long_press_as_right_click` is true
This PR fixes a touch behavior issue that occurs when
enable_long_press_as_right_clickis enabled.regression from #110893
The following describes the behavior before and after this change. A normal tap always generates a press event.
When
Action Mode = Button ReleaseandButton Mask = Mouse Leftenable_long_press_as_right_clickgenerates aMouse Rightevent instead. Since the button is configured forMouse Left, no action is triggered.When
Action Mode = Button ReleaseandButton Mask = Mouse RightWhen
Action Mode = Button Press, the behavior remains unchanged:Button Mask = Mouse Left: A press action is triggered immediately on touch.Button Mask = Mouse Right: A press action is triggered immediately on touch. If the touch is held long enough to become a long press, an additional press action is triggered for the right-click event.