From 20284fb7bbacaa6bc0266fb2434d740d988e2984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 22 Dec 2011 18:10:18 +0100 Subject: [PATCH] Shade related properties Adding a convenient method to set a client to shade ignoring the hover state. --- client.cpp | 5 +++++ client.h | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/client.cpp b/client.cpp index b524b2328f..f3c6eb9bd5 100644 --- a/client.cpp +++ b/client.cpp @@ -1064,6 +1064,10 @@ bool Client::isShadeable() const return !isSpecialWindow() && !noBorder() && (rules()->checkShade(ShadeNormal) != rules()->checkShade(ShadeNone)); } +void Client::setShade(bool set) { + set ? setShade(ShadeNormal) : setShade(ShadeNone); +} + void Client::setShade(ShadeMode mode) { if (isSpecialWindow() || noBorder()) @@ -1138,6 +1142,7 @@ void Client::setShade(ShadeMode mode) // Update states of all other windows in this group if (clientGroup()) clientGroup()->updateStates(this); + emit shadeChanged(); } void Client::shadeHover() diff --git a/client.h b/client.h index 81075d4a1b..3e7ed2f7a0 100644 --- a/client.h +++ b/client.h @@ -125,10 +125,15 @@ class Client **/ Q_PROPERTY(bool providesContextHelp READ providesContextHelp CONSTANT) Q_PROPERTY(bool resizeable READ isResizable) - // TODO: notify signal + /** + * Whether the Client can be shaded. The property is evaluated each time it is invoked. + * Because of that there is no notify signal. + **/ Q_PROPERTY(bool shadeable READ isShadeable) - // TODO: proper setShade method and notifiy signal - Q_PROPERTY(bool shade READ isShade) + /** + * Whether the Client is shaded. + **/ + Q_PROPERTY(bool shade READ isShade WRITE setShade NOTIFY shadeChanged) /** * Whether the Client is a transient Window to another Window. * @see transientFor @@ -229,6 +234,7 @@ public: bool isShade() const; // True only for ShadeNormal ShadeMode shadeMode() const; // Prefer isShade() + void setShade(bool set); void setShade(ShadeMode mode); bool isShadeable() const; @@ -555,6 +561,7 @@ signals: void fullScreenChanged(); void transientChanged(); void modalChanged(); + void shadeChanged(); private: void exportMappingState(int s); // ICCCM 4.1.3.1, 4.1.4, NETWM 2.5.1