kwineffects: Add properties to EffectScreen

This allows exposing EffectScreen to effects that use js or qml.
icc-effect-5.26.4
Vlad Zahorodnii 2021-07-23 10:37:18 +03:00
parent 9675da6325
commit c66f38ba7d
4 changed files with 19 additions and 1 deletions

View File

@ -216,6 +216,10 @@ Q_SIGNALS:
* This signal is emitted when the output has been enabled or disabled.
*/
void enabledChanged();
/**
* This signal is emitted when the device pixel ratio of the output has changed.
*/
void scaleChanged();
/**
* Notifies that the display will be dimmed in @p time ms. This allows

View File

@ -156,7 +156,6 @@ public:
Q_SIGNALS:
void modeChanged();
void outputChange(const QRegion &damagedRegion);
void scaleChanged();
void transformChanged();
void dpmsModeChanged();
void capabilitiesChanged();

View File

@ -1728,6 +1728,8 @@ EffectScreenImpl::EffectScreenImpl(AbstractOutput *output, QObject *parent)
{
connect(output, &AbstractOutput::wakeUp, this, &EffectScreen::wakeUp);
connect(output, &AbstractOutput::aboutToTurnOff, this, &EffectScreen::aboutToTurnOff);
connect(output, &AbstractOutput::scaleChanged, this, &EffectScreen::devicePixelRatioChanged);
connect(output, &AbstractOutput::geometryChanged, this, &EffectScreen::geometryChanged);
}
AbstractOutput *EffectScreenImpl::platformOutput() const

View File

@ -1831,6 +1831,9 @@ protected:
class KWINEFFECTS_EXPORT EffectScreen : public QObject
{
Q_OBJECT
Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged)
Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio NOTIFY devicePixelRatioChanged)
Q_PROPERTY(QString name READ name CONSTANT)
public:
explicit EffectScreen(QObject *parent = nullptr);
@ -1860,6 +1863,16 @@ Q_SIGNALS:
* Notifies that the output has been turned on and the wake can be decorated.
*/
void wakeUp();
/**
* This signal is emitted when the geometry of this screen changes.
*/
void geometryChanged();
/**
* This signal is emitted when the device pixel ratio of this screen changes.
*/
void devicePixelRatioChanged();
};
/**