compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

Resizing windows displays black bars

Open rock3r opened this issue 2 years ago • 10 comments

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.

rock3r avatar Mar 27 '23 10:03 rock3r

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

weazyexe avatar Mar 27 '23 14:03 weazyexe

same...

quarrant avatar Sep 06 '23 12:09 quarrant

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

atticus-lv avatar Jan 17 '24 17:01 atticus-lv

same

dudusandi avatar Apr 03 '24 08:04 dudusandi

@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?

babramovitch avatar May 14 '24 16:05 babramovitch

@babramovitch

System.setProperty("skiko.renderApi", "OPENGL")

MatkovIvan avatar May 14 '24 16:05 MatkovIvan

@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()

babramovitch avatar May 14 '24 16:05 babramovitch

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 avatar May 14 '24 16:05 MatkovIvan

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

MatkovIvan avatar May 14 '24 16:05 MatkovIvan

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!

babramovitch avatar May 14 '24 16:05 babramovitch

A note — on desktop you can set the compose.swing.render.on.graphics property to truebefore the ComposePanel is added to the hierarchy! — to use the slower, but not artifact-prone Swing-based compositing. The tradeoff is mainly in CPU usage.

rock3r avatar Jul 23 '24 14:07 rock3r

@MatkovIvan works just fine on win11

DroidLin avatar Jul 27 '24 03:07 DroidLin