Effects Hook to paint a desktop
A specialised paintScreen method to render all windows of one desktop. It's intended to be called during an already started paintScreen process to get e.g. a thumbnail of a desktop. Currently not yet exported to the Effects.
This commit is contained in:
parent
8037e6529c
commit
ae7be07d0f
3 changed files with 45 additions and 2 deletions
18
effects.cpp
18
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<Effect*>::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()) {
|
||||
|
|
19
effects.h
19
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<EffectWindow*> 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
|
||||
|
|
|
@ -589,8 +589,14 @@ void Scene::Window::resetPaintingEnabled()
|
|||
disable_painting = 0;
|
||||
if (toplevel->isDeleted())
|
||||
disable_painting |= PAINT_DISABLED_BY_DELETE;
|
||||
if (static_cast<EffectsHandlerImpl*>(effects)->isDesktopRendering()) {
|
||||
if (!toplevel->isOnDesktop(static_cast<EffectsHandlerImpl*>(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()) {
|
||||
|
|
Loading…
Reference in a new issue