Align window chrome with Sway title bars

Adds focused title-bar geometry to the window service and updates the Sway backend to derive frame data more reliably (including parent node fallback and content rect tracking for wrapped/floating views). Window chrome positioning now centers against the actual title bar instead of deco offsets, improving alignment. Also refreshes visual sizing/padding for traffic-light controls and Sway titlebar spacing to match the new chrome metrics.
This commit is contained in:
2026-08-26 22:45:50 +12:00
parent 4321209e92
commit 4d70014242
9 changed files with 100 additions and 33 deletions
+28 -1
View File
@@ -146,6 +146,16 @@ int WindowService::focusedWindowDecoHeight() const
return m_focusedWindowDecoHeight;
}
int WindowService::focusedWindowTitleBarY() const
{
return m_focusedWindowTitleBarY;
}
int WindowService::focusedWindowTitleBarHeight() const
{
return m_focusedWindowTitleBarHeight;
}
bool WindowService::focusWindow(const QString &windowId)
{
return m_backend->focusWindow(parseWindowId(windowId));
@@ -321,6 +331,8 @@ void WindowService::publishFocusedGeometry(const WindowInfo *focused)
int decoY = 0;
int decoWidth = 0;
int decoHeight = 0;
int titleBarY = 0;
int titleBarHeight = 0;
bool fullscreen = false;
if (focused && !focused->minimized) {
@@ -333,6 +345,17 @@ void WindowService::publishFocusedGeometry(const WindowInfo *focused)
decoWidth = focused->decoWidth;
decoHeight = focused->decoHeight;
fullscreen = focused->fullscreen;
titleBarHeight = focused->decoHeight;
if (titleBarHeight <= 0)
titleBarHeight = focused->contentY;
if (titleBarHeight <= 0)
titleBarHeight = 32;
if (focused->decoHeight > 0 || focused->contentY > 0)
titleBarY = focused->y + focused->decoY;
else
titleBarY = focused->y - titleBarHeight;
}
if (m_focusedWindowFullscreen != fullscreen) {
@@ -347,7 +370,9 @@ void WindowService::publishFocusedGeometry(const WindowInfo *focused)
|| m_focusedWindowDecoX != decoX
|| m_focusedWindowDecoY != decoY
|| m_focusedWindowDecoWidth != decoWidth
|| m_focusedWindowDecoHeight != decoHeight) {
|| m_focusedWindowDecoHeight != decoHeight
|| m_focusedWindowTitleBarY != titleBarY
|| m_focusedWindowTitleBarHeight != titleBarHeight) {
m_focusedWindowX = x;
m_focusedWindowY = y;
m_focusedWindowWidth = width;
@@ -356,6 +381,8 @@ void WindowService::publishFocusedGeometry(const WindowInfo *focused)
m_focusedWindowDecoY = decoY;
m_focusedWindowDecoWidth = decoWidth;
m_focusedWindowDecoHeight = decoHeight;
m_focusedWindowTitleBarY = titleBarY;
m_focusedWindowTitleBarHeight = titleBarHeight;
emit focusedWindowGeometryChanged();
}
}