Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application doesn't respond to touch events in split window mode on iPad #3100

Closed
etolstoy opened this issue Apr 24, 2023 · 4 comments · Fixed by JetBrains/compose-multiplatform-core#678
Labels
bug Something isn't working input Touch, mouse, keyboard input related ios

Comments

@etolstoy
Copy link
Contributor

Describe the bug
When the application is being run in a split view mode in iPad, it responds to touches only when being launched in the left pane. When it's dragged to the right pane, it stops responding. Though if a physical keyboard is connected, it doesn't loose focus and you can continue typing.

IMG_0034.MOV

Affected platforms

  • iOS (iPad only)

Versions

  • Kotlin version*: 1.8.20
  • Compose Multiplatform version*: 1.4.0
  • OS version(s)* (required for Desktop and iOS issues): iPadOS 16.1.1

To Reproduce

  1. Launch the Compose app.
  2. Run it in a split view with another app.
  3. Drag Compose app to the right pane.
@etolstoy etolstoy added bug Something isn't working submitted labels Apr 24, 2023
@paxbun
Copy link
Contributor

paxbun commented Jul 14, 2023

Same thing happens when the app is launched in full-screen mode and then switched into a slide over window.

@MatkovIvan MatkovIvan added ios input Touch, mouse, keyboard input related and removed submitted labels Jul 14, 2023
@paxbun
Copy link
Contributor

paxbun commented Jul 14, 2023

It seems like Compose always assumes that the window is at (0, 0). The left split view works well and on the left slide over mode, the buttons that are slightly off from the touch position are pressed.

@paxbun
Copy link
Contributor

paxbun commented Jul 15, 2023

Would this line be the culprit? I think it should be touch.locationInView(this), not null.
https://github.com/JetBrains/skiko/blob/39fb88f6a22bdd20f1cd82e3719b005885ca3648/skiko/src/iosMain/kotlin/org/jetbrains/skiko/SkikoUIView.kt#L228

It seems not. I edited SkikoUIView.kt as follows, but the results of touch.locationInView(this) and touch.locationInView(null) are the same. In addition, Skiko is reporting the coordinates correctly.

    private fun sendTouchEventToSkikoView(event: UIEvent, kind: SkikoPointerEventKind) {
        val pointers = event.touchesForView(this).orEmpty().map {
            val touch = it as UITouch
            val (x, y) = touch.locationInView(null).useContents { x to y }
            val (viewRelativeX, viewRelativeY) = touch.locationInView(this).useContents { x to y }
            println("Skiko: Touch Event at ($x, $y), relative = ($viewRelativeX, $viewRelativeY)")

image

@okushnikov
Copy link

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

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working input Touch, mouse, keyboard input related ios
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants