From a4d16debfc22f4e877119fe62171de69bdfd6f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 13 Mar 2015 13:39:53 +0100 Subject: [PATCH] Partly move shade implementation to AbstractClient * properties defined in AbstractClient * implementation of isShade moved to AbstractClient * implementation of setShade(bool) moved to AbstractClient * default implementation for isShadeable added to AbstractClient * default implementation for shadeMode returning ShadeNone * default implementation fo setShade which does nothing --- abstract_client.cpp | 20 ++++++++++++++++++++ abstract_client.h | 34 +++++++++++++++++++++++++++++----- client.cpp | 4 ---- client.h | 17 ----------------- 4 files changed, 49 insertions(+), 26 deletions(-) diff --git a/abstract_client.cpp b/abstract_client.cpp index 5cd40d985a..19a86c0c97 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -280,4 +280,24 @@ void AbstractClient::setOnAllDesktops(bool b) setDesktop(VirtualDesktopManager::self()->current()); } +bool AbstractClient::isShadeable() const +{ + return false; +} + +void AbstractClient::setShade(bool set) +{ + set ? setShade(ShadeNormal) : setShade(ShadeNone); +} + +void AbstractClient::setShade(ShadeMode mode) +{ + Q_UNUSED(mode) +} + +ShadeMode AbstractClient::shadeMode() const +{ + return ShadeNone; +} + } diff --git a/abstract_client.h b/abstract_client.h index f92550f37e..0a05a56a56 100644 --- a/abstract_client.h +++ b/abstract_client.h @@ -73,6 +73,15 @@ class AbstractClient : public Toplevel * Whether the Client is set to be kept below other windows. **/ Q_PROPERTY(bool keepBelow READ keepBelow WRITE setKeepBelow NOTIFY keepBelowChanged) + /** + * 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) + /** + * Whether the Client is shaded. + **/ + Q_PROPERTY(bool shade READ isShade WRITE setShade NOTIFY shadeChanged) /** * Returns whether the window is any of special windows types (desktop, dock, splash, ...), * i.e. window types that usually don't have a window frame and the user does not use window @@ -182,11 +191,25 @@ public: virtual bool isResizable() const = 0; virtual bool isMovable() const = 0; virtual bool isMovableAcrossScreens() const = 0; - virtual bool isShade() const = 0; // True only for ShadeNormal - virtual ShadeMode shadeMode() const = 0; // Prefer isShade() - virtual void setShade(bool set) = 0; - virtual void setShade(ShadeMode mode) = 0; - virtual bool isShadeable() const = 0; + /** + * @c true only for @c ShadeNormal + **/ + bool isShade() const { + return shadeMode() == ShadeNormal; + } + /** + * Default implementation returns @c ShadeNone + **/ + virtual ShadeMode shadeMode() const; // Prefer isShade() + void setShade(bool set); + /** + * Default implementation does nothing + **/ + virtual void setShade(ShadeMode mode); + /** + * Whether the Client can be shaded. Default implementation returns @c false. + **/ + virtual bool isShadeable() const; virtual bool isMaximizable() const = 0; virtual bool isMinimizable() const = 0; virtual bool userCanSetFullScreen() const = 0; @@ -260,6 +283,7 @@ Q_SIGNALS: void demandsAttentionChanged(); void desktopPresenceChanged(KWin::AbstractClient*, int); // to be forwarded by Workspace void desktopChanged(); + void shadeChanged(); protected: AbstractClient(); diff --git a/client.cpp b/client.cpp index 8e8a4268bb..3a24eb2b16 100644 --- a/client.cpp +++ b/client.cpp @@ -809,10 +809,6 @@ 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 (mode == ShadeHover && isMove()) diff --git a/client.h b/client.h index 6abc1738d0..ad15db1d1f 100644 --- a/client.h +++ b/client.h @@ -139,15 +139,6 @@ class Client * Because of that there is no notify signal. **/ Q_PROPERTY(bool resizeable READ isResizable) - /** - * 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) - /** - * 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 @@ -304,9 +295,7 @@ public: bool isShown(bool shaded_is_shown) const override; bool isHiddenInternal() const; // For compositing - bool isShade() const override; // True only for ShadeNormal ShadeMode shadeMode() const override; // Prefer isShade() - void setShade(bool set) override; void setShade(ShadeMode mode) override; bool isShadeable() const override; @@ -629,7 +618,6 @@ Q_SIGNALS: void fullScreenChanged(); void transientChanged(); void modalChanged(); - void shadeChanged(); void minimizedChanged(); void moveResizedChanged(); void skipTaskbarChanged(); @@ -991,11 +979,6 @@ inline bool Client::isHiddenInternal() const return hidden; } -inline bool Client::isShade() const -{ - return shade_mode == ShadeNormal; -} - inline ShadeMode Client::shadeMode() const { return shade_mode;