Expose compositing status to Switcher QtQuick item

This allows Task Switcher visualizations to know whether compositing is
active or not so they can adjust their visual representations
accordingly, if needed.
This commit is contained in:
Nate Graham 2021-05-10 22:29:55 -06:00
parent 2f0088de93
commit 7861c8d389
2 changed files with 10 additions and 0 deletions

View file

@ -8,6 +8,7 @@
*/
#include "switcheritem.h"
// KWin
#include "composite.h"
#include "tabboxhandler.h"
#include "screens.h"
// Qt
@ -32,6 +33,7 @@ SwitcherItem::SwitcherItem(QObject *parent)
}
});
connect(screens(), &Screens::changed, this, &SwitcherItem::screenGeometryChanged);
connect(Compositor::self(), &Compositor::compositingToggled, this, &SwitcherItem::compositingChanged);
}
SwitcherItem::~SwitcherItem()
@ -100,5 +102,10 @@ void SwitcherItem::setNoModifierGrab(bool set)
emit noModifierGrabChanged();
}
bool SwitcherItem::compositing()
{
return Compositor::compositing();
}
}
}

View file

@ -28,6 +28,7 @@ class SwitcherItem : public QObject
Q_PROPERTY(bool allDesktops READ isAllDesktops NOTIFY allDesktopsChanged)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
Q_PROPERTY(bool noModifierGrab READ noModifierGrab NOTIFY noModifierGrabChanged)
Q_PROPERTY(bool compositing READ compositing NOTIFY compositingChanged)
/**
* The main QML item that will be displayed in the Dialog
@ -50,6 +51,7 @@ public:
bool noModifierGrab() const {
return m_noModifierGrab;
}
bool compositing();
// for usage from outside
void setModel(QAbstractItemModel *model);
@ -65,6 +67,7 @@ Q_SIGNALS:
void screenGeometryChanged();
void itemChanged();
void noModifierGrabChanged();
void compositingChanged();
private:
QAbstractItemModel *m_model;