Skip to content

Commit

Permalink
xwaylandmgr: allow resizes without a monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Dec 17, 2023
1 parent 8c9f38e commit bf73740
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/managers/XWaylandManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
if (!PMONITOR)
return;

// calculate pos
// TODO: this should be decoupled from setWindowSize IMO
Vector2D windowPos = pWindow->m_vRealPosition.vec();

if (pWindow->m_bIsX11) {
if (pWindow->m_bIsX11 && PMONITOR) {
windowPos = windowPos - PMONITOR->vecPosition; // normalize to monitor
if (*PXWLFORCESCALEZERO)
windowPos = windowPos * PMONITOR->scale; // scale if applicable
Expand All @@ -172,11 +170,9 @@ void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, Vector2D size, bool f

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 (*PXWLFORCESCALEZERO && pWindow->m_bIsX11 && PMONITOR) {
size = size * PMONITOR->scale;
pWindow->m_fX11SurfaceScaledBy = PMONITOR->scale;
}

if (pWindow->m_bIsX11)
Expand Down

0 comments on commit bf73740

Please sign in to comment.