diff --git a/bridge.cpp b/bridge.cpp index 117b8b8551..08f3feb9ad 100644 --- a/bridge.cpp +++ b/bridge.cpp @@ -62,6 +62,11 @@ QIconSet Bridge::icon() const return QIconSet( c->miniIcon(), c->icon()); } +bool Bridge::isSetShade() const + { + return c->shadeMode() != Client::ShadeNone; + } + void Bridge::showWindowMenu( QPoint p ) { c->workspace()->showWindowMenu( p, c ); diff --git a/bridge.h b/bridge.h index 76bb294b1d..a5a1667c6d 100644 --- a/bridge.h +++ b/bridge.h @@ -32,6 +32,7 @@ class Bridge : public KDecorationBridge virtual bool isModal() const; virtual bool isShadeable() const; virtual bool isShade() const; + virtual bool isSetShade() const; virtual bool keepAbove() const; virtual bool keepBelow() const; virtual bool isMovable() const; diff --git a/client.h b/client.h index 8bfe029eed..7635685c17 100644 --- a/client.h +++ b/client.h @@ -117,7 +117,8 @@ class Client : public QObject, public KDecorationDefines ShadeHover, // "shaded", but visible due to hover unshade ShadeActivated // "shaded", but visible due to alt+tab to the window }; - bool isShade() const; + bool isShade() const; // true only for ShadeNormal + ShadeMode shadeMode() const; // prefer isShade() void setShade( ShadeMode mode ); bool isShadeable() const; @@ -612,6 +613,12 @@ bool Client::isShade() const return shade_mode == ShadeNormal; } +inline +Client::ShadeMode Client::shadeMode() const + { + return shade_mode; + } + inline QPixmap Client::icon() const { return icon_pix; diff --git a/kcmkwin/kwindecoration/preview.cpp b/kcmkwin/kwindecoration/preview.cpp index 6e26aedb92..b9d9540107 100644 --- a/kcmkwin/kwindecoration/preview.cpp +++ b/kcmkwin/kwindecoration/preview.cpp @@ -256,6 +256,11 @@ bool KDecorationPreviewBridge::isShade() const return false; } +bool KDecorationPreviewBridge::isSetShade() const + { + return false; + } + bool KDecorationPreviewBridge::keepAbove() const { return false; diff --git a/kcmkwin/kwindecoration/preview.h b/kcmkwin/kwindecoration/preview.h index 13e1483cbf..5044dcc114 100644 --- a/kcmkwin/kwindecoration/preview.h +++ b/kcmkwin/kwindecoration/preview.h @@ -75,6 +75,7 @@ class KDecorationPreviewBridge virtual bool isModal() const; virtual bool isShadeable() const; virtual bool isShade() const; + virtual bool isSetShade() const; virtual bool keepAbove() const; virtual bool keepBelow() const; virtual bool isMovable() const; diff --git a/lib/kdecoration.cpp b/lib/kdecoration.cpp index a3cf08537a..c87c80b326 100644 --- a/lib/kdecoration.cpp +++ b/lib/kdecoration.cpp @@ -128,6 +128,11 @@ bool KDecoration::isShade() const return bridge_->isShade(); } +bool KDecoration::isSetShade() const + { + return bridge_->isSetShade(); + } + bool KDecoration::keepAbove() const { return bridge_->keepAbove(); diff --git a/lib/kdecoration.h b/lib/kdecoration.h index b75d72465d..c1f1cab9ec 100644 --- a/lib/kdecoration.h +++ b/lib/kdecoration.h @@ -326,8 +326,19 @@ class KDecoration bool isShadeable() const; /** * Returns @a true if the decorated window is currently shaded. + * If the window is e.g. hover unshaded, it's not considered to be shaded. + * + * @see isSetShade */ bool isShade() const; + /** + * Returns @a true if the decorated window was set to be shaded. This function + * returns also true if the window is e.g. hover unshaded, so it doesn't + * always correspond to the actual window state. + * + * @see isShade + */ + bool isSetShade() const; /** * Returns @a true if the decorated window should be kept above other windows. */ diff --git a/lib/kdecoration_p.h b/lib/kdecoration_p.h index 5728528277..24cabd9c93 100644 --- a/lib/kdecoration_p.h +++ b/lib/kdecoration_p.h @@ -69,6 +69,7 @@ class KDecorationBridge : public KDecorationDefines virtual bool isModal() const = 0; virtual bool isShadeable() const = 0; virtual bool isShade() const = 0; + virtual bool isSetShade() const = 0; virtual bool keepAbove() const = 0; virtual bool keepBelow() const = 0; virtual bool isMovable() const = 0; diff --git a/useractions.cpp b/useractions.cpp index d08073acc5..629d8a7ec6 100644 --- a/useractions.cpp +++ b/useractions.cpp @@ -103,8 +103,8 @@ void Workspace::clientPopupAboutToShow() popup->setItemEnabled( Options::MoveOp, popup_client->isMovable() ); popup->setItemEnabled( Options::MaximizeOp, popup_client->isMaximizable() ); popup->setItemChecked( Options::MaximizeOp, popup_client->maximizeMode() == Client::MaximizeFull ); - // TODO this doesn't show it's shaded when it's hovered or activated - popup->setItemChecked( Options::ShadeOp, popup_client->isShade() ); + // This should be checked also when hover unshaded + popup->setItemChecked( Options::ShadeOp, popup_client->shadeMode() != Client::ShadeNone ); popup->setItemEnabled( Options::ShadeOp, popup_client->isShadeable()); options_popup->setItemChecked( Options::KeepAboveOp, popup_client->keepAbove() ); options_popup->setItemChecked( Options::KeepBelowOp, popup_client->keepBelow() );