Another question, which I don’t know how other peo...
# compose-desktop
a
Another question, which I don’t know how other people have tackled. The JetBrains Toolbox app has its main UI in what I suppose is a dialog, transparent and undecorated. But still, it has a shadow produced by the system, both in MacOS and Windows. I have a similar setup (I have tried both with a Window and with a Dialog, which I create manually via the
Dialog
factory function with the
create
block, in which I make a
ComposeDialog
with all the settings), but my dialog seems to not being picked up by the system’s shadow creation routine (or whatever it can be called!). I have checked the system’s window sizes and I know for sure JetBrains Toolbox is not creating a fake shadow (e.g. a shadow drawn by Compose) and the shadow is instead system-native, and it also follows very nicely the shape of the transparent dialog. Anyone who knows how to achieve a similar setup?
This is the Composable I use to create the Dialog at the moment:
Copy code
@Composable
fun UndecoratedDialog(
    onWindowGainedFocus: () -> Unit = {},
    onWindowLostFocus: () -> Unit = {},
    content: @Composable (DialogWindowScope.() -> Unit),
) {
    Dialog(
        create = {
            ComposeDialog().apply {
                addWindowFocusListener(object : WindowFocusListener {
                    override fun windowGainedFocus(e: WindowEvent?) {
                        onWindowGainedFocus()
                    }

                    override fun windowLostFocus(e: WindowEvent?) {
                        onWindowLostFocus()
                    }
                })

                isUndecorated = true
                isTransparent = true
                isAlwaysOnTop = true
                isFocusable = true
                type = Window.Type.UTILITY

                setIconImage(null)

                // This is the screen minus all system tray bars etc.
                val screenSize = GraphicsEnvironment.getLocalGraphicsEnvironment().maximumWindowBounds

                size = Dimension((screenSize.width * .5).toInt(), (screenSize.height * .8).toInt())
                location = getWindowLocationForOs(screenSize, size)

                requestFocus()
            }
        },
        dispose = ComposeDialog::dispose,
        content = content,
    )
}
c
Why do you think it's a dialog?
what it looks like on linux fwiw, it also has a shadow, but it's not transparent and decorationless
(screenshot doesn't capture the shadows boo)
a
I guessed, but I have both tried doing the same with a Dialog and with a Window, and it gets treated exactly the same
@czuckie the only reason why on Linux it is not undecorated might be related to some bug in awt for Linux, no idea. On both Windows and Mac it is undecorated and transparent
message has been deleted
c
😞 that sounds about par for the course. Have you seen a shadow on a vanilla window then with your set up?
a
yeah I’ve attached a screenshot (that’s on Mac, but has a very similar look on Windows 11), the shadow seems to be the same it gets created in native windows, and if I inspect the window with something that shows me the boundaries of the window itself, I don’t see a fictitious shadow, as I said, so I can only imagine it’s the system actually drawing it. But yeah my setup looks exactly like that, but without a shadow behind it
c
The toolbox widget container is a native component I think, and not using Compose