slint icon indicating copy to clipboard operation
slint copied to clipboard

Android: double-clicked callback not work on TouchArea

Open heng30 opened this issue 1 year ago • 2 comments

  • platform: Android
  • Android target sdk version: 32
  • language: Rust
  • slint version: v1.5.1
  • style: material
  • code snippets
    TouchArea {
        moved => {
            debug("move ok");
        }

        pointer-event(evt) => {
            debug("pointer-event ok");
        }

        clicked => {
            debug("clicked ok");
        }

        double-clicked => {
            debug("double-clicked not work");
        }
    }

heng30 avatar Apr 28 '24 05:04 heng30

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.

ogoffart avatar Apr 29 '24 13:04 ogoffart

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.

tronical avatar Apr 29 '24 13:04 tronical