Pass creation of Scene::EffectFrame to the Scene
Instead of having the EffectFrameImpl check the compositor type and do the decision which Scene::EffectFrame to create, a pure virtual method in Scene is called which returns the specific Scene::EffectFrame.
This commit is contained in:
parent
9b0c6ddef3
commit
5d3d8834ab
6 changed files with 19 additions and 11 deletions
12
effects.cpp
12
effects.cpp
|
@ -31,7 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "cursor.h"
|
||||
#include "group.h"
|
||||
#include "scene_xrender.h"
|
||||
#include "scene_opengl.h"
|
||||
#include "unmanaged.h"
|
||||
#ifdef KWIN_BUILD_TABBOX
|
||||
#include "tabbox.h"
|
||||
|
@ -1891,16 +1890,7 @@ EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint
|
|||
m_selection.setCacheAllRenderedFrames(true);
|
||||
m_selection.setEnabledBorders(Plasma::FrameSvg::AllBorders);
|
||||
|
||||
if (effects->isOpenGLCompositing()) {
|
||||
m_sceneFrame = new SceneOpenGL::EffectFrame(this, static_cast<SceneOpenGL*>(Compositor::self()->scene()));
|
||||
} else if (effects->compositingType() == XRenderCompositing) {
|
||||
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
|
||||
m_sceneFrame = new SceneXrender::EffectFrame(this);
|
||||
#endif
|
||||
} else {
|
||||
// that should not happen and will definitely crash!
|
||||
m_sceneFrame = NULL;
|
||||
}
|
||||
m_sceneFrame = Compositor::self()->scene()->createEffectFrame(this);
|
||||
}
|
||||
|
||||
EffectFrameImpl::~EffectFrameImpl()
|
||||
|
|
6
scene.h
6
scene.h
|
@ -66,6 +66,12 @@ public:
|
|||
|
||||
// a new window has been created
|
||||
virtual void windowAdded(Toplevel*) = 0;
|
||||
/**
|
||||
* @brief Creates the Scene backend of an EffectFrame.
|
||||
*
|
||||
* @param frame The EffectFrame this Scene::EffectFrame belongs to.
|
||||
*/
|
||||
virtual Scene::EffectFrame *createEffectFrame(EffectFrameImpl *frame) = 0;
|
||||
/**
|
||||
* Method invoked when the screen geometry is changed.
|
||||
* Reimplementing classes should also invoke the parent method
|
||||
|
|
|
@ -636,6 +636,11 @@ void SceneOpenGL::doneOpenGLContextCurrent()
|
|||
m_backend->doneCurrent();
|
||||
}
|
||||
|
||||
Scene::EffectFrame *SceneOpenGL::createEffectFrame(EffectFrameImpl *frame)
|
||||
{
|
||||
return new SceneOpenGL::EffectFrame(frame, this);
|
||||
}
|
||||
|
||||
//****************************************
|
||||
// SceneOpenGL2
|
||||
//****************************************
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
virtual qint64 paint(QRegion damage, ToplevelList windows);
|
||||
virtual void windowAdded(Toplevel*);
|
||||
virtual void windowDeleted(Deleted*);
|
||||
virtual Scene::EffectFrame *createEffectFrame(EffectFrameImpl *frame);
|
||||
virtual void screenGeometryChanged(const QSize &size);
|
||||
virtual OverlayWindow *overlayWindow();
|
||||
virtual bool blocksForRetrace() const;
|
||||
|
|
|
@ -288,6 +288,11 @@ void SceneXrender::windowAdded(Toplevel* c)
|
|||
windows[ c ]->updateShadow(c->shadow());
|
||||
}
|
||||
|
||||
Scene::EffectFrame *SceneXrender::createEffectFrame(EffectFrameImpl *frame)
|
||||
{
|
||||
return new SceneXrender::EffectFrame(frame);
|
||||
}
|
||||
|
||||
//****************************************
|
||||
// SceneXrender::Window
|
||||
//****************************************
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
virtual qint64 paint(QRegion damage, ToplevelList windows);
|
||||
virtual void windowAdded(Toplevel*);
|
||||
virtual void windowDeleted(Deleted*);
|
||||
virtual Scene::EffectFrame *createEffectFrame(EffectFrameImpl *frame);
|
||||
virtual void screenGeometryChanged(const QSize &size);
|
||||
xcb_render_picture_t bufferPicture();
|
||||
virtual OverlayWindow *overlayWindow() {
|
||||
|
|
Loading…
Reference in a new issue