summaryrefslogtreecommitdiff
path: root/src/layout/IHyprLayout.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-07-18 13:14:31 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-07-18 13:14:31 +0200
commit900e6947e99f86439afee63fc5e57b54971df959 (patch)
tree85f4acc95c33d0e01b4fef31be82d575316ba0b1 /src/layout/IHyprLayout.cpp
parent90d07d7b520d3ea8d01dd248d16dcd96937f431c (diff)
reject windows with tiny sizes, overwrite size
Diffstat (limited to 'src/layout/IHyprLayout.cpp')
-rw-r--r--src/layout/IHyprLayout.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
index 9f258b44..f5d87068 100644
--- a/src/layout/IHyprLayout.cpp
+++ b/src/layout/IHyprLayout.cpp
@@ -32,11 +32,16 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
return;
}
- if (desiredGeometry.width <= 0 || desiredGeometry.height <= 0) {
+ if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) {
const auto PWINDOWSURFACE = g_pXWaylandManager->getWindowSurface(pWindow);
pWindow->m_vRealSize = Vector2D(PWINDOWSURFACE->current.width, PWINDOWSURFACE->current.height);
- pWindow->m_vRealPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_vRealSize.vec().x) / 2.f, PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_vRealSize.vec().y) / 2.f);
+
+ // reject any windows with size <= 5x5
+ if (pWindow->m_vRealSize.goalv().x <= 5 || pWindow->m_vRealSize.goalv().y <= 5) {
+ pWindow->m_vRealSize = PMONITOR->vecSize / 2.f;
+ }
+ pWindow->m_vRealPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_vRealSize.goalv().x) / 2.f, PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_vRealSize.goalv().y) / 2.f);
} else {
// we respect the size.
pWindow->m_vRealSize = Vector2D(desiredGeometry.width, desiredGeometry.height);