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:

+ allfloat = true (new windows start as floating).
+ create a new window, tile it, and make it a group
+ create a new window autogrouped into the tiled group.
+ call togglefloat and the window disappears.
  • Loading branch information
Aqa-Ib committed Oct 1, 2024
1 parent 74a1613 commit ce8cc09
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions src/layout/IHyprLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,26 @@
#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) {
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;

else
onWindowCreatedTiling(pWindow, direction);
}
}

void IHyprLayout::onWindowRemoved(PHLWINDOW pWindow) {
Expand Down

0 comments on commit ce8cc09

Please sign in to comment.