Skip to content

Commit

Permalink
add sizes for new floated and tiled windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Aqa-Ib committed Sep 30, 2024
1 parent 0da91e9 commit df6c1ad
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/layout/IHyprLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,28 @@
#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;

if (pWindow->m_bIsFloating) {
bool autoGrouped = IHyprLayout::onWindowCreatedAutoGroup(pWindow);
if (autoGrouped)
return;

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;

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

onWindowCreatedTiling(pWindow, direction);
}
}
Expand Down

0 comments on commit df6c1ad

Please sign in to comment.