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
icc-effect-5.14.5
Martin Gräßlin 2015-03-13 13:39:53 +01:00
parent 254887155c
commit a4d16debfc
4 changed files with 49 additions and 26 deletions

View File

@ -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;
}
}

View File

@ -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();

View File

@ -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())

View File

@ -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;