quicktiling: Reset layout when last quicktile ceases to exist

To not preserve invisible splits, last quicktile is differentiated
per split axis.

BUG: 465937
This commit is contained in:
Erwin Saumweber 2024-04-30 23:52:26 +02:00 committed by Vlad Zahorodnii
parent fa4b75804b
commit d4152fafbd
2 changed files with 29 additions and 0 deletions

View file

@ -28,6 +28,7 @@ QuickRootTile::QuickRootTile(TileManager *tiling, Tile *parentItem)
connect(tile, &Tile::relativeGeometryChanged, this, [this, tile]() {
relayoutToFit(tile);
});
connect(tile, &Tile::windowRemoved, this, &QuickRootTile::tryReset);
return std::unique_ptr<Tile>(tile);
};
@ -209,6 +210,33 @@ void QuickRootTile::setVerticalSplit(qreal split)
m_bottomRightTile->setRelativeGeometry(geom);
}
void QuickRootTile::tryReset()
{
if (!m_topLeftTile->windows().isEmpty()) {
return;
}
if (!m_topRightTile->windows().isEmpty()) {
return;
}
if (!m_bottomLeftTile->windows().isEmpty()) {
return;
}
if (!m_bottomRightTile->windows().isEmpty()) {
return;
}
if (m_leftVerticalTile->windows().isEmpty() && m_rightVerticalTile->windows().isEmpty()) {
setHorizontalSplit(0.5);
}
if (m_topHorizontalTile->windows().isEmpty() && m_bottomHorizontalTile->windows().isEmpty()) {
setVerticalSplit(0.5);
}
}
} // namespace KWin
#include "moc_quicktile.cpp"

View file

@ -34,6 +34,7 @@ public:
private:
void relayoutToFit(Tile *tile);
void tryReset();
Tile *m_resizedTile = nullptr;