diff --git a/scene.cpp b/scene.cpp index 939f000f0c..6a3aaeb26a 100644 --- a/scene.cpp +++ b/scene.cpp @@ -385,6 +385,8 @@ void Scene::paintWindow(Window* w, int mask, QRegion region, WindowQuadList quad EffectWindowImpl *thumb = it.value().data(); WindowPaintData thumbData(thumb); thumbData.setOpacity(data.opacity()); + thumbData.setBrightness(data.brightness() * item->brightness()); + thumbData.setSaturation(data.saturation() * item->saturation()); const QRect visualThumbRect(thumb->expandedGeometry()); diff --git a/thumbnailitem.cpp b/thumbnailitem.cpp index 66b665a685..4d10501f18 100644 --- a/thumbnailitem.cpp +++ b/thumbnailitem.cpp @@ -39,6 +39,8 @@ ThumbnailItem::ThumbnailItem(QDeclarativeItem* parent) , m_clip(true) , m_parent(QWeakPointer()) , m_parentWindow(0) + , m_brightness(1.0) + , m_saturation(1.0) { setFlags(flags() & ~QGraphicsItem::ItemHasNoContents); Q_ASSERT(Compositor::isCreated()); @@ -152,4 +154,24 @@ void ThumbnailItem::repaint(KWin::EffectWindow *w) } } +void ThumbnailItem::setBrightness(qreal brightness) +{ + if (qFuzzyCompare(brightness, m_brightness)) { + return; + } + m_brightness = brightness; + update(); + emit brightnessChanged(); +} + +void ThumbnailItem::setSaturation(qreal saturation) +{ + if (qFuzzyCompare(saturation, m_saturation)) { + return; + } + m_saturation = saturation; + update(); + emit saturationChanged(); +} + } // namespace KWin diff --git a/thumbnailitem.h b/thumbnailitem.h index f7dc4fe621..5be10754da 100644 --- a/thumbnailitem.h +++ b/thumbnailitem.h @@ -36,6 +36,8 @@ class ThumbnailItem : public QDeclarativeItem Q_PROPERTY(qulonglong wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true) Q_PROPERTY(bool clip READ isClip WRITE setClip NOTIFY clipChanged SCRIPTABLE true) Q_PROPERTY(qulonglong parentWindow READ parentWindow WRITE setParentWindow) + Q_PROPERTY(qreal brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged) + Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation NOTIFY saturationChanged) public: explicit ThumbnailItem(QDeclarativeItem *parent = 0); virtual ~ThumbnailItem(); @@ -53,9 +55,18 @@ public: return m_parentWindow; } void setParentWindow(qulonglong parentWindow); + qreal brightness() const; + qreal saturation() const; + +public Q_SLOTS: + void setBrightness(qreal brightness); + void setSaturation(qreal saturation); + Q_SIGNALS: void wIdChanged(qulonglong wid); void clipChanged(bool clipped); + void brightnessChanged(); + void saturationChanged(); private Q_SLOTS: void init(); void effectWindowAdded(); @@ -67,8 +78,22 @@ private: bool m_clip; QWeakPointer m_parent; qulonglong m_parentWindow; + qreal m_brightness; + qreal m_saturation; }; +inline +qreal ThumbnailItem::brightness() const +{ + return m_brightness; +} + +inline +qreal ThumbnailItem::saturation() const +{ + return m_saturation; +} + } // KWin #endif // KWIN_THUMBNAILITEM_H