Skip to content

Commit

Permalink
layout: Round window pos and size on togglefloating (#4407)
Browse files Browse the repository at this point in the history
Also restore the behaviour introduced in bc4a51d
  • Loading branch information
Clyybber committed Jan 10, 2024
1 parent d484506 commit 8d31c84
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/layout/IHyprLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,16 +469,18 @@ void IHyprLayout::changeWindowFloatingMode(CWindow* pWindow) {

g_pCompositor->changeWindowZOrder(pWindow, true);

CBox wb = {pWindow->m_vRealPosition.goalv() + (pWindow->m_vRealSize.goalv() - pWindow->m_vLastFloatingSize) / 2.f, pWindow->m_vLastFloatingSize};
wb.round();

if (DELTALESSTHAN(pWindow->m_vRealSize.vec().x, pWindow->m_vLastFloatingSize.x, 10) && DELTALESSTHAN(pWindow->m_vRealSize.vec().y, pWindow->m_vLastFloatingSize.y, 10)) {
pWindow->m_vRealPosition = pWindow->m_vRealPosition.goalv() + (pWindow->m_vRealSize.goalv() - pWindow->m_vLastFloatingSize) / 2.f + Vector2D{10, 10};
pWindow->m_vRealSize = pWindow->m_vLastFloatingSize - Vector2D{20, 20};
wb = {wb.pos() + Vector2D{10, 10}, wb.size() - Vector2D{20, 20}};
}

pWindow->m_vRealPosition = pWindow->m_vRealPosition.goalv() + (pWindow->m_vRealSize.goalv() - pWindow->m_vLastFloatingSize) / 2.f;
pWindow->m_vRealSize = pWindow->m_vLastFloatingSize;
pWindow->m_vRealPosition = wb.pos();
pWindow->m_vRealSize = wb.size();

pWindow->m_vSize = pWindow->m_vRealSize.goalv();
pWindow->m_vPosition = pWindow->m_vRealPosition.goalv();
pWindow->m_vSize = wb.pos();
pWindow->m_vPosition = wb.size();

g_pHyprRenderer->damageMonitor(g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID));

Expand Down

0 comments on commit 8d31c84

Please sign in to comment.