From c64bfb51ede8b85551dc849350fbfe0f278c189b Mon Sep 17 00:00:00 2001 From: nnyyxxxx Date: Fri, 31 Jan 2025 07:51:16 -0500 Subject: [PATCH] fix(xwayland): correct pointer coordinate mismatch in X11 windows --- src/desktop/Window.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index 09037cbd704..bdb030b6d38 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -1697,24 +1697,16 @@ Vector2D CWindow::requestedMaxSize() { void CWindow::sendWindowSize(Vector2D size, bool force, std::optional overridePos) { static auto PXWLFORCESCALEZERO = CConfigValue("xwayland:force_zero_scaling"); - - const auto PMONITOR = m_pMonitor.lock(); + const auto PMONITOR = m_pMonitor.lock(); size = size.clamp(Vector2D{0, 0}, Vector2D{std::numeric_limits::infinity(), std::numeric_limits::infinity()}); - // calculate pos - // TODO: this should be decoupled from setWindowSize IMO Vector2D windowPos = overridePos.value_or(m_vRealPosition->goal()); if (m_bIsX11 && PMONITOR) { - windowPos -= PMONITOR->vecPosition; - - if (*PXWLFORCESCALEZERO) { - windowPos *= PMONITOR->scale; + windowPos = g_pXWaylandManager->waylandToXWaylandCoords(windowPos); + if (*PXWLFORCESCALEZERO) size *= PMONITOR->scale; - } - - windowPos += PMONITOR->vecXWaylandPosition; } if (!force && m_vPendingReportedSize == size && (windowPos == m_vReportedPosition || !m_bIsX11))