```.pointerInput(Unit) { ...
# compose
e
Copy code
.pointerInput(Unit) {
                                detectTapGestures(matcher = PointerMatcher.mouse(PointerButton.Secondary)) {
                                    pointerInput = DpOffset(it.x.dp, it.y.dp)
                                    showContextMenu = true
                                }
                            }
Anyone know why this code works AOK on desktop but then decides to not exist on android?
Copy code
import androidx.compose.foundation.PointerMatcher
^^ this is the perfectly legitimate import that it fails on. If this is not supposed to fail like this, then why is it failing If this is expected, then the least that could be done here is making it red or something similar so I dont have to wait until I test my code on my device to figure out a refactor is necessary
a
Because some non-android APIs are visible in commonMain by mistake. See https://github.com/JetBrains/compose-multiplatform/issues/3503
You have to write expect/actual if you want to use it
e
So it is possible to detect mouse input on android. Why is this not a feature in compose? Ideally since its multiplatform it should be able to do things like this Also 🤢 I have to go through and do more work because of the refactor
a
You can do something like this. It should be available everywhere
Copy code
Modifier.pointerInput(0) {
        awaitEachGesture {
            val event = awaitPointerEvent()

            if (event.type == PointerEventType.Press && event.buttons.isSecondaryPressed) {
                waitForUpOrCancellation()

                println("secondary pressed at ${event.changes.first().position}")
            }
        }
    }
e
@Alexander Zhirkevich thank you so much, your code worked perfectly once I added my logic