aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/layout/IHyprLayout.cpp
diff options
context:
space:
mode:
authorClyybber <[email protected]>2024-01-10 18:08:58 +0100
committerGitHub <[email protected]>2024-01-10 18:08:58 +0100
commit8d31c84483be7cc6f909d73c6ecd4c0b4bdc3360 (patch)
tree7462359eb2d702ef1d989783e9edc4e854c9215d /src/layout/IHyprLayout.cpp
parentd484506600e8e1065bef8df0ec0ed61393601a4d (diff)
downloadHyprland-8d31c84483be7cc6f909d73c6ecd4c0b4bdc3360.tar.gz
Hyprland-8d31c84483be7cc6f909d73c6ecd4c0b4bdc3360.zip
layout: Round window pos and size on togglefloating (#4407)
Also restore the behaviour introduced in bc4a51dbbb285391c9ed45b1b6ca7c2037b7ba71
Diffstat (limited to 'src/layout/IHyprLayout.cpp')
-rw-r--r--src/layout/IHyprLayout.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
index 6a03ac80..2a8fdf53 100644
--- a/src/layout/IHyprLayout.cpp
+++ b/src/layout/IHyprLayout.cpp
@@ -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));