mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-16 12:33:48 -07:00
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
This commit is contained in:
committed by
GitHub
parent
f1e32cd122
commit
ff9e059de6
@@ -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);
|
||||
|
Reference in New Issue
Block a user