Pass Compositor to EffectsHandlerImpl
Obsoletes the need to go through the Workspace object to get to the Compositor. TODO for future: make the Compositor being the parent object for the EffectsHandlerImpl. Closing Review and bug from this commit, which is the top most of the patch series. REVIEW: 106060 BUG: 299277 FIXED-IN: 4.10
This commit is contained in:
parent
62c4d449f5
commit
8e5b2ae1aa
3 changed files with 15 additions and 12 deletions
|
@ -214,7 +214,7 @@ void Compositor::slotCompositingOptionsInitialized()
|
|||
m_timeSinceLastVBlank = fpsInterval - 1; // means "start now" - we don't have even a slight idea when the first vsync will occur
|
||||
scheduleRepaint();
|
||||
XCompositeRedirectSubwindows(display(), rootWindow(), CompositeRedirectManual);
|
||||
new EffectsHandlerImpl(m_scene); // sets also the 'effects' pointer
|
||||
new EffectsHandlerImpl(this, m_scene); // sets also the 'effects' pointer
|
||||
connect(effects, SIGNAL(screenGeometryChanged(QSize)), SLOT(addRepaintFull()));
|
||||
addRepaintFull();
|
||||
foreach (Client * c, Workspace::self()->clientList())
|
||||
|
|
21
effects.cpp
21
effects.cpp
|
@ -96,12 +96,13 @@ static void deleteWindowProperty(Window win, long int atom)
|
|||
|
||||
//---------------------
|
||||
|
||||
EffectsHandlerImpl::EffectsHandlerImpl(Scene *scene)
|
||||
EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
|
||||
: EffectsHandler(scene->compositingType())
|
||||
, keyboard_grab_effect(NULL)
|
||||
, fullscreen_effect(0)
|
||||
, next_window_quad_type(EFFECT_QUAD_TYPE_START)
|
||||
, mouse_poll_ref_count(0)
|
||||
, m_compositor(compositor)
|
||||
, m_scene(scene)
|
||||
{
|
||||
// init is important, otherwise causes crashes when quads are build before the first painting pass start
|
||||
|
@ -511,7 +512,7 @@ void EffectsHandlerImpl::slotPaddingChanged(Toplevel* t, const QRect& old)
|
|||
void EffectsHandlerImpl::setActiveFullScreenEffect(Effect* e)
|
||||
{
|
||||
fullscreen_effect = e;
|
||||
Workspace::self()->compositor()->checkUnredirect();
|
||||
m_compositor->checkUnredirect();
|
||||
}
|
||||
|
||||
Effect* EffectsHandlerImpl::activeFullScreenEffect() const
|
||||
|
@ -567,7 +568,7 @@ void* EffectsHandlerImpl::getProxy(QString name)
|
|||
void EffectsHandlerImpl::startMousePolling()
|
||||
{
|
||||
if (!mouse_poll_ref_count) // Start timer if required
|
||||
Workspace::self()->compositor()->startMousePolling();
|
||||
m_compositor->startMousePolling();
|
||||
mouse_poll_ref_count++;
|
||||
}
|
||||
|
||||
|
@ -576,7 +577,7 @@ void EffectsHandlerImpl::stopMousePolling()
|
|||
assert(mouse_poll_ref_count);
|
||||
mouse_poll_ref_count--;
|
||||
if (!mouse_poll_ref_count) // Stop timer if required
|
||||
Workspace::self()->compositor()->stopMousePolling();
|
||||
m_compositor->stopMousePolling();
|
||||
}
|
||||
|
||||
bool EffectsHandlerImpl::hasKeyboardGrab() const
|
||||
|
@ -909,22 +910,22 @@ EffectWindow* EffectsHandlerImpl::currentTabBoxWindow() const
|
|||
|
||||
void EffectsHandlerImpl::addRepaintFull()
|
||||
{
|
||||
Workspace::self()->compositor()->addRepaintFull();
|
||||
m_compositor->addRepaintFull();
|
||||
}
|
||||
|
||||
void EffectsHandlerImpl::addRepaint(const QRect& r)
|
||||
{
|
||||
Workspace::self()->compositor()->addRepaint(r);
|
||||
m_compositor->addRepaint(r);
|
||||
}
|
||||
|
||||
void EffectsHandlerImpl::addRepaint(const QRegion& r)
|
||||
{
|
||||
Workspace::self()->compositor()->addRepaint(r);
|
||||
m_compositor->addRepaint(r);
|
||||
}
|
||||
|
||||
void EffectsHandlerImpl::addRepaint(int x, int y, int w, int h)
|
||||
{
|
||||
Workspace::self()->compositor()->addRepaint(x, y, w, h);
|
||||
m_compositor->addRepaint(x, y, w, h);
|
||||
}
|
||||
|
||||
int EffectsHandlerImpl::activeScreen() const
|
||||
|
@ -1192,7 +1193,7 @@ QStringList EffectsHandlerImpl::listOfEffects() const
|
|||
|
||||
bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault)
|
||||
{
|
||||
Workspace::self()->compositor()->addRepaintFull();
|
||||
m_compositor->addRepaintFull();
|
||||
|
||||
if (!name.startsWith(QLatin1String("kwin4_effect_")))
|
||||
kWarning(1212) << "Effect names usually have kwin4_effect_ prefix" ;
|
||||
|
@ -1330,7 +1331,7 @@ bool EffectsHandlerImpl::loadScriptedEffect(const QString& name, KService *servi
|
|||
|
||||
void EffectsHandlerImpl::unloadEffect(const QString& name)
|
||||
{
|
||||
Workspace::self()->compositor()->addRepaintFull();
|
||||
m_compositor->addRepaintFull();
|
||||
|
||||
for (QMap< int, EffectPair >::iterator it = effect_order.begin(); it != effect_order.end(); ++it) {
|
||||
if (it.value().first == name) {
|
||||
|
|
|
@ -40,6 +40,7 @@ namespace KWin
|
|||
class ThumbnailItem;
|
||||
|
||||
class Client;
|
||||
class Compositor;
|
||||
class Deleted;
|
||||
class Unmanaged;
|
||||
|
||||
|
@ -47,7 +48,7 @@ class EffectsHandlerImpl : public EffectsHandler
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EffectsHandlerImpl(Scene *scene);
|
||||
EffectsHandlerImpl(Compositor *compositor, Scene *scene);
|
||||
virtual ~EffectsHandlerImpl();
|
||||
virtual void prePaintScreen(ScreenPrePaintData& data, int time);
|
||||
virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data);
|
||||
|
@ -228,6 +229,7 @@ private:
|
|||
QList< Effect* >::iterator m_currentPaintEffectFrameIterator;
|
||||
QList< Effect* >::iterator m_currentPaintScreenIterator;
|
||||
QList< Effect* >::iterator m_currentBuildQuadsIterator;
|
||||
Compositor *m_compositor;
|
||||
Scene *m_scene;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue