Skip to content

Commit

Permalink
window: sendWindowSize for floating on the first real size update
Browse files Browse the repository at this point in the history
  • Loading branch information
PaideiaDilemma committed Feb 3, 2025
1 parent c022f79 commit be51276
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/desktop/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,10 +561,18 @@ void CWindow::onMap() {
*m_fBorderAngleAnimationProgress = 1.f;
}

m_vRealSize->setUpdateCallback([this](auto) {
if (validMapped(m_pSelf) && m_bIsFloating)
sendWindowSize();
});
// using setCallbackOnBegin directly here might make it so we send "temporary" sizes
// to avoid that only send the window size on the first real size update
m_vRealSize->setCallbackOnBegin(
[this](auto) {
m_vRealSize->setUpdateCallback([this](auto) {
if (m_bIsMapped && m_bIsFloating)
sendWindowSize();

m_vRealSize->setUpdateCallback(nullptr);
});
},
false);

m_fMovingFromWorkspaceAlpha->setValueAndWarp(1.F);

Expand Down Expand Up @@ -1705,8 +1713,8 @@ void CWindow::sendWindowSize(bool force) {
const auto PMONITOR = m_pMonitor.lock();

// TODO: this should be decoupled from setWindowSize IMO
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()});
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);
Expand Down

0 comments on commit be51276

Please sign in to comment.