xwaylandmgr: allow resizes without a monitor

This commit is contained in:
Vaxry 2023-12-17 19:58:11 +00:00
parent 8c9f38e405
commit bf7374011b

View file

@ -150,14 +150,12 @@ void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, Vector2D size, bool f
static auto* const PXWLFORCESCALEZERO = &g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")->intValue; static auto* const PXWLFORCESCALEZERO = &g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")->intValue;
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
if (!PMONITOR)
return;
// calculate pos // calculate pos
// TODO: this should be decoupled from setWindowSize IMO // TODO: this should be decoupled from setWindowSize IMO
Vector2D windowPos = pWindow->m_vRealPosition.vec(); Vector2D windowPos = pWindow->m_vRealPosition.vec();
if (pWindow->m_bIsX11) { if (pWindow->m_bIsX11 && PMONITOR) {
windowPos = windowPos - PMONITOR->vecPosition; // normalize to monitor windowPos = windowPos - PMONITOR->vecPosition; // normalize to monitor
if (*PXWLFORCESCALEZERO) if (*PXWLFORCESCALEZERO)
windowPos = windowPos * PMONITOR->scale; // scale if applicable windowPos = windowPos * PMONITOR->scale; // scale if applicable
@ -172,11 +170,9 @@ void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, Vector2D size, bool f
pWindow->m_fX11SurfaceScaledBy = 1.f; pWindow->m_fX11SurfaceScaledBy = 1.f;
if (*PXWLFORCESCALEZERO && pWindow->m_bIsX11) { if (*PXWLFORCESCALEZERO && pWindow->m_bIsX11 && PMONITOR) {
if (const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); PMONITOR) { size = size * PMONITOR->scale;
size = size * PMONITOR->scale; pWindow->m_fX11SurfaceScaledBy = PMONITOR->scale;
pWindow->m_fX11SurfaceScaledBy = PMONITOR->scale;
}
} }
if (pWindow->m_bIsX11) if (pWindow->m_bIsX11)