Skip to content

Commit

Permalink
also add sizes for new floated windows. fixes a bug where the window …
Browse files Browse the repository at this point in the history
…has 0 size when togglefloating a tiled window that was newly created into a tiled group when allfloat=true
  • Loading branch information
Aqa-Ib committed Oct 1, 2024
1 parent 74a1613 commit 7a318c9
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/layout/IHyprLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,25 @@
#include "../xwayland/XSurface.hpp"

void IHyprLayout::onWindowCreated(PHLWINDOW pWindow, eDirection direction) {
CBox desiredGeometry = {};
g_pXWaylandManager->getGeometryForWindow(pWindow, &desiredGeometry);

if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
pWindow->m_vLastFloatingSize = PMONITOR->vecSize / 2.f;
} else {
pWindow->m_vLastFloatingSize = Vector2D(desiredGeometry.width, desiredGeometry.height);
}

pWindow->m_vPseudoSize = pWindow->m_vLastFloatingSize;

bool autoGrouped = IHyprLayout::onWindowCreatedAutoGroup(pWindow);
if (autoGrouped)
return;

if (pWindow->m_bIsFloating) {
onWindowCreatedFloating(pWindow);

} else {
CBox desiredGeometry = {};
g_pXWaylandManager->getGeometryForWindow(pWindow, &desiredGeometry);

if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
pWindow->m_vLastFloatingSize = PMONITOR->vecSize / 2.f;
} else {
pWindow->m_vLastFloatingSize = Vector2D(desiredGeometry.width, desiredGeometry.height);
}

pWindow->m_vPseudoSize = pWindow->m_vLastFloatingSize;

onWindowCreatedTiling(pWindow, direction);
}
}
Expand Down

0 comments on commit 7a318c9

Please sign in to comment.