Allow disabling expo cells

This allows making specific windows in a WindowHeap static.
This commit is contained in:
Vlad Zahorodnii 2021-11-22 18:16:01 +02:00 committed by Nate Graham
parent 1589e2c918
commit 2456344fae
3 changed files with 30 additions and 1 deletions

View file

@ -36,12 +36,34 @@ void ExpoCell::setLayout(ExpoLayout *layout)
m_layout->removeCell(this);
}
m_layout = layout;
if (m_layout) {
if (m_layout && m_enabled) {
m_layout->addCell(this);
}
Q_EMIT layoutChanged();
}
bool ExpoCell::isEnabled() const
{
return m_enabled;
}
void ExpoCell::setEnabled(bool enabled)
{
if (m_enabled != enabled) {
m_enabled = enabled;
if (enabled) {
if (m_layout) {
m_layout->addCell(this);
}
} else {
if (m_layout) {
m_layout->removeCell(this);
}
}
Q_EMIT enabledChanged();
}
}
void ExpoCell::update()
{
if (m_layout) {

View file

@ -76,6 +76,7 @@ class ExpoCell : public QObject
{
Q_OBJECT
Q_PROPERTY(ExpoLayout *layout READ layout WRITE setLayout NOTIFY layoutChanged)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
Q_PROPERTY(int naturalX READ naturalX WRITE setNaturalX NOTIFY naturalXChanged)
Q_PROPERTY(int naturalY READ naturalY WRITE setNaturalY NOTIFY naturalYChanged)
Q_PROPERTY(int naturalWidth READ naturalWidth WRITE setNaturalWidth NOTIFY naturalWidthChanged)
@ -91,6 +92,9 @@ public:
explicit ExpoCell(QObject *parent = nullptr);
~ExpoCell() override;
bool isEnabled() const;
void setEnabled(bool enabled);
ExpoLayout *layout() const;
void setLayout(ExpoLayout *layout);
@ -132,6 +136,7 @@ public Q_SLOTS:
Q_SIGNALS:
void layoutChanged();
void enabledChanged();
void naturalXChanged();
void naturalYChanged();
void naturalWidthChanged();
@ -145,6 +150,7 @@ Q_SIGNALS:
private:
QString m_persistentKey;
bool m_enabled = true;
int m_naturalX = 0;
int m_naturalY = 0;
int m_naturalWidth = 0;

View file

@ -167,6 +167,7 @@ FocusScope {
ExpoCell {
id: cell
layout: expoLayout
enabled: !thumb.hidden
naturalX: thumb.client.x
naturalY: thumb.client.y
naturalWidth: thumb.client.width