mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-16 04:23:49 -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
@@ -2330,7 +2330,7 @@ void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, SFullscreenS
|
|||||||
|
|
||||||
updateFullscreenFadeOnWorkspace(PWORKSPACE);
|
updateFullscreenFadeOnWorkspace(PWORKSPACE);
|
||||||
|
|
||||||
PWINDOW->sendWindowSize(PWINDOW->m_vRealSize->goal(), true);
|
PWINDOW->sendWindowSize(true);
|
||||||
|
|
||||||
PWORKSPACE->forceReportSizesToWindows();
|
PWORKSPACE->forceReportSizesToWindows();
|
||||||
|
|
||||||
|
@@ -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 (OLDWORKSPACE && g_pCompositor->isWorkspaceSpecial(OLDWORKSPACE->m_iID) && OLDWORKSPACE->getWindows() == 0 && *PCLOSEONLASTSPECIAL) {
|
||||||
if (const auto PMONITOR = OLDWORKSPACE->m_pMonitor.lock(); PMONITOR)
|
if (const auto PMONITOR = OLDWORKSPACE->m_pMonitor.lock(); PMONITOR)
|
||||||
PMONITOR->setSpecialWorkspace(nullptr);
|
PMONITOR->setSpecialWorkspace(nullptr);
|
||||||
@@ -563,6 +560,15 @@ void CWindow::onMap() {
|
|||||||
*m_fBorderAngleAnimationProgress = 1.f;
|
*m_fBorderAngleAnimationProgress = 1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_vRealSize->setCallbackOnBegin(
|
||||||
|
[this](auto) {
|
||||||
|
if (!m_bIsMapped || isX11OverrideRedirect())
|
||||||
|
return;
|
||||||
|
|
||||||
|
sendWindowSize();
|
||||||
|
},
|
||||||
|
false);
|
||||||
|
|
||||||
m_fMovingFromWorkspaceAlpha->setValueAndWarp(1.F);
|
m_fMovingFromWorkspaceAlpha->setValueAndWarp(1.F);
|
||||||
|
|
||||||
g_pCompositor->m_vWindowFocusHistory.push_back(m_pSelf);
|
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_vRealPosition = m_vRealPosition->goal() + DELTA / 2.0;
|
||||||
*m_vRealSize = NEWSIZE;
|
*m_vRealSize = NEWSIZE;
|
||||||
sendWindowSize(NEWSIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWindow::isFullscreen() {
|
bool CWindow::isFullscreen() {
|
||||||
@@ -1539,7 +1544,7 @@ void CWindow::onX11Configure(CBox box) {
|
|||||||
g_pHyprRenderer->damageWindow(m_pSelf.lock());
|
g_pHyprRenderer->damageWindow(m_pSelf.lock());
|
||||||
|
|
||||||
if (!m_bIsFloating || isFullscreen() || g_pInputManager->currentlyDraggedWindow == m_pSelf) {
|
if (!m_bIsFloating || isFullscreen() || g_pInputManager->currentlyDraggedWindow == m_pSelf) {
|
||||||
sendWindowSize(m_vRealSize->goal(), true);
|
sendWindowSize(true);
|
||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
g_pHyprRenderer->damageWindow(m_pSelf.lock());
|
g_pHyprRenderer->damageWindow(m_pSelf.lock());
|
||||||
return;
|
return;
|
||||||
@@ -1566,8 +1571,6 @@ void CWindow::onX11Configure(CBox box) {
|
|||||||
m_vPosition = m_vRealPosition->goal();
|
m_vPosition = m_vRealPosition->goal();
|
||||||
m_vSize = m_vRealSize->goal();
|
m_vSize = m_vRealSize->goal();
|
||||||
|
|
||||||
sendWindowSize(box.size(), true);
|
|
||||||
|
|
||||||
m_vPendingReportedSize = box.size();
|
m_vPendingReportedSize = box.size();
|
||||||
m_vReportedSize = box.size();
|
m_vReportedSize = box.size();
|
||||||
|
|
||||||
@@ -1697,15 +1700,16 @@ Vector2D CWindow::requestedMaxSize() {
|
|||||||
return maxSize;
|
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");
|
static auto PXWLFORCESCALEZERO = CConfigValue<Hyprlang::INT>("xwayland:force_zero_scaling");
|
||||||
const auto PMONITOR = m_pMonitor.lock();
|
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
|
// 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) {
|
if (m_bIsX11 && PMONITOR) {
|
||||||
windowPos = g_pXWaylandManager->waylandToXWaylandCoords(windowPos);
|
windowPos = g_pXWaylandManager->waylandToXWaylandCoords(windowPos);
|
||||||
|
@@ -471,7 +471,7 @@ class CWindow {
|
|||||||
bool isModal();
|
bool isModal();
|
||||||
Vector2D requestedMinSize();
|
Vector2D requestedMinSize();
|
||||||
Vector2D requestedMaxSize();
|
Vector2D requestedMaxSize();
|
||||||
void sendWindowSize(Vector2D size, bool force = false, std::optional<Vector2D> overridePos = std::nullopt);
|
void sendWindowSize(bool force = false);
|
||||||
NContentType::eContentType getContentType();
|
NContentType::eContentType getContentType();
|
||||||
void setContentType(NContentType::eContentType contentType);
|
void setContentType(NContentType::eContentType contentType);
|
||||||
|
|
||||||
|
@@ -624,7 +624,7 @@ void CWorkspace::forceReportSizesToWindows() {
|
|||||||
if (w->m_pWorkspace != m_pSelf || !w->m_bIsMapped || w->isHidden())
|
if (w->m_pWorkspace != m_pSelf || !w->m_bIsMapped || w->isHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
w->sendWindowSize(w->m_vRealSize->goal(), true);
|
w->sendWindowSize(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -688,13 +688,6 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
|
|
||||||
if (PMONITOR && PWINDOW->isX11OverrideRedirect())
|
if (PMONITOR && PWINDOW->isX11OverrideRedirect())
|
||||||
PWINDOW->m_fX11SurfaceScaledBy = PMONITOR->scale;
|
PWINDOW->m_fX11SurfaceScaledBy = PMONITOR->scale;
|
||||||
|
|
||||||
// Fix some X11 popups being invisible / having incorrect size on open.
|
|
||||||
// What the ACTUAL FUCK is going on?????? I HATE X11
|
|
||||||
if (!PWINDOW->isX11OverrideRedirect() && PWINDOW->m_bIsX11 && PWINDOW->m_bIsFloating) {
|
|
||||||
PWINDOW->sendWindowSize(PWINDOW->m_vRealSize->goal(), true, PWINDOW->m_vRealPosition->goal() - Vector2D{1, 1});
|
|
||||||
PWINDOW->sendWindowSize(PWINDOW->m_vRealSize->goal(), true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_unmapWindow(void* owner, void* data) {
|
void Events::listener_unmapWindow(void* owner, void* data) {
|
||||||
@@ -964,7 +957,7 @@ void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
|
|||||||
PWINDOW->setHidden(true);
|
PWINDOW->setHidden(true);
|
||||||
|
|
||||||
if (PWINDOW->isFullscreen() || !PWINDOW->m_bIsFloating) {
|
if (PWINDOW->isFullscreen() || !PWINDOW->m_bIsFloating) {
|
||||||
PWINDOW->sendWindowSize(PWINDOW->m_vRealSize->goal(), true);
|
PWINDOW->sendWindowSize(true);
|
||||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -198,16 +198,12 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
|
|||||||
|
|
||||||
*PWINDOW->m_vRealPosition = wb.pos();
|
*PWINDOW->m_vRealPosition = wb.pos();
|
||||||
*PWINDOW->m_vRealSize = wb.size();
|
*PWINDOW->m_vRealSize = wb.size();
|
||||||
|
|
||||||
PWINDOW->sendWindowSize(wb.size());
|
|
||||||
} else {
|
} else {
|
||||||
CBox wb = {calcPos, calcSize};
|
CBox wb = {calcPos, calcSize};
|
||||||
wb.round(); // avoid rounding mess
|
wb.round(); // avoid rounding mess
|
||||||
|
|
||||||
*PWINDOW->m_vRealSize = wb.size();
|
*PWINDOW->m_vRealSize = wb.size();
|
||||||
*PWINDOW->m_vRealPosition = wb.pos();
|
*PWINDOW->m_vRealPosition = wb.pos();
|
||||||
|
|
||||||
PWINDOW->sendWindowSize(wb.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (force) {
|
if (force) {
|
||||||
|
@@ -176,11 +176,9 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) {
|
|||||||
pWindow->m_vRealSize->warp();
|
pWindow->m_vRealSize->warp();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pWindow->isX11OverrideRedirect()) {
|
if (!pWindow->isX11OverrideRedirect())
|
||||||
pWindow->sendWindowSize(pWindow->m_vRealSize->goal());
|
|
||||||
|
|
||||||
g_pCompositor->changeWindowZOrder(pWindow, true);
|
g_pCompositor->changeWindowZOrder(pWindow, true);
|
||||||
} else {
|
else {
|
||||||
pWindow->m_vPendingReportedSize = pWindow->m_vRealSize->goal();
|
pWindow->m_vPendingReportedSize = pWindow->m_vRealSize->goal();
|
||||||
pWindow->m_vReportedSize = pWindow->m_vPendingReportedSize;
|
pWindow->m_vReportedSize = pWindow->m_vPendingReportedSize;
|
||||||
}
|
}
|
||||||
@@ -362,9 +360,6 @@ void IHyprLayout::onEndDragWindow() {
|
|||||||
DRAGGINGWINDOW->m_vLastFloatingSize = m_vDraggingWindowOriginalFloatSize;
|
DRAGGINGWINDOW->m_vLastFloatingSize = m_vDraggingWindowOriginalFloatSize;
|
||||||
DRAGGINGWINDOW->m_bDraggingTiled = false;
|
DRAGGINGWINDOW->m_bDraggingTiled = false;
|
||||||
|
|
||||||
if (pWindow->m_bIsFloating)
|
|
||||||
DRAGGINGWINDOW->sendWindowSize(DRAGGINGWINDOW->m_vRealSize->goal()); // match the size of the window
|
|
||||||
|
|
||||||
static auto USECURRPOS = CConfigValue<Hyprlang::INT>("group:insert_after_current");
|
static auto USECURRPOS = CConfigValue<Hyprlang::INT>("group:insert_after_current");
|
||||||
(*USECURRPOS ? pWindow : pWindow->getGroupTail())->insertWindowToGroup(DRAGGINGWINDOW);
|
(*USECURRPOS ? pWindow : pWindow->getGroupTail())->insertWindowToGroup(DRAGGINGWINDOW);
|
||||||
pWindow->setGroupCurrent(DRAGGINGWINDOW);
|
pWindow->setGroupCurrent(DRAGGINGWINDOW);
|
||||||
@@ -606,10 +601,11 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
|
|||||||
|
|
||||||
if (*PANIMATEMOUSE)
|
if (*PANIMATEMOUSE)
|
||||||
*DRAGGINGWINDOW->m_vRealPosition = wb.pos();
|
*DRAGGINGWINDOW->m_vRealPosition = wb.pos();
|
||||||
else
|
else {
|
||||||
DRAGGINGWINDOW->m_vRealPosition->setValueAndWarp(wb.pos());
|
DRAGGINGWINDOW->m_vRealPosition->setValueAndWarp(wb.pos());
|
||||||
|
DRAGGINGWINDOW->sendWindowSize();
|
||||||
|
}
|
||||||
|
|
||||||
DRAGGINGWINDOW->sendWindowSize(DRAGGINGWINDOW->m_vRealSize->goal());
|
|
||||||
} else if (g_pInputManager->dragMode == MBIND_RESIZE || g_pInputManager->dragMode == MBIND_RESIZE_FORCE_RATIO || g_pInputManager->dragMode == MBIND_RESIZE_BLOCK_RATIO) {
|
} else if (g_pInputManager->dragMode == MBIND_RESIZE || g_pInputManager->dragMode == MBIND_RESIZE_FORCE_RATIO || g_pInputManager->dragMode == MBIND_RESIZE_BLOCK_RATIO) {
|
||||||
if (DRAGGINGWINDOW->m_bIsFloating) {
|
if (DRAGGINGWINDOW->m_bIsFloating) {
|
||||||
|
|
||||||
@@ -679,9 +675,8 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
|
|||||||
} else {
|
} else {
|
||||||
DRAGGINGWINDOW->m_vRealSize->setValueAndWarp(wb.size());
|
DRAGGINGWINDOW->m_vRealSize->setValueAndWarp(wb.size());
|
||||||
DRAGGINGWINDOW->m_vRealPosition->setValueAndWarp(wb.pos());
|
DRAGGINGWINDOW->m_vRealPosition->setValueAndWarp(wb.pos());
|
||||||
|
DRAGGINGWINDOW->sendWindowSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
DRAGGINGWINDOW->sendWindowSize(DRAGGINGWINDOW->m_vRealSize->goal());
|
|
||||||
} else {
|
} else {
|
||||||
resizeActiveWindow(TICKDELTA, m_eGrabbedCorner, DRAGGINGWINDOW);
|
resizeActiveWindow(TICKDELTA, m_eGrabbedCorner, DRAGGINGWINDOW);
|
||||||
}
|
}
|
||||||
@@ -787,7 +782,6 @@ void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) {
|
|||||||
|
|
||||||
g_pCompositor->updateWindowAnimatedDecorationValues(pWindow);
|
g_pCompositor->updateWindowAnimatedDecorationValues(pWindow);
|
||||||
pWindow->updateToplevel();
|
pWindow->updateToplevel();
|
||||||
pWindow->sendWindowSize(pWindow->m_vRealSize->goal());
|
|
||||||
g_pHyprRenderer->damageWindow(pWindow);
|
g_pHyprRenderer->damageWindow(pWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -678,16 +678,12 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
|
|||||||
|
|
||||||
*PWINDOW->m_vRealPosition = wb.pos();
|
*PWINDOW->m_vRealPosition = wb.pos();
|
||||||
*PWINDOW->m_vRealSize = wb.size();
|
*PWINDOW->m_vRealSize = wb.size();
|
||||||
|
|
||||||
PWINDOW->sendWindowSize(wb.size());
|
|
||||||
} else {
|
} else {
|
||||||
CBox wb = {calcPos, calcSize};
|
CBox wb = {calcPos, calcSize};
|
||||||
wb.round(); // avoid rounding mess
|
wb.round(); // avoid rounding mess
|
||||||
|
|
||||||
*PWINDOW->m_vRealPosition = wb.pos();
|
*PWINDOW->m_vRealPosition = wb.pos();
|
||||||
*PWINDOW->m_vRealSize = wb.size();
|
*PWINDOW->m_vRealSize = wb.size();
|
||||||
|
|
||||||
PWINDOW->sendWindowSize(wb.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_bForceWarps && !*PANIMATE) {
|
if (m_bForceWarps && !*PANIMATE) {
|
||||||
|
@@ -1908,7 +1908,6 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) {
|
|||||||
if (PWORKSPACE->m_bDefaultFloating) {
|
if (PWORKSPACE->m_bDefaultFloating) {
|
||||||
w->m_vRealPosition->setValueAndWarp(SAVEDPOS);
|
w->m_vRealPosition->setValueAndWarp(SAVEDPOS);
|
||||||
w->m_vRealSize->setValueAndWarp(SAVEDSIZE);
|
w->m_vRealSize->setValueAndWarp(SAVEDSIZE);
|
||||||
w->sendWindowSize(SAVEDSIZE);
|
|
||||||
*w->m_vRealSize = w->m_vRealSize->value() + Vector2D(4, 4);
|
*w->m_vRealSize = w->m_vRealSize->value() + Vector2D(4, 4);
|
||||||
*w->m_vRealPosition = w->m_vRealPosition->value() - Vector2D(2, 2);
|
*w->m_vRealPosition = w->m_vRealPosition->value() - Vector2D(2, 2);
|
||||||
}
|
}
|
||||||
|
@@ -55,7 +55,7 @@ void CHyprXWaylandManager::activateWindow(PHLWINDOW pWindow, bool activate) {
|
|||||||
if (pWindow->m_bIsX11) {
|
if (pWindow->m_bIsX11) {
|
||||||
|
|
||||||
if (activate) {
|
if (activate) {
|
||||||
pWindow->sendWindowSize(pWindow->m_vRealSize->value(), true); // update xwayland output pos
|
pWindow->sendWindowSize(true); // update xwayland output pos
|
||||||
pWindow->m_pXWaylandSurface->setMinimized(false);
|
pWindow->m_pXWaylandSurface->setMinimized(false);
|
||||||
|
|
||||||
if (!pWindow->isX11OverrideRedirect())
|
if (!pWindow->isX11OverrideRedirect())
|
||||||
|
@@ -456,9 +456,6 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND
|
|||||||
|
|
||||||
pDraggedWindow->m_bIsFloating = pWindowInsertAfter->m_bIsFloating; // match the floating state of the window
|
pDraggedWindow->m_bIsFloating = pWindowInsertAfter->m_bIsFloating; // match the floating state of the window
|
||||||
|
|
||||||
if (pWindowInsertAfter->m_bIsFloating)
|
|
||||||
pDraggedWindow->sendWindowSize(pWindowInsertAfter->m_vRealSize->goal()); // match the size of the window
|
|
||||||
|
|
||||||
pWindowInsertAfter->insertWindowToGroup(pDraggedWindow);
|
pWindowInsertAfter->insertWindowToGroup(pDraggedWindow);
|
||||||
|
|
||||||
if (WINDOWINDEX == -1)
|
if (WINDOWINDEX == -1)
|
||||||
|
Reference in New Issue
Block a user