compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

Need to tap the touchpad thrice for double click action when using combined clickable. However, Button clicks are only required to clicked twice.

Open Akhil-Hothi opened this issue 1 year ago • 5 comments

Bug Description I have a device with a touchpad (windows laptop's trackpad) along with two real buttons for left and right mouse click. I noticed that when I tried to implement double click behaviour, I actually need to tap thrice on touchpad. I can perform double click just by clicking twice the hardware buttons, but not the tap gesture on tap pad.

            .combinedClickable(
                onClick = { /* Do nothing */ },
                onDoubleClick = { toggleMaximizeRestore() },
                // Default parameter to not show ripple
                indication = null, // No ripple effect
                interactionSource = remember { MutableInteractionSource() } // Ensures no interaction feedback
            )

Initially I thought that click timing is problem but now I know it's not the time gap, rather It's just that I need to tap thrice instead of twice. In my case, when I tap thrice it works fine.

Affected platforms

  • Desktop (Windows)

Versions

  • Libraries:
    • Compose Multiplatform version: 1.6.0
  • Kotlin version: 1.9.22
  • OS version(s) (required for Desktop and iOS issues): Windows 11 Home
  • OS architecture: 64-bit
  • Device (model or simulator for iOS issues): Asus Tuf Gaming A15 (RTX 3060)
  • JDK (for desktop issues): 18 (java version 17.0.11)

To Reproduce Steps to reproduce the behavior:

  1. Run this code snippet:
    @Composable
    fun BugReproduction() {
         Row(
             modifier = Modifier
                 .shadow(
                     elevation = 12.dp,
                     spotColor = Color(0x40000000),
                     ambientColor = Color(0x40000000)
                 )
                 .fillMaxWidth()
                 .height(32.dp)
                 .background(color = Color(0xFFD0E3FF)) // Static background color
                 .padding(start = 6.dp)
                 .pointerInput(Unit) {
                     detectDragGestures { change, dragAmount ->
                         change.consume() // Consume the gesture event
                         //Do something
    
                     }
                 }
                 .combinedClickable(
                     onClick = { /* Do nothing */ },
                     onDoubleClick = { toggleMaximizeRestore() },
                     // Default parameter to not show ripple
                     indication = null, // No ripple effect
                     interactionSource = remember { MutableInteractionSource() } // Ensures no interaction feedback
                 ),
          )
    }
    fun toggleMaximizeRestore() {
        if (isMaximized) {
            isMaximized = !isMaximized
            window.setSize(screenWidth, adjustedHeight)
            window.setLocation(0, 0)
        } else {
            isMaximized = true
            currentWindowX = startWindowLocX
            currentWindowY = startWindowLocY
            window.setSize((screenWidth / 1.125f).toInt(), (screenWidth * 9 / (16*1.125f).toInt())) // Default size when restoring
            window.setLocation(currentWindowX.value.toInt(), currentWindowY.value.toInt())
        }
    }
    
    
  2. Try double tapping on the light blue color bar, first with touchpad and then with buttons.
  3. Just like step 2, try tapping thrice.

Expected behavior It should be consistent for both, double tapping touchpad and clicking hardware buttons.

Akhil-Hothi avatar May 25 '24 09:05 Akhil-Hothi

Hello, @Akhil-Hothi! Have you tried to run your app on another physical device with a touchpad? And does this issue happen in other apps on your machine as well?

mazunin-v-jb avatar May 27 '24 13:05 mazunin-v-jb

Yes, I have tried it on a different Asus Laptop. Despite the laptop model being different, issue remains same as mentioned earlier in the initial post.

In this laptop model, the touchpad is little different, it doesn't have separate visible buttons/keys from outside but from inside it also has two pressable buttons for left and right click at the bottom part of the touchpad.

Akhil-Hothi avatar May 27 '24 13:05 Akhil-Hothi

@igordmn most likely it's about https://github.com/JetBrains/compose-multiplatform-core/pull/1341

MatkovIvan avatar May 31 '24 07:05 MatkovIvan

@igordmn most likely it's about https://github.com/JetBrains/compose-multiplatform-core/pull/1341

I have investigated this, and this is just about unsuitable ViewConfiguration for touchpad.

I am experimenting with different values with different devices/OS'es now. The Android ported implementation doesn't always suit them.

igordmn avatar May 31 '24 09:05 igordmn

How can I know when the issue is fixed?

Akhil-Hothi avatar Jun 15 '24 19:06 Akhil-Hothi

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

okushnikov avatar Aug 26 '24 13:08 okushnikov