diff options
| author | Maximilian Seidler <78690852+PaideiaDilemma@users.noreply.github.com> | 2025-02-06 11:21:04 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-06 11:21:04 +0000 |
| commit | ff9e059de6dd30c813270ff5a74053339cc94765 (patch) | |
| tree | dad34c495edeb5bef39283f75b595df903844055 /src/desktop/Window.cpp | |
| parent | f1e32cd122ad64ba7119ee7fe65f7c1074a65b91 (diff) | |
window: move size reporting to animation begin callback (#9298)
* window: fix resizes with an update callback
* window: fixup sendWindowSize
Remove the size argument from sendWindowSize, since it is now a member of the Window class
and we don't want any mismatches between m_vRealSize and what we report.
Remove sendWindowSize from mapWindow, since we shouldn't need it.
* window: sendWindowSize on animation begin
* window: move most calls to sendWindowSize to the animation begin
callback
* window: remove sendWindowSize in unmanaged if not fullscreen
Diffstat (limited to 'src/desktop/Window.cpp')
| -rw-r--r-- | src/desktop/Window.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index 8f6d2cb5..b0d7b58c 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -458,9 +458,6 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) { } } - // update xwayland coords - sendWindowSize(m_vRealSize->goal()); - if (OLDWORKSPACE && g_pCompositor->isWorkspaceSpecial(OLDWORKSPACE->m_iID) && OLDWORKSPACE->getWindows() == 0 && *PCLOSEONLASTSPECIAL) { if (const auto PMONITOR = OLDWORKSPACE->m_pMonitor.lock(); PMONITOR) PMONITOR->setSpecialWorkspace(nullptr); @@ -563,6 +560,15 @@ void CWindow::onMap() { *m_fBorderAngleAnimationProgress = 1.f; } + m_vRealSize->setCallbackOnBegin( + [this](auto) { + if (!m_bIsMapped || isX11OverrideRedirect()) + return; + + sendWindowSize(); + }, + false); + m_fMovingFromWorkspaceAlpha->setValueAndWarp(1.F); g_pCompositor->m_vWindowFocusHistory.push_back(m_pSelf); @@ -1315,7 +1321,6 @@ void CWindow::clampWindowSize(const std::optional<Vector2D> minSize, const std:: *m_vRealPosition = m_vRealPosition->goal() + DELTA / 2.0; *m_vRealSize = NEWSIZE; - sendWindowSize(NEWSIZE); } bool CWindow::isFullscreen() { @@ -1539,7 +1544,7 @@ void CWindow::onX11Configure(CBox box) { g_pHyprRenderer->damageWindow(m_pSelf.lock()); if (!m_bIsFloating || isFullscreen() || g_pInputManager->currentlyDraggedWindow == m_pSelf) { - sendWindowSize(m_vRealSize->goal(), true); + sendWindowSize(true); g_pInputManager->refocus(); g_pHyprRenderer->damageWindow(m_pSelf.lock()); return; @@ -1566,8 +1571,6 @@ void CWindow::onX11Configure(CBox box) { m_vPosition = m_vRealPosition->goal(); m_vSize = m_vRealSize->goal(); - sendWindowSize(box.size(), true); - m_vPendingReportedSize = box.size(); m_vReportedSize = box.size(); @@ -1697,15 +1700,16 @@ Vector2D CWindow::requestedMaxSize() { return maxSize; } -void CWindow::sendWindowSize(Vector2D size, bool force, std::optional<Vector2D> overridePos) { +void CWindow::sendWindowSize(bool force) { static auto PXWLFORCESCALEZERO = CConfigValue<Hyprlang::INT>("xwayland:force_zero_scaling"); const auto PMONITOR = m_pMonitor.lock(); - size = size.clamp(Vector2D{1, 1}, Vector2D{std::numeric_limits<double>::infinity(), std::numeric_limits<double>::infinity()}); + Debug::log(TRACE, "sendWindowSize: window:{:x},title:{} with real pos {}, real size {} (force: {})", (uintptr_t)this, this->m_szTitle, m_vRealPosition->goal(), + m_vRealSize->goal(), force); - // calculate pos // TODO: this should be decoupled from setWindowSize IMO - Vector2D windowPos = overridePos.value_or(m_vRealPosition->goal()); + Vector2D windowPos = m_vRealPosition->goal(); + Vector2D size = m_vRealSize->goal().clamp(Vector2D{1, 1}, Vector2D{std::numeric_limits<double>::infinity(), std::numeric_limits<double>::infinity()}); if (m_bIsX11 && PMONITOR) { windowPos = g_pXWaylandManager->waylandToXWaylandCoords(windowPos); |
