kirill-grouchnikov / aurora

Building modern, elegant and fast desktop Compose applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Window] Performance of undecorated windows is unbearable

mipastgt opened this issue · comments

When I run the AuroraDemo.kt as is, the window is undecorated (self-decorated and not the typical mac style) When I then resize the window the whole content jumps up and down and is very jerky which, to my opinion, is simply unbearable. But when I go to the main method and just set the AuroraWindow argument undecorated = false, then this does not happen anymore and the performance is ok.
This is on a Mac mini 10.15.7 with OpenJDK 17.

This is indeed a painful one. Compose Desktop windows are Swing windows, and that's not something that I can change in Aurora. Resizing undecorated Swing windows has always been bad, pretty much since the beginning, and I don't know of any way to make it as smooth as natively decorated windows.

If you check https://github.com/kirill-grouchnikov/radiance and run the main demo in org.pushingpixels.radiance.demo.theming.main.Check, it exhibits most of the same janky behavior that you see right now in Aurora - also under core Swing look-and-feels that support undecorated windows like Metal. As you resize the window, there's a noticeable lag of a few frames where the window content is "trying" to catch up to the new size.

The one thing that is different in Aurora is the vertical resizing behavior where the content of the title pane indeed is jumping up and down quite noticeably. As far as the layout of the window content, it's a simple Column (see the code), but now that I think of it, it should be a Box instead that gives however much vertical space needed to the title pane, and the rest (with weight probably) to the app content. I'm going to play with that layout a little bit and see if it improves things a bit.

Unfortunately, at least at the moment, there is nothing "canonical" I can compare Aurora to. The base distribution of Compose Desktop does not come with a reference implementation of undecorated windows. They do provide the WindowDraggableArea composable to implement a custom window title pane, but nothing that would show how to a complete custom undecorated window that can be not only moved around, but also resized from sides and corners.

Even removing all the Aurora pieces around the layout of the title pane, the menu bar and the main content, resizing an undecorated window vertically is pretty janky. I'm going to file a bug on compose-jb with a small reproducer. I don't think this is something I can address in Aurora, unless there's some fundamental issue with the resizing logic in https://github.com/kirill-grouchnikov/aurora/blob/icicle/window/src/desktopMain/kotlin/org/pushingpixels/aurora/window/WindowAWTHandler.kt