Skip to content

Commit 2d8ca50

Browse files
committed
Fix Linux popup z-order inset drift (CSD title bar)
The custom CSD title bar is drawn inside the same Compose scene as the content (not as external inset), so platform inset reporting distorts popup positioning. Setting topInsetPx=0 prevents Compose's RootMeasurePolicy from shifting popups downward. Popups naturally layer above the title bar via ComposeSceneLayer z-order.
1 parent b4d7586 commit 2d8ca50

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

decorated-window-tao/src/main/kotlin/dev/nucleusframework/window/tao/render/TaoComposeSceneHostLinux.kt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,23 @@ internal class TaoComposeSceneHostLinux(
278278
platformContext =
279279
LinuxTaoPlatformContext(
280280
windowHandle = window.handle,
281-
topInsetPx = { (titleBarHeightDpState.value * scale).toInt() },
281+
// The custom CSD title bar is drawn inside the same Compose
282+
// scene as the rest of the content, so it shares the (0, 0)
283+
// origin with everything else. We must NOT report it as a
284+
// `PlatformInsets.top`: Compose's `RootMeasurePolicy` (cf.
285+
// `RootMeasurePolicy.skiko.kt::positionWithInsets`) applies
286+
// platform insets as an *additive offset* on the popup
287+
// position (designed for iOS notches / Android status
288+
// bars, where the safe area is outside the Compose surface).
289+
// Reporting `top = titleBarHeight` here shifts every Popup,
290+
// DropdownMenu, ContextMenu, and Tooltip down by that
291+
// amount — visible as a consistent "title-bar-height
292+
// downward drift" of every popup the user opens. Popups
293+
// are free to overlap the title bar zone; the title bar
294+
// composable's own z-order keeps it visually on top of
295+
// the page content but popups (rendered in a higher
296+
// ComposeSceneLayer) naturally float above both.
297+
topInsetPx = { 0 },
282298
windowInfo = windowInfo,
283299
semanticsOwnerListener = semanticsOwnerListener,
284300
dragAndDropManager = dndManager,

0 commit comments

Comments
 (0)