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.02k stars 1.1k forks source link

Resizing windows displays black bars #2925

Open rock3r opened 1 year ago

rock3r commented 1 year ago

On desktop, when resizing a window, there can be black bars appearing on the edges of the window when it grows, or can cause the Compose contents of the window to be briefly cut off due to lack of recomposition during the resize.

weazyexe commented 1 year ago

Hi! I faced the same issue :( I opened a conversation in Kotlin slack about it and we found what it's working fine on Linux and macOS without any black edges, it's Windows only issue.

Also, we've found this long-living Swing issue from 2005 and I think they may be related to each other.

Related issue: https://github.com/JetBrains/compose-multiplatform/issues/2475

https://user-images.githubusercontent.com/35996778/227965213-935def8c-7947-43e3-8f0a-ad1dcd4937fa.mp4

quarrant commented 8 months ago

same...

atticus-lv commented 4 months ago

same, any plans to fix it or is there a solution exist?

dudusandi commented 1 month ago

same

babramovitch commented 2 weeks ago

@MatkovIvan When closing #4744 you mentioned that running on windows with OpenGL instead of DirectX was somewhat better with black bars instead of content streching? Is there a way to configure the apps to use OpenGL instead?

MatkovIvan commented 2 weeks ago

@babramovitch

System.setProperty("skiko.renderApi", "OPENGL")
babramovitch commented 2 weeks ago

@MatkovIvan That doesn't seem to make any change for me on Windows 10, does the same resizing instead of black bars calling it first thing in main()

MatkovIvan commented 2 weeks ago

Make sure that you've set it before initialization

fun main() {
    System.setProperty("skiko.renderApi", "OPENGL")
    singleWindowApplication {
        println("RENDER API: ${window.renderApi}")
        Box(Modifier.size(200.dp).background(color = Color.Green)) {}
    }
}
MatkovIvan commented 2 weeks ago

Also, I've prepared a skiko fix that also should make it better - https://github.com/JetBrains/skiko/pull/923

babramovitch commented 2 weeks ago

Ah that was it, I was using fun main() = application { and after was already too late.

Oh awesome about making it better as well, I'll keep an eye on that one. In the meantime using OpenGL looks better than what it was doing.

Thanks!