slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.55k stars 601 forks source link

Android: double-clicked callback not work on TouchArea #5142

Open heng30 opened 6 months ago

heng30 commented 6 months ago
ogoffart commented 6 months ago

Thanks for reporting an issue.

The problem is that we send a MouseExit event on finger release, which cause the double click state to be reset.

https://github.com/slint-ui/slint/blob/6e7353cf1182712b53a7ed5de3b004ad5507911f/internal/backends/android-activity/androidwindowadapter.rs#L326-L327

(I've actually done the same on some MCU platform)

I think we have the following options:

  1. Don't send MouseExit on release in the android backend.
  2. Somehow not resetting the click_count on MouseExit. We have other mechanisms to find out it was done on the same item anyway.
  3. Have specific events for touch that wouldn't set the has_hover anyway without exit. But that's a bigger change.
tronical commented 6 months ago

Don't send MouseExit on release in the android backend.

Perhaps that could be done with a delay? So that there's still a chance of doing a double tap.