826fb1cb29
QuickTile::setRelativeGeometry() and QuickRootTile::setVerticalSplit() or QuickRootTile::setHorizontalSplit() can hit recursion when size constraints start taking effect. This change reworks how other quick tiles are resized. With the proposed design, when relative geometry changes, QuickRootTile will notice that and start resizing other tiles. When QuickRootTile resizes horizontal or vertical split, it is going to ignore QuickRootTile::relativeGeometryChanged() signals (m_resizedTile). It prevents hitting the recursion and makes moving h/v splits more predictable. I do think that in order to make the tile design more robust to this kind of bugs, it's worth splitting geometry in two kinds though - the one that indicates the preferred geometry (implicitWidth/implicitHeight in qtquick lingua) and the current geometry, the parent node then monitors the preferred geometries and updates the current geometries. BUG: 464621
52 lines
1.1 KiB
C++
52 lines
1.1 KiB
C++
/*
|
|
KWin - the KDE window manager
|
|
This file is part of the KDE project.
|
|
|
|
SPDX-FileCopyrightText: 2022 Marco Martin <mart@kde.org>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "tile.h"
|
|
#include "utils/common.h"
|
|
#include <kwin_export.h>
|
|
|
|
namespace KWin
|
|
{
|
|
|
|
class KWIN_EXPORT QuickRootTile : public Tile
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
QuickRootTile(TileManager *tiling, Tile *parentItem = nullptr);
|
|
~QuickRootTile();
|
|
|
|
Tile *tileForMode(QuickTileMode mode);
|
|
Tile *tileForBorder(ElectricBorder border);
|
|
|
|
qreal horizontalSplit() const;
|
|
void setHorizontalSplit(qreal split);
|
|
|
|
qreal verticalSplit() const;
|
|
void setVerticalSplit(qreal split);
|
|
|
|
private:
|
|
void relayoutToFit(Tile *tile);
|
|
|
|
Tile *m_resizedTile = nullptr;
|
|
|
|
std::unique_ptr<Tile> m_leftVerticalTile;
|
|
std::unique_ptr<Tile> m_rightVerticalTile;
|
|
|
|
std::unique_ptr<Tile> m_topHorizontalTile;
|
|
std::unique_ptr<Tile> m_bottomHorizontalTile;
|
|
|
|
std::unique_ptr<Tile> m_topLeftTile;
|
|
std::unique_ptr<Tile> m_topRightTile;
|
|
std::unique_ptr<Tile> m_bottomLeftTile;
|
|
std::unique_ptr<Tile> m_bottomRightTile;
|
|
};
|
|
|
|
} // namespace KWin
|