diff --git a/effects.cpp b/effects.cpp index 7deac29816..4443c5ba9f 100644 --- a/effects.cpp +++ b/effects.cpp @@ -215,6 +215,8 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene) , m_compositor(compositor) , m_scene(scene) , m_screenLockerWatcher(new ScreenLockerWatcher(this)) + , m_desktopRendering(false) + , m_currentRenderedDesktop(0) { new EffectsAdaptor(this); QDBusConnection dbus = QDBusConnection::sessionBus(); @@ -373,6 +375,22 @@ void EffectsHandlerImpl::paintScreen(int mask, QRegion region, ScreenPaintData& m_scene->finalPaintScreen(mask, region, data); } +void EffectsHandlerImpl::paintDesktop(int desktop, int mask, QRegion region, ScreenPaintData &data) +{ + if (desktop < 1 || desktop > numberOfDesktops()) { + return; + } + m_currentRenderedDesktop = desktop; + m_desktopRendering = true; + // save the paint screen iterator + QList::iterator savedIterator = m_currentPaintScreenIterator; + m_currentPaintScreenIterator = m_activeEffects.begin(); + effects->paintScreen(mask, region, data); + // restore the saved iterator + m_currentPaintScreenIterator = savedIterator; + m_desktopRendering = false; +} + void EffectsHandlerImpl::postPaintScreen() { if (m_currentPaintScreenIterator != m_activeEffects.end()) { diff --git a/effects.h b/effects.h index 742aa59fb6..3ecad8ebac 100644 --- a/effects.h +++ b/effects.h @@ -61,6 +61,10 @@ public: virtual ~EffectsHandlerImpl(); virtual void prePaintScreen(ScreenPrePaintData& data, int time); virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data); + /** + * Special hook to perform a paintScreen but just with the windows on @p desktop. + **/ + void paintDesktop(int desktop, int mask, QRegion region, ScreenPaintData& data); virtual void postPaintScreen(); virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time); virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); @@ -180,6 +184,19 @@ public: QList elevatedWindows() const; QStringList activeEffects() const; + /** + * @returns Whether we are currently in a desktop rendering process triggered by paintDesktop hook + **/ + bool isDesktopRendering() const { + return m_desktopRendering; + } + /** + * @returns the desktop currently being rendered in the paintDesktop hook. + **/ + int currentRenderedDesktop() const { + return m_currentRenderedDesktop; + } + public Q_SLOTS: void slotCurrentTabAboutToChange(EffectWindow* from, EffectWindow* to); void slotTabAdded(EffectWindow* from, EffectWindow* to); @@ -248,6 +265,8 @@ private: Scene *m_scene; QList< InputWindowPair > input_windows; ScreenLockerWatcher *m_screenLockerWatcher; + bool m_desktopRendering; + int m_currentRenderedDesktop; }; class EffectWindowImpl : public EffectWindow diff --git a/scene.cpp b/scene.cpp index 93a3305287..4f0a4b7c36 100644 --- a/scene.cpp +++ b/scene.cpp @@ -589,8 +589,14 @@ void Scene::Window::resetPaintingEnabled() disable_painting = 0; if (toplevel->isDeleted()) disable_painting |= PAINT_DISABLED_BY_DELETE; - if (!toplevel->isOnCurrentDesktop()) - disable_painting |= PAINT_DISABLED_BY_DESKTOP; + if (static_cast(effects)->isDesktopRendering()) { + if (!toplevel->isOnDesktop(static_cast(effects)->currentRenderedDesktop())) { + disable_painting |= PAINT_DISABLED_BY_DESKTOP; + } + } else { + if (!toplevel->isOnCurrentDesktop()) + disable_painting |= PAINT_DISABLED_BY_DESKTOP; + } if (!toplevel->isOnCurrentActivity()) disable_painting |= PAINT_DISABLED_BY_ACTIVITY; if (toplevel->isClient()) {