From 6beb79f27b84c36b8b9ef5476d861a94a9071009 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Sun, 11 Jun 2023 21:52:13 +0200 Subject: xwayland: add force_zero_scaling --- src/managers/XWaylandManager.cpp | 11 +++++++++++ src/managers/input/InputManager.cpp | 3 +++ 2 files changed, 14 insertions(+) (limited to 'src/managers') diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp index 7cd03b3a..1801247d 100644 --- a/src/managers/XWaylandManager.cpp +++ b/src/managers/XWaylandManager.cpp @@ -148,6 +148,17 @@ void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, Vector2D size, bool f pWindow->m_vReportedPosition = pWindow->m_vRealPosition.vec(); pWindow->m_vReportedSize = size; + static auto* const PXWLFORCESCALEZERO = &g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")->intValue; + + pWindow->m_fX11SurfaceScaledBy = 1.f; + + if (*PXWLFORCESCALEZERO && pWindow->m_bIsX11) { + if (const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); PMONITOR) { + size = size * PMONITOR->scale; + pWindow->m_fX11SurfaceScaledBy = PMONITOR->scale; + } + } + if (pWindow->m_bIsX11) wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pWindow->m_vRealPosition.vec().x, pWindow->m_vRealPosition.vec().y, size.x, size.y); else diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 9f72603f..9dd6e5da 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -330,6 +330,9 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { surfaceLocal = mouseCoords - surfacePos + Vector2D(geom.x, geom.y); } + if (pFoundWindow && pFoundWindow->m_bIsX11) // for x11 force scale zero + surfaceLocal = surfaceLocal * pFoundWindow->m_fX11SurfaceScaledBy; + bool allowKeyboardRefocus = true; if (*PHOGFOCUS && !refocus && g_pCompositor->m_pLastFocus) { -- cgit v1.2.3