Add desktop 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.

Also isOnAllDesktop property is added using the same changed
signal as desktop property.
This commit is contained in:
Martin Gräßlin 2013-08-23 16:50:59 +02:00
parent 29bce13e9f
commit fd64a29f72
8 changed files with 11 additions and 23 deletions

View file

@ -429,7 +429,7 @@ void Client::createDecoration(const QRect& oldgeom)
decoration = decorationPlugin()->createDecoration(bridge);
}
connect(this, SIGNAL(shadeChanged()), decoration, SLOT(shadeChange()));
connect(this, SIGNAL(desktopChanged()), decoration, SLOT(desktopChange()));
connect(this, &Client::desktopChanged, decoration, &KDecoration::desktopChanged);
connect(this, &Client::captionChanged, decoration, &KDecoration::captionChanged);
connect(this, &Client::activeChanged, decoration, &KDecoration::activeChanged);
connect(this, SIGNAL(clientMaximizedStateChanged(KWin::Client*,KDecorationDefines::MaximizeMode)),

View file

@ -311,11 +311,6 @@ void AuroraeClient::iconChange()
emit iconChanged();
}
void AuroraeClient::desktopChange()
{
emit desktopChanged();
}
void AuroraeClient::maximizeChange()
{
emit maximizeChanged();

View file

@ -87,7 +87,6 @@ private:
class AuroraeClient : public KDecoration
{
Q_OBJECT
Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged)
Q_PROPERTY(QRect geometry READ geometry)
Q_PROPERTY(int height READ height)
Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged)
@ -96,7 +95,6 @@ class AuroraeClient : public KDecoration
Q_PROPERTY(bool minimizeable READ isMinimizable CONSTANT)
Q_PROPERTY(bool modal READ isModal)
Q_PROPERTY(bool moveable READ isMovable CONSTANT)
Q_PROPERTY(bool onAllDesktops READ isOnAllDesktops NOTIFY desktopChanged)
Q_PROPERTY(bool preview READ isPreview CONSTANT)
Q_PROPERTY(bool resizeable READ isResizable CONSTANT)
Q_PROPERTY(bool setShade READ isSetShade NOTIFY shadeChanged)
@ -118,7 +116,6 @@ public:
virtual ~AuroraeClient();
virtual bool eventFilter(QObject *object, QEvent *event);
virtual void borders(int& left, int& right, int& top, int& bottom) const;
virtual void desktopChange();
virtual void iconChange();
virtual void init();
virtual void maximizeChange();
@ -136,7 +133,6 @@ public:
Q_INVOKABLE QVariant readConfig(const QString &key, const QVariant &defaultValue = QVariant());
Q_SIGNALS:
void desktopChanged();
void iconChanged();
void maximizeChanged();
void shadeChanged();

View file

@ -59,6 +59,7 @@ KCommonDecoration::KCommonDecoration(KDecorationBridge* bridge, KDecorationFacto
this, &KCommonDecoration::buttonsChanged);
connect(wrapper, &KDecoration::activeChanged, this, &KCommonDecoration::activeChange);
connect(wrapper, &KDecoration::captionChanged, this, &KCommonDecoration::captionChange);
connect(wrapper, &KDecoration::desktopChanged, this, &KCommonDecoration::desktopChange);
}
KCommonDecoration::~KCommonDecoration()

View file

@ -257,12 +257,12 @@ public:
virtual void resize(const QSize& s);
virtual QSize minimumSize() const;
virtual void maximizeChange();
virtual void desktopChange();
virtual void shadeChange();
virtual void iconChange();
public Q_SLOTS:
virtual void activeChange();
virtual void captionChange();
virtual void desktopChange();
void keepAboveChange(bool above);
void keepBelowChange(bool below);
void slotMaximize();

View file

@ -78,11 +78,6 @@ void KCommonDecorationWrapper::maximizeChange()
return decoration->maximizeChange();
}
void KCommonDecorationWrapper::desktopChange()
{
return decoration->desktopChange();
}
void KCommonDecorationWrapper::shadeChange()
{
return decoration->shadeChange();

View file

@ -51,7 +51,6 @@ public:
virtual QSize minimumSize() const;
virtual void iconChange();
virtual void maximizeChange();
virtual void desktopChange();
virtual void shadeChange();
virtual bool drawbound(const QRect& geom, bool clear);
virtual bool windowDocked(Position side);

View file

@ -492,6 +492,8 @@ class KWIN_EXPORT 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(bool onAllDesktops READ isOnAllDesktops NOTIFY desktopChanged)
public:
/**
* Constructs a KDecoration object. Both the arguments are passed from
@ -825,12 +827,6 @@ public Q_SLOTS:
* Use maximizeMode() to get the current state.
*/
virtual void maximizeChange() = 0;
/**
* This function is called whenever the desktop for the window changes. Use
* desktop() or isOnAllDesktops() to find out the current desktop
* on which the window is.
*/
virtual void desktopChange() = 0;
/**
* This function is called whenever the window is shaded or unshaded. Use
* isShade() to get the current state.
@ -847,6 +843,12 @@ Q_SIGNALS:
* This signal is emitted whenever the caption changes. Use caption() to get it.
*/
void captionChanged();
/**
* This signal is emitted whenever the desktop for the window changes. Use
* desktop() or isOnAllDesktops() to find out the current desktop
* on which the window is.
*/
void desktopChanged();
/**
* This signal is emitted whenever the window's keep-above state changes.
*/