JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.94k stars 1.16k forks source link

`Modifier.pointerIcon` implementation conflicts with manual setting cursor via `ComposeWindow.cursor` #997

Open igordmn opened 3 years ago

igordmn commented 3 years ago

Compose 1.0.0-alpha2.

After we implemented Modifier.pointerIcon, we lost ability to override cursor with the help of Swing:

import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.window.singleWindowApplication
import java.awt.Cursor

fun main() = singleWindowApplication {
    LaunchedEffect(Unit) {
        window.cursor = Cursor(Cursor.CROSSHAIR_CURSOR)
    }
}

Because of this we don't have resizable cursor with Window(undecorated=true, resizable=true, ...) and in SplitPane component.

The second one fixes trivially (using Modifier.pointerIcon), but I was not able to fix the first one. because we don't use Composable functions there.

We should figure out how can we fix this - either we don't support Swing interop for cursor changing, or implement Modifier.pointerIcon differently

okushnikov commented 3 weeks ago

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