A question for <@U015TKX93PD>. I'm using a `OnGlob...
# compose-desktop
k
A question for @Igor Demin. I'm using a
OnGloballyPositionedModifier
to determine the position of this combobox so that I can place the popup / dropdown window accordingly. But in this mode where the window decorations come from the system, both
coordinates.localToRoot(Offset.Zero)
and
coordinates.localToWindow(Offset.Zero)
give me the same value of
Offset(110.0, 99.0)
. Shouldn't
localToWindow
account for the height of the title bar?
Full code without any Aurora parts
Copy code
private class MyLocator :
    OnGloballyPositionedModifier {
    override fun onGloballyPositioned(coordinates: LayoutCoordinates) {
        println("local to root ${coordinates.localToRoot(Offset.Zero)}")
        println("local to window ${coordinates.localToWindow(Offset.Zero)}")
    }
}

@Composable
private fun Modifier.myLocator() = this.then(
    MyLocator()
)

fun main() = application {
    val state = rememberWindowState(
        placement = WindowPlacement.Floating,
        position = WindowPosition.Aligned(Alignment.Center),
        size = DpSize(220.dp, 150.dp)
    )

    Window(
        title = "Aurora Demo",
        state = state,
        undecorated = false,
        onCloseRequest = ::exitApplication
    ) {
        Row(
            modifier = Modifier.fillMaxSize(),
            horizontalArrangement = Arrangement.Center,
            verticalAlignment = Alignment.CenterVertically,
        ) {
            Box(modifier = Modifier.size(50.dp).background(Color.Red).myLocator())
        }
    }
}
o
@Kirill Grouchnikov Igor is on vacations, so unlikely could answer
k
Ah well, I'd go for an answer from somebody else then 🙂
In the meanwhile my fix for popup placement in Aurora in undecorated vs decorated mode is to look at
ComposeWindow.getRootPane().getLocationOnScreen()
instead of
ComposeWindow.getLocationOnScreen()
i
If it is still relevant, I can investigate this.