From 98cc15cfac4866401173fdc719f6b4d240d2820e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 28 Apr 2011 13:46:32 +0200 Subject: [PATCH] Allow effects to render the outline --- effects.cpp | 10 ++++++++++ effects.h | 2 ++ libkwineffects/kwineffects.h | 19 ++++++++++++++++++- outline.cpp | 9 +++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/effects.cpp b/effects.cpp index f9fadb48cc..32811fcd07 100644 --- a/effects.cpp +++ b/effects.cpp @@ -1159,6 +1159,16 @@ EffectFrame* EffectsHandlerImpl::effectFrame(EffectFrameStyle style, bool static return new EffectFrameImpl(style, staticSize, position, alignment); } +void EffectsHandlerImpl::slotShowOutline(const QRect& geometry) +{ + emit showOutline(geometry); +} + +void EffectsHandlerImpl::slotHideOutline() +{ + emit hideOutline(); +} + //**************************************** // EffectWindowImpl //**************************************** diff --git a/effects.h b/effects.h index 66b9ad66f5..382d60ab41 100644 --- a/effects.h +++ b/effects.h @@ -171,6 +171,8 @@ public Q_SLOTS: void slotClientGroupItemSwitched(EffectWindow* from, EffectWindow* to); void slotClientGroupItemAdded(EffectWindow* from, EffectWindow* to); void slotClientGroupItemRemoved(EffectWindow* c, EffectWindow* group); + void slotShowOutline(const QRect &geometry); + void slotHideOutline(); protected Q_SLOTS: void slotDesktopChanged(int old); diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index 61a5c2099f..44079b4d49 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -330,7 +330,8 @@ public: }; enum Feature { - Nothing = 0, Resize, GeometryTip + Nothing = 0, Resize, GeometryTip, + Outline }; /** @@ -980,6 +981,22 @@ Q_SIGNALS: * @since 4.7 */ void propertyNotify(EffectWindow* w, long atom); + /** + * Requests to show an outline. An effect providing to show an outline should + * connect to the signal and render an outline. + * The outline should be shown till the signal is emitted again with a new + * geometry or the @link hideOutline signal is emitted. + * @param outline The geometry of the outline to render. + * @see hideOutline + * @since 4.7 + **/ + void showOutline(const QRect& outline); + /** + * Signal emitted when the outline should no longer be shown. + * @see showOutline + * @since 4.7 + **/ + void hideOutline(); protected: QVector< EffectPair > loaded_effects; diff --git a/outline.cpp b/outline.cpp index 9b5581c436..1654cfc54a 100644 --- a/outline.cpp +++ b/outline.cpp @@ -19,6 +19,7 @@ along with this program. If not, see . *********************************************************************/ #include "outline.h" +#include "effects.h" #include #include #include @@ -43,11 +44,19 @@ Outline::~Outline() void Outline::show() { + if (effects && static_cast(effects)->provides(Effect::Outline)) { + static_cast(effects)->slotShowOutline(m_outlineGeometry); + return; // done by effect + } showWithX(); } void Outline::hide() { + if (effects && static_cast(effects)->provides(Effect::Outline)) { + static_cast(effects)->slotHideOutline(); + return; // done by effect + } hideWithX(); }