alexfacciorusso
10/26/2022, 3:49 PMDialog
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?alexfacciorusso
10/26/2022, 3:57 PM@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,
)
}
czuckie
10/26/2022, 3:57 PMczuckie
10/26/2022, 3:58 PMczuckie
10/26/2022, 3:58 PMalexfacciorusso
10/26/2022, 3:58 PMalexfacciorusso
10/26/2022, 3:59 PMalexfacciorusso
10/26/2022, 4:01 PMczuckie
10/26/2022, 4:01 PMalexfacciorusso
10/26/2022, 4:09 PMChris Sinco [G]
10/26/2022, 6:12 PM