From 668842124067f9b6513edf1c28478bec12d709a0 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Fri, 3 Feb 2023 21:09:11 +0000 Subject: [PATCH] minor adjustments to xwayland positioning --- src/layout/IHyprLayout.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp index 1cddcdaa..23a10a26 100644 --- a/src/layout/IHyprLayout.cpp +++ b/src/layout/IHyprLayout.cpp @@ -63,8 +63,17 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) { pWindow->m_vRealSize = PMONITOR->vecSize / 2.f; } - pWindow->m_vRealPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_vRealSize.goalv().x) / 2.f, - PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_vRealSize.goalv().y) / 2.f); + if (pWindow->m_bIsX11 && pWindow->m_uSurface.xwayland->override_redirect) { + + if (pWindow->m_uSurface.xwayland->x != 0 && pWindow->m_uSurface.xwayland->y != 0) + pWindow->m_vRealPosition = Vector2D{pWindow->m_uSurface.xwayland->x, pWindow->m_uSurface.xwayland->y}; + else + pWindow->m_vRealPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_vRealSize.goalv().x) / 2.f, + PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_vRealSize.goalv().y) / 2.f); + } else { + pWindow->m_vRealPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_vRealSize.goalv().x) / 2.f, + PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_vRealSize.goalv().y) / 2.f); + } } else { // we respect the size. pWindow->m_vRealSize = Vector2D(desiredGeometry.width, desiredGeometry.height); @@ -108,7 +117,7 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) { } } - if (pWindow->m_bX11DoesntWantBorders) { + if (pWindow->m_bX11DoesntWantBorders || (pWindow->m_bIsX11 && pWindow->m_uSurface.xwayland->override_redirect)) { pWindow->m_vRealPosition.setValue(pWindow->m_vRealPosition.goalv()); pWindow->m_vRealSize.setValue(pWindow->m_vRealSize.goalv()); }