Add active property and changed signal to KDecoration

Replaces the pure virtual method which the Decoration had to
implement. Instead the Decoration can now connect to the signal.

For KCommonDecoration there is no change at all except that the
invoked method is turned into a slot.
icc-effect-5.14.5
Martin Gräßlin 2013-08-23 16:29:18 +02:00
parent 70aafe08b5
commit e1c4512ccc
8 changed files with 9 additions and 21 deletions

View File

@ -431,7 +431,7 @@ void Client::createDecoration(const QRect& oldgeom)
connect(this, SIGNAL(shadeChanged()), decoration, SLOT(shadeChange()));
connect(this, SIGNAL(desktopChanged()), decoration, SLOT(desktopChange()));
connect(this, SIGNAL(captionChanged()), decoration, SLOT(captionChange()));
connect(this, SIGNAL(activeChanged()), decoration, SLOT(activeChange()));
connect(this, &Client::activeChanged, decoration, &KDecoration::activeChanged);
connect(this, SIGNAL(clientMaximizedStateChanged(KWin::Client*,KDecorationDefines::MaximizeMode)),
decoration, SLOT(maximizeChange()));
connect(this, SIGNAL(keepAboveChanged(bool)), decoration, SIGNAL(keepAboveChanged(bool)));

View File

@ -306,11 +306,6 @@ bool AuroraeClient::eventFilter(QObject *object, QEvent *event)
return false;
}
void AuroraeClient::activeChange()
{
emit activeChanged();
}
void AuroraeClient::captionChange()
{
emit captionChanged();

View File

@ -87,7 +87,6 @@ private:
class AuroraeClient : public KDecoration
{
Q_OBJECT
Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)
Q_PROPERTY(QString caption READ caption NOTIFY captionChanged)
Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged)
Q_PROPERTY(QRect geometry READ geometry)
@ -119,7 +118,6 @@ public:
AuroraeClient(KDecorationBridge* bridge, KDecorationFactory* factory);
virtual ~AuroraeClient();
virtual bool eventFilter(QObject *object, QEvent *event);
virtual void activeChange();
virtual void borders(int& left, int& right, int& top, int& bottom) const;
virtual void captionChange();
virtual void desktopChange();
@ -140,7 +138,6 @@ public:
Q_INVOKABLE QVariant readConfig(const QString &key, const QVariant &defaultValue = QVariant());
Q_SIGNALS:
void activeChanged();
void captionChanged();
void desktopChanged();
void iconChanged();

View File

@ -57,6 +57,7 @@ KCommonDecoration::KCommonDecoration(KDecorationBridge* bridge, KDecorationFacto
this, &KCommonDecoration::decorationButtonsChanged);
connect(wrapper, &KDecoration::decorationButtonsChanged,
this, &KCommonDecoration::buttonsChanged);
connect(wrapper, &KDecoration::activeChanged, this, &KCommonDecoration::activeChange);
}
KCommonDecoration::~KCommonDecoration()

View File

@ -260,9 +260,9 @@ public:
virtual void desktopChange();
virtual void shadeChange();
virtual void iconChange();
virtual void activeChange();
virtual void captionChange();
public Q_SLOTS:
virtual void activeChange();
void keepAboveChange(bool above);
void keepBelowChange(bool below);
void slotMaximize();

View File

@ -68,11 +68,6 @@ QSize KCommonDecorationWrapper::minimumSize() const
return decoration->minimumSize();
}
void KCommonDecorationWrapper::activeChange()
{
return decoration->activeChange();
}
void KCommonDecorationWrapper::captionChange()
{
return decoration->captionChange();

View File

@ -49,7 +49,6 @@ public:
virtual void borders(int& left, int& right, int& top, int& bottom) const;
virtual void resize(const QSize& s);
virtual QSize minimumSize() const;
virtual void activeChange();
virtual void captionChange();
virtual void iconChange();
virtual void maximizeChange();

View File

@ -490,6 +490,7 @@ class KWIN_EXPORT KDecoration
: public QObject, public KDecorationDefines
{
Q_OBJECT
Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)
public:
/**
* Constructs a KDecoration object. Both the arguments are passed from
@ -814,11 +815,6 @@ public:
virtual QSize minimumSize() const = 0;
public Q_SLOTS:
/**
* This function is called whenever the window either becomes or stops being active.
* Use isActive() to find out the current state.
*/
virtual void activeChange() = 0;
/**
* This function is called whenever the caption changes. Use caption() to get it.
*/
@ -845,6 +841,11 @@ public Q_SLOTS:
virtual void shadeChange() = 0;
Q_SIGNALS:
/**
* This signal is emitted whenever the window either becomes or stops being active.
* Use isActive() to find out the current state.
*/
void activeChanged();
/**
* This signal is emitted whenever the window's keep-above state changes.
*/