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.28k stars 1.11k forks source link

[CfD, Linux] Surface size changes immediately after lunch #2585

Open arkivanov opened 1 year ago

arkivanov commented 1 year ago

The following code:

    application {
        Window(onCloseRequest = ::exitApplication) {
            Surface(modifier = Modifier.fillMaxSize().onSizeChanged { println(it) }) {
                MaterialTheme {
                    Text("Hello")
                }
            }
        }
    }

Produces the following output:

1592 x 1172
1600 x 1114

This causes undesired animations immediately after the app lunch, e.g. in the case when BoxWithConstraints is used and the animation relies on constraints. It would be good to have the size calculated properly in the very beginning.

Compose: 1.2.0 and 1.3.0-rc01 Kotlin: 1.7.20 OS: Ubuntu 22.04.1

dima-avdeev-jb commented 1 year ago

Compose 1.1.1 has the same bug.

Also, reproduce here: https://github.com/dima-avdeev-jb/reproduce-linux-resize-bug