xwayland: handle window coords correctly (#9238)

This commit is contained in:
nyx
2025-01-30 16:36:42 -05:00
committed by Vaxry
parent 75dff7205f
commit f04d94aa13

View File

@@ -1706,9 +1706,15 @@ void CWindow::sendWindowSize(Vector2D size, bool force, std::optional<Vector2D>
// TODO: this should be decoupled from setWindowSize IMO // TODO: this should be decoupled from setWindowSize IMO
Vector2D windowPos = overridePos.value_or(m_vRealPosition->goal()); Vector2D windowPos = overridePos.value_or(m_vRealPosition->goal());
if (m_bIsX11) { if (m_bIsX11 && PMONITOR) {
if (const auto XWAYLANDPOS = g_pXWaylandManager->waylandToXWaylandCoords(windowPos); XWAYLANDPOS != Vector2D{}) windowPos -= PMONITOR->vecPosition;
windowPos = XWAYLANDPOS;
if (*PXWLFORCESCALEZERO) {
windowPos *= PMONITOR->scale;
size *= PMONITOR->scale;
}
windowPos += PMONITOR->vecXWaylandPosition;
} }
if (!force && m_vPendingReportedSize == size && (windowPos == m_vReportedPosition || !m_bIsX11)) if (!force && m_vPendingReportedSize == size && (windowPos == m_vReportedPosition || !m_bIsX11))
@@ -1716,13 +1722,10 @@ void CWindow::sendWindowSize(Vector2D size, bool force, std::optional<Vector2D>
m_vReportedPosition = windowPos; m_vReportedPosition = windowPos;
m_vPendingReportedSize = size; m_vPendingReportedSize = size;
m_fX11SurfaceScaledBy = 1.0f; m_fX11SurfaceScaledBy = 1.0f;
if (*PXWLFORCESCALEZERO && m_bIsX11 && PMONITOR) { if (*PXWLFORCESCALEZERO && m_bIsX11 && PMONITOR)
size *= PMONITOR->scale;
m_fX11SurfaceScaledBy = PMONITOR->scale; m_fX11SurfaceScaledBy = PMONITOR->scale;
}
if (m_bIsX11 && m_pXWaylandSurface) if (m_bIsX11 && m_pXWaylandSurface)
m_pXWaylandSurface->configure({windowPos, size}); m_pXWaylandSurface->configure({windowPos, size});