Allow effects to render the outline

This commit is contained in:
Martin Gräßlin 2011-04-28 13:46:32 +02:00
parent 022d7a32a0
commit 98cc15cfac
4 changed files with 39 additions and 1 deletions

View file

@ -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
//****************************************

View file

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

View file

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

View file

@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "outline.h"
#include "effects.h"
#include <QtCore/QRect>
#include <QtGui/QX11Info>
#include <QtGui/QPainter>
@ -43,11 +44,19 @@ Outline::~Outline()
void Outline::show()
{
if (effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::Outline)) {
static_cast<EffectsHandlerImpl*>(effects)->slotShowOutline(m_outlineGeometry);
return; // done by effect
}
showWithX();
}
void Outline::hide()
{
if (effects && static_cast<EffectsHandlerImpl*>(effects)->provides(Effect::Outline)) {
static_cast<EffectsHandlerImpl*>(effects)->slotHideOutline();
return; // done by effect
}
hideWithX();
}