Add shade 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.
remotes/origin/Plasma/5.0
Martin Gräßlin 13 years ago
parent fd64a29f72
commit 63bb36e2ad
  1. 2
      client.cpp
  2. 5
      clients/aurorae/src/aurorae.cpp
  3. 4
      clients/aurorae/src/aurorae.h
  4. 1
      libkdecorations/kcommondecoration.cpp
  5. 2
      libkdecorations/kcommondecoration.h
  6. 5
      libkdecorations/kcommondecoration_p.cpp
  7. 1
      libkdecorations/kcommondecoration_p.h
  8. 11
      libkdecorations/kdecoration.h

@ -428,7 +428,7 @@ void Client::createDecoration(const QRect& oldgeom)
} else { } else {
decoration = decorationPlugin()->createDecoration(bridge); decoration = decorationPlugin()->createDecoration(bridge);
} }
connect(this, SIGNAL(shadeChanged()), decoration, SLOT(shadeChange())); connect(this, &Client::shadeChanged, decoration, &KDecoration::shadeChanged);
connect(this, &Client::desktopChanged, decoration, &KDecoration::desktopChanged); connect(this, &Client::desktopChanged, decoration, &KDecoration::desktopChanged);
connect(this, &Client::captionChanged, decoration, &KDecoration::captionChanged); connect(this, &Client::captionChanged, decoration, &KDecoration::captionChanged);
connect(this, &Client::activeChanged, decoration, &KDecoration::activeChanged); connect(this, &Client::activeChanged, decoration, &KDecoration::activeChanged);

@ -327,11 +327,6 @@ void AuroraeClient::resize(const QSize &s)
widget()->resize(s); widget()->resize(s);
} }
void AuroraeClient::shadeChange()
{
emit shadeChanged();
}
void AuroraeClient::borders(int &left, int &right, int &top, int &bottom) const void AuroraeClient::borders(int &left, int &right, int &top, int &bottom) const
{ {
if (!m_item) { if (!m_item) {

@ -97,8 +97,6 @@ class AuroraeClient : public KDecoration
Q_PROPERTY(bool moveable READ isMovable CONSTANT) Q_PROPERTY(bool moveable READ isMovable CONSTANT)
Q_PROPERTY(bool preview READ isPreview CONSTANT) Q_PROPERTY(bool preview READ isPreview CONSTANT)
Q_PROPERTY(bool resizeable READ isResizable CONSTANT) Q_PROPERTY(bool resizeable READ isResizable CONSTANT)
Q_PROPERTY(bool setShade READ isSetShade NOTIFY shadeChanged)
Q_PROPERTY(bool shade READ isShade WRITE setShade NOTIFY shadeChanged)
Q_PROPERTY(bool shadeable READ isShadeable) Q_PROPERTY(bool shadeable READ isShadeable)
Q_PROPERTY(bool keepAbove READ keepAbove WRITE setKeepAbove NOTIFY keepAboveChangedWrapper) Q_PROPERTY(bool keepAbove READ keepAbove WRITE setKeepAbove NOTIFY keepAboveChangedWrapper)
Q_PROPERTY(bool keepBelow READ keepBelow WRITE setKeepBelow NOTIFY keepBelowChangedWrapper) Q_PROPERTY(bool keepBelow READ keepBelow WRITE setKeepBelow NOTIFY keepBelowChangedWrapper)
@ -122,7 +120,6 @@ public:
virtual QSize minimumSize() const; virtual QSize minimumSize() const;
virtual Position mousePosition(const QPoint& p) const; virtual Position mousePosition(const QPoint& p) const;
virtual void resize(const QSize& s); virtual void resize(const QSize& s);
virtual void shadeChange();
// optional overrides // optional overrides
virtual void padding(int &left, int &right, int &top, int &bottom) const; virtual void padding(int &left, int &right, int &top, int &bottom) const;
bool isMaximized() const; bool isMaximized() const;
@ -135,7 +132,6 @@ public:
Q_SIGNALS: Q_SIGNALS:
void iconChanged(); void iconChanged();
void maximizeChanged(); void maximizeChanged();
void shadeChanged();
void keepAboveChangedWrapper(); void keepAboveChangedWrapper();
void keepBelowChangedWrapper(); void keepBelowChangedWrapper();
void buttonsChanged(); void buttonsChanged();

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

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

@ -78,11 +78,6 @@ void KCommonDecorationWrapper::maximizeChange()
return decoration->maximizeChange(); return decoration->maximizeChange();
} }
void KCommonDecorationWrapper::shadeChange()
{
return decoration->shadeChange();
}
bool KCommonDecorationWrapper::drawbound(const QRect& geom, bool clear) bool KCommonDecorationWrapper::drawbound(const QRect& geom, bool clear)
{ {
return decoration->drawbound(geom, clear); return decoration->drawbound(geom, clear);

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

@ -494,6 +494,7 @@ class KWIN_EXPORT KDecoration
Q_PROPERTY(QString caption READ caption NOTIFY captionChanged) Q_PROPERTY(QString caption READ caption NOTIFY captionChanged)
Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged) Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged)
Q_PROPERTY(bool onAllDesktops READ isOnAllDesktops NOTIFY desktopChanged) Q_PROPERTY(bool onAllDesktops READ isOnAllDesktops NOTIFY desktopChanged)
Q_PROPERTY(bool setShade READ isSetShade NOTIFY shadeChanged)
public: public:
/** /**
* Constructs a KDecoration object. Both the arguments are passed from * Constructs a KDecoration object. Both the arguments are passed from
@ -827,11 +828,6 @@ public Q_SLOTS:
* Use maximizeMode() to get the current state. * Use maximizeMode() to get the current state.
*/ */
virtual void maximizeChange() = 0; virtual void maximizeChange() = 0;
/**
* This function is called whenever the window is shaded or unshaded. Use
* isShade() to get the current state.
*/
virtual void shadeChange() = 0;
Q_SIGNALS: Q_SIGNALS:
/** /**
@ -849,6 +845,11 @@ Q_SIGNALS:
* on which the window is. * on which the window is.
*/ */
void desktopChanged(); void desktopChanged();
/**
* This signal is emitted whenever the window is shaded or unshaded. Use
* isShade() to get the current state.
*/
void shadeChanged();
/** /**
* This signal is emitted whenever the window's keep-above state changes. * This signal is emitted whenever the window's keep-above state changes.
*/ */

Loading…
Cancel
Save