diff --git a/client.cpp b/client.cpp index cf35783b9c..07ffe03127 100644 --- a/client.cpp +++ b/client.cpp @@ -617,7 +617,7 @@ void Client::resizeDecorationPixmaps() XFreePixmap(display(), decorationPixmapTop.handle()); } - if (effects->compositingType() == OpenGLCompositing) { + if (effects->isOpenGLCompositing()) { decorationPixmapTop = QPixmap(tr.size()); m_responsibleForDecoPixmap = false; } else { @@ -636,7 +636,7 @@ void Client::resizeDecorationPixmaps() XFreePixmap(display(), decorationPixmapBottom.handle()); } - if (effects->compositingType() == OpenGLCompositing) { + if (effects->isOpenGLCompositing()) { decorationPixmapBottom = QPixmap(br.size()); m_responsibleForDecoPixmap = false; } else { @@ -655,7 +655,7 @@ void Client::resizeDecorationPixmaps() XFreePixmap(display(), decorationPixmapLeft.handle()); } - if (effects->compositingType() == OpenGLCompositing) { + if (effects->isOpenGLCompositing()) { decorationPixmapLeft = QPixmap(lr.size()); m_responsibleForDecoPixmap = false; } else { @@ -674,7 +674,7 @@ void Client::resizeDecorationPixmaps() XFreePixmap(display(), decorationPixmapRight.handle()); } - if (effects->compositingType() == OpenGLCompositing) { + if (effects->isOpenGLCompositing()) { decorationPixmapRight = QPixmap(rr.size()); m_responsibleForDecoPixmap = false; } else { diff --git a/composite.cpp b/composite.cpp index 11958961a7..ed2e26475b 100644 --- a/composite.cpp +++ b/composite.cpp @@ -742,15 +742,13 @@ QString Compositor::compositingType() const switch (m_scene->compositingType()) { case XRenderCompositing: return "xrender"; - case OpenGLCompositing: + case OpenGL1Compositing: + return "gl1"; + case OpenGL2Compositing: #ifdef KWIN_HAVE_OPENGLES return "gles"; #else - if (ShaderManager::instance()->isValid()) { - return "gl2"; - } else { - return "gl1"; - } + return "gl2"; #endif case NoCompositing: default: diff --git a/effects.cpp b/effects.cpp index e97e92a465..124a906ed6 100644 --- a/effects.cpp +++ b/effects.cpp @@ -1685,7 +1685,7 @@ EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint m_selection.setCacheAllRenderedFrames(true); m_selection.setEnabledBorders(Plasma::FrameSvg::AllBorders); - if (effects->compositingType() == OpenGLCompositing) { + if (effects->isOpenGLCompositing()) { m_sceneFrame = new SceneOpenGL::EffectFrame(this, static_cast(Compositor::self()->scene())); } else if (effects->compositingType() == XRenderCompositing) { #ifdef KWIN_HAVE_XRENDER_COMPOSITING diff --git a/effects/coverswitch/coverswitch.cpp b/effects/coverswitch/coverswitch.cpp index 22c9576a69..496bda2763 100644 --- a/effects/coverswitch/coverswitch.cpp +++ b/effects/coverswitch/coverswitch.cpp @@ -84,7 +84,7 @@ CoverSwitchEffect::~CoverSwitchEffect() bool CoverSwitchEffect::supported() { - return effects->compositingType() == OpenGLCompositing; + return effects->isOpenGLCompositing(); } void CoverSwitchEffect::reconfigure(ReconfigureFlags) diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index 4b1391776d..392ae54f13 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -115,7 +115,7 @@ CubeEffect::CubeEffect() bool CubeEffect::supported() { - return effects->compositingType() == OpenGLCompositing; + return effects->isOpenGLCompositing(); } void CubeEffect::reconfigure(ReconfigureFlags) @@ -294,7 +294,7 @@ void CubeEffect::slotWallPaperLoaded() bool CubeEffect::loadShader() { if (!(GLPlatform::instance()->supports(GLSL) && - (effects->compositingType() == OpenGLCompositing))) + (effects->compositingType() == OpenGL2Compositing))) return false; QString fragmentshader = KGlobal::dirs()->findResource("data", "kwin/cylinder.frag"); QString cylinderVertexshader = KGlobal::dirs()->findResource("data", "kwin/cylinder.vert"); diff --git a/effects/cube/cubeslide.cpp b/effects/cube/cubeslide.cpp index 1d0f02fc73..77f860457d 100644 --- a/effects/cube/cubeslide.cpp +++ b/effects/cube/cubeslide.cpp @@ -51,7 +51,7 @@ CubeSlideEffect::~CubeSlideEffect() bool CubeSlideEffect::supported() { - return effects->compositingType() == OpenGLCompositing; + return effects->isOpenGLCompositing(); } void CubeSlideEffect::reconfigure(ReconfigureFlags) diff --git a/effects/explosion/explosion.cpp b/effects/explosion/explosion.cpp index 15fdc6e0a1..adf9bc3695 100644 --- a/effects/explosion/explosion.cpp +++ b/effects/explosion/explosion.cpp @@ -60,11 +60,7 @@ ExplosionEffect::~ExplosionEffect() bool ExplosionEffect::supported() { - if (effects->compositingType() == OpenGLCompositing) { - return ShaderManager::instance()->isValid(); - } else { - return false; - } + return effects->compositingType() == OpenGL2Compositing; } bool ExplosionEffect::loadData() diff --git a/effects/flipswitch/flipswitch.cpp b/effects/flipswitch/flipswitch.cpp index a88a6d3933..223ae8ec64 100644 --- a/effects/flipswitch/flipswitch.cpp +++ b/effects/flipswitch/flipswitch.cpp @@ -90,7 +90,7 @@ FlipSwitchEffect::~FlipSwitchEffect() bool FlipSwitchEffect::supported() { - return effects->compositingType() == OpenGLCompositing; + return effects->isOpenGLCompositing(); } void FlipSwitchEffect::reconfigure(ReconfigureFlags) diff --git a/effects/glide/glide.cpp b/effects/glide/glide.cpp index 540844fece..f2c8426f42 100644 --- a/effects/glide/glide.cpp +++ b/effects/glide/glide.cpp @@ -54,7 +54,7 @@ GlideEffect::~GlideEffect() bool GlideEffect::supported() { - return effects->compositingType() == OpenGLCompositing; + return effects->isOpenGLCompositing(); } void GlideEffect::reconfigure(ReconfigureFlags) diff --git a/effects/invert/invert.cpp b/effects/invert/invert.cpp index 258e2ecadd..80fa1dea36 100644 --- a/effects/invert/invert.cpp +++ b/effects/invert/invert.cpp @@ -64,11 +64,7 @@ InvertEffect::~InvertEffect() bool InvertEffect::supported() { - if (effects->compositingType() == OpenGLCompositing) { - return ShaderManager::instance()->isValid(); - } else { - return false; - } + return effects->compositingType() == OpenGL2Compositing; } bool InvertEffect::loadData() diff --git a/effects/logout/logout.cpp b/effects/logout/logout.cpp index a78460d1bb..450bab5fc2 100644 --- a/effects/logout/logout.cpp +++ b/effects/logout/logout.cpp @@ -105,7 +105,7 @@ void LogoutEffect::prePaintScreen(ScreenPrePaintData& data, int time) } else if (!blurTexture) { blurSupported = false; delete blurTarget; // catch as we just tested the texture ;-P - if (effects->compositingType() == OpenGLCompositing && GLTexture::NPOTTextureSupported() && GLRenderTarget::blitSupported() && useBlur) { + if (effects->isOpenGLCompositing() && GLTexture::NPOTTextureSupported() && GLRenderTarget::blitSupported() && useBlur) { // TODO: It seems that it is not possible to create a GLRenderTarget that has // a different size than the display right now. Most likely a KWin core bug. // Create texture and render target @@ -143,7 +143,7 @@ void LogoutEffect::prePaintScreen(ScreenPrePaintData& data, int time) void LogoutEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) { if (progress > 0.0) { - if (effects->compositingType() == KWin::OpenGLCompositing) { + if (effects->isOpenGLCompositing()) { // In OpenGL mode we add vignetting and, if supported, a slight blur if (blurSupported) { // When using blur we render everything to an FBO and as such don't do the vignetting @@ -192,7 +192,7 @@ void LogoutEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) { effects->paintScreen(mask, region, data); - if (effects->compositingType() == KWin::OpenGLCompositing && progress > 0.0) { + if (effects->isOpenGLCompositing() && progress > 0.0) { if (!blurSupported) { if (!logoutWindowPassed) // The logout window has been deleted but we still want to fade out the vignetting, thus diff --git a/effects/lookingglass/lookingglass.cpp b/effects/lookingglass/lookingglass.cpp index c532fe1a3d..4b58178482 100644 --- a/effects/lookingglass/lookingglass.cpp +++ b/effects/lookingglass/lookingglass.cpp @@ -81,11 +81,7 @@ LookingGlassEffect::~LookingGlassEffect() bool LookingGlassEffect::supported() { - if (effects->compositingType() == OpenGLCompositing) { - return ShaderManager::instance()->isValid() && GLRenderTarget::supported(); - } else { - return false; - } + return effects->compositingType() == OpenGL2Compositing; } void LookingGlassEffect::reconfigure(ReconfigureFlags) diff --git a/effects/magiclamp/magiclamp.cpp b/effects/magiclamp/magiclamp.cpp index c151ed1175..419a07677f 100644 --- a/effects/magiclamp/magiclamp.cpp +++ b/effects/magiclamp/magiclamp.cpp @@ -46,7 +46,7 @@ MagicLampEffect::MagicLampEffect() bool MagicLampEffect::supported() { - return effects->compositingType() == OpenGLCompositing; + return effects->isOpenGLCompositing(); } void MagicLampEffect::reconfigure(ReconfigureFlags) diff --git a/effects/magnifier/magnifier.cpp b/effects/magnifier/magnifier.cpp index 0103257fbd..69f3dafdf9 100644 --- a/effects/magnifier/magnifier.cpp +++ b/effects/magnifier/magnifier.cpp @@ -78,7 +78,7 @@ MagnifierEffect::~MagnifierEffect() bool MagnifierEffect::supported() { return effects->compositingType() == XRenderCompositing || - (effects->compositingType() == OpenGLCompositing && GLRenderTarget::blitSupported()); + (effects->isOpenGLCompositing() && GLRenderTarget::blitSupported()); } void MagnifierEffect::reconfigure(ReconfigureFlags) @@ -129,7 +129,7 @@ void MagnifierEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat QRect srcArea(cursor.x() - (double)area.width() / (zoom*2), cursor.y() - (double)area.height() / (zoom*2), (double)area.width() / zoom, (double)area.height() / zoom); - if (effects->compositingType() == OpenGLCompositing) { + if (effects->isOpenGLCompositing()) { m_fbo->blitFromFramebuffer(srcArea); // paint magnifier m_texture->bind(); diff --git a/effects/mousemark/mousemark.cpp b/effects/mousemark/mousemark.cpp index 0a3229b3ec..44d83e1585 100644 --- a/effects/mousemark/mousemark.cpp +++ b/effects/mousemark/mousemark.cpp @@ -107,7 +107,7 @@ void MouseMarkEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat effects->paintScreen(mask, region, data); // paint normal screen if (marks.isEmpty() && drawing.isEmpty()) return; - if ( effects->compositingType() == OpenGLCompositing) { + if ( effects->isOpenGLCompositing()) { #ifndef KWIN_HAVE_OPENGLES glEnable(GL_LINE_SMOOTH); #endif diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index 96d9a68a27..100d5ec0ab 100755 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -386,7 +386,7 @@ void PresentWindowsEffect::paintWindow(EffectWindow *w, int mask, QRegion region QPoint point(rect.x() + rect.width() * 0.95, rect.y() + rect.height() * 0.95); winData->iconFrame->setPosition(point); - if (effects->compositingType() == KWin::OpenGLCompositing && data.shader) { + if (effects->compositingType() == KWin::OpenGL2Compositing && data.shader) { const float a = 0.9 * data.opacity() * m_decalOpacity * 0.75; data.shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); } @@ -396,7 +396,7 @@ void PresentWindowsEffect::paintWindow(EffectWindow *w, int mask, QRegion region QPoint point(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2); winData->textFrame->setPosition(point); - if (effects->compositingType() == KWin::OpenGLCompositing && data.shader) { + if (effects->compositingType() == KWin::OpenGL2Compositing && data.shader) { const float a = 0.9 * data.opacity() * m_decalOpacity * 0.75; data.shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); } diff --git a/effects/resize/resize.cpp b/effects/resize/resize.cpp index 410b6748f6..625a9c40d9 100644 --- a/effects/resize/resize.cpp +++ b/effects/resize/resize.cpp @@ -82,7 +82,7 @@ void ResizeEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Window float alpha = 0.8f; QColor color = KColorScheme(QPalette::Normal, KColorScheme::Selection).background().color(); - if (effects->compositingType() == OpenGLCompositing) { + if (effects->isOpenGLCompositing()) { GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); vbo->reset(); vbo->setUseColor(true); diff --git a/effects/screenshot/screenshot.cpp b/effects/screenshot/screenshot.cpp index ea56e80c8b..4254c37b31 100644 --- a/effects/screenshot/screenshot.cpp +++ b/effects/screenshot/screenshot.cpp @@ -39,7 +39,7 @@ KWIN_EFFECT_SUPPORTED(screenshot, ScreenShotEffect::supported()) bool ScreenShotEffect::supported() { return effects->compositingType() == XRenderCompositing || - (effects->compositingType() == KWin::OpenGLCompositing && GLRenderTarget::supported()); + (effects->isOpenGLCompositing() && GLRenderTarget::supported()); } ScreenShotEffect::ScreenShotEffect() @@ -64,7 +64,7 @@ void ScreenShotEffect::postPaintScreen() bool validTarget = true; GLTexture* offscreenTexture = 0; GLRenderTarget* target = 0; - if (effects->compositingType() == KWin::OpenGLCompositing) { + if (effects->isOpenGLCompositing()) { if (!GLTexture::NPOTTextureSupported()) { w = nearestPowerOfTwo(w); h = nearestPowerOfTwo(h); @@ -114,7 +114,7 @@ void ScreenShotEffect::postPaintScreen() // render window into offscreen texture int mask = PAINT_WINDOW_TRANSFORMED | PAINT_WINDOW_TRANSLUCENT; QImage img; - if (effects->compositingType() == KWin::OpenGLCompositing) { + if (effects->isOpenGLCompositing()) { GLRenderTarget::pushRenderTarget(target); glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); @@ -209,7 +209,7 @@ QString ScreenShotEffect::blitScreenshot(const QRect &geometry) return QString(); #else QImage img; - if (effects->compositingType() == KWin::OpenGLCompositing) + if (effects->isOpenGLCompositing()) { if (!GLRenderTarget::blitSupported()) { kDebug(1212) << "Framebuffer Blit not supported"; diff --git a/effects/sheet/sheet.cpp b/effects/sheet/sheet.cpp index 58af9b4c0d..2e55ed448b 100644 --- a/effects/sheet/sheet.cpp +++ b/effects/sheet/sheet.cpp @@ -44,7 +44,7 @@ SheetEffect::SheetEffect() bool SheetEffect::supported() { - return effects->compositingType() == OpenGLCompositing; + return effects->isOpenGLCompositing(); } void SheetEffect::reconfigure(ReconfigureFlags) diff --git a/effects/showfps/showfps.cpp b/effects/showfps/showfps.cpp index b3dd9b7494..56df8b2bf2 100644 --- a/effects/showfps/showfps.cpp +++ b/effects/showfps/showfps.cpp @@ -156,7 +156,7 @@ void ShowFpsEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) ++fps; // count all frames in the last second if (fps > MAX_TIME) fps = MAX_TIME; // keep it the same height - if (effects->compositingType() == OpenGLCompositing) { + if (effects->isOpenGLCompositing()) { paintGL(fps); glFinish(); // make sure all rendering is done } @@ -327,7 +327,7 @@ void ShowFpsEffect::paintDrawSizeGraph(int x, int y) void ShowFpsEffect::paintGraph(int x, int y, QList values, QList lines, bool colorize) { - if (effects->compositingType() == OpenGLCompositing) { + if (effects->isOpenGLCompositing()) { QColor color(0, 0, 0); color.setAlphaF(alpha); GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); diff --git a/effects/showpaint/showpaint.cpp b/effects/showpaint/showpaint.cpp index c17178ce54..5e33fb67c2 100644 --- a/effects/showpaint/showpaint.cpp +++ b/effects/showpaint/showpaint.cpp @@ -55,7 +55,7 @@ void ShowPaintEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat { painted = QRegion(); effects->paintScreen(mask, region, data); - if (effects->compositingType() == OpenGLCompositing) + if (effects->isOpenGLCompositing()) paintGL(); #ifdef KWIN_HAVE_XRENDER_COMPOSITING if (effects->compositingType() == XRenderCompositing) diff --git a/effects/snaphelper/snaphelper.cpp b/effects/snaphelper/snaphelper.cpp index 7d4be144b4..f59d4a38c4 100644 --- a/effects/snaphelper/snaphelper.cpp +++ b/effects/snaphelper/snaphelper.cpp @@ -77,7 +77,7 @@ void SnapHelperEffect::postPaintScreen() effects->postPaintScreen(); if (m_timeline.currentValue() != 0.0) { // Display the guide - if (effects->compositingType() == OpenGLCompositing) { + if (effects->isOpenGLCompositing()) { GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); vbo->reset(); vbo->setUseColor(true); diff --git a/effects/startupfeedback/startupfeedback.cpp b/effects/startupfeedback/startupfeedback.cpp index cab7d43dcf..3d743bccdd 100644 --- a/effects/startupfeedback/startupfeedback.cpp +++ b/effects/startupfeedback/startupfeedback.cpp @@ -109,7 +109,7 @@ StartupFeedbackEffect::~StartupFeedbackEffect() bool StartupFeedbackEffect::supported() { - return effects->compositingType() == OpenGLCompositing; + return effects->isOpenGLCompositing(); } void StartupFeedbackEffect::reconfigure(Effect::ReconfigureFlags flags) diff --git a/effects/taskbarthumbnail/taskbarthumbnail.cpp b/effects/taskbarthumbnail/taskbarthumbnail.cpp index 0c67a3b84a..27988d011b 100644 --- a/effects/taskbarthumbnail/taskbarthumbnail.cpp +++ b/effects/taskbarthumbnail/taskbarthumbnail.cpp @@ -85,7 +85,7 @@ void TaskbarThumbnailEffect::paintWindow(EffectWindow* w, int mask, QRegion regi thumbRect.translate(w->pos() + QPoint(data.xTranslation(), data.yTranslation())); thumbRect.setSize(QSize(thumbRect.width() * data.xScale(), thumbRect.height() * data.yScale())); // QSize has no vector multiplicator... :-( - if (effects->compositingType() == KWin::OpenGLCompositing) { + if (effects->isOpenGLCompositing()) { if (data.shader) { thumbData.shader = data.shader; } diff --git a/effects/trackmouse/trackmouse.cpp b/effects/trackmouse/trackmouse.cpp index cf6575456a..cfe735ef9d 100644 --- a/effects/trackmouse/trackmouse.cpp +++ b/effects/trackmouse/trackmouse.cpp @@ -57,7 +57,7 @@ TrackMouseEffect::TrackMouseEffect() if ( effects->compositingType() == XRenderCompositing) m_angleBase = 1.57079632679489661923; // Pi/2 #endif - if ( effects->compositingType() == OpenGLCompositing) + if ( effects->isOpenGLCompositing()) m_angleBase = 90.0; m_mousePolling = false; KActionCollection *actionCollection = new KActionCollection(this); @@ -124,7 +124,7 @@ void TrackMouseEffect::paintScreen(int mask, QRegion region, ScreenPaintData& da if (!m_active) return; - if ( effects->compositingType() == OpenGLCompositing && m_texture[0] && m_texture[1]) { + if ( effects->isOpenGLCompositing() && m_texture[0] && m_texture[1]) { GLShader *shader(0); QMatrix4x4 modelview; if (ShaderManager::instance()->isValid()) { @@ -250,7 +250,7 @@ void TrackMouseEffect::loadTexture() return; for (int i = 0; i < 2; ++i) { - if ( effects->compositingType() == OpenGLCompositing) { + if ( effects->isOpenGLCompositing()) { QImage img(f[i]); m_texture[i] = new GLTexture(img); m_lastRect[i].setSize(img.size()); diff --git a/effects/wobblywindows/wobblywindows.cpp b/effects/wobblywindows/wobblywindows.cpp index dbfbdc3516..6f5544670c 100644 --- a/effects/wobblywindows/wobblywindows.cpp +++ b/effects/wobblywindows/wobblywindows.cpp @@ -226,7 +226,7 @@ void WobblyWindowsEffect::reconfigure(ReconfigureFlags) bool WobblyWindowsEffect::supported() { - return effects->compositingType() == OpenGLCompositing; + return effects->isOpenGLCompositing(); } void WobblyWindowsEffect::setParameterSet(const ParameterSet& pset) diff --git a/effects/zoom/zoom.cpp b/effects/zoom/zoom.cpp index 587de0328d..b13a662a91 100644 --- a/effects/zoom/zoom.cpp +++ b/effects/zoom/zoom.cpp @@ -188,7 +188,7 @@ void ZoomEffect::recreateTexture() imageWidth = ximg->width; imageHeight = ximg->height; QImage img((uchar*)ximg->pixels, imageWidth, imageHeight, QImage::Format_ARGB32_Premultiplied); - if (effects->compositingType() == OpenGLCompositing) + if (effects->isOpenGLCompositing()) texture = new GLTexture(img); #ifdef KWIN_HAVE_XRENDER_COMPOSITING if (effects->compositingType() == XRenderCompositing) diff --git a/lanczosfilter.cpp b/lanczosfilter.cpp index 654d2cf95a..eb1a1881db 100644 --- a/lanczosfilter.cpp +++ b/lanczosfilter.cpp @@ -158,7 +158,7 @@ void LanczosShader::createOffsets(int count, float width, Qt::Orientation direct void LanczosFilter::performPaint(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data) { - if (effects->compositingType() == KWin::OpenGLCompositing && (data.xScale() < 0.9 || data.yScale() < 0.9) && + if (effects->isOpenGLCompositing() && (data.xScale() < 0.9 || data.yScale() < 0.9) && KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects) { if (!m_inited) init(); diff --git a/libkwineffects/kwineffects.cpp b/libkwineffects/kwineffects.cpp index bae85e79b5..9cd99873a7 100644 --- a/libkwineffects/kwineffects.cpp +++ b/libkwineffects/kwineffects.cpp @@ -597,6 +597,11 @@ CompositingType EffectsHandler::compositingType() const return compositing_type; } +bool EffectsHandler::isOpenGLCompositing() const +{ + return compositing_type & OpenGLCompositing; +} + void EffectsHandler::sendReloadMessage(const QString& effectname) { QDBusMessage message = QDBusMessage::createMethodCall("org.kde.kwin", "/KWin", "org.kde.KWin", "reconfigureEffect"); @@ -1182,7 +1187,7 @@ struct PaintClipper::Iterator::Data { PaintClipper::Iterator::Iterator() : data(new Data) { - if (clip() && effects->compositingType() == OpenGLCompositing) { + if (clip() && effects->isOpenGLCompositing()) { data->rects = paintArea().rects(); data->index = -1; next(); // move to the first one @@ -1209,7 +1214,7 @@ bool PaintClipper::Iterator::isDone() { if (!clip()) return data->index == 1; // run once - if (effects->compositingType() == OpenGLCompositing) + if (effects->isOpenGLCompositing()) return data->index >= data->rects.count(); // run once per each area #ifdef KWIN_HAVE_XRENDER_COMPOSITING if (effects->compositingType() == XRenderCompositing) @@ -1227,7 +1232,7 @@ QRect PaintClipper::Iterator::boundingRect() const { if (!clip()) return infiniteRegion(); - if (effects->compositingType() == OpenGLCompositing) + if (effects->isOpenGLCompositing()) return data->rects[ data->index ]; #ifdef KWIN_HAVE_XRENDER_COMPOSITING if (effects->compositingType() == XRenderCompositing) diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index 2c2f7bf5ed..de9efb9a63 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -783,6 +783,12 @@ public: Q_SCRIPTABLE virtual void addRepaint(int x, int y, int w, int h) = 0; CompositingType compositingType() const; + /** + * @brief Whether the Compositor is OpenGL based (either GL 1 or 2). + * + * @return bool @c true in case of OpenGL based Compositor, @c false otherwise + **/ + bool isOpenGLCompositing() const; virtual unsigned long xrenderBufferPicture() = 0; virtual void reconfigure() = 0; diff --git a/libkwineffects/kwinglobals.h b/libkwineffects/kwinglobals.h index 689fe4da2a..8ea6872c5e 100644 --- a/libkwineffects/kwinglobals.h +++ b/libkwineffects/kwinglobals.h @@ -40,8 +40,17 @@ namespace KWin enum CompositingType { NoCompositing = 0, - OpenGLCompositing, - XRenderCompositing + /** + * Used as a flag whether OpenGL based compositing is used. + * The flag is or-ed to the enum values of the specific OpenGL types. + * The actual Compositors use the @c OpenGL1Compositing or @c OpenGL2Compositing + * flags. If you need to know whether OpenGL is used, either and the flag or + * use EffectsHandler::isOpenGLCompositing(). + **/ + OpenGLCompositing = 1, + XRenderCompositing = 1<<1, + OpenGL1Compositing = 1<<2 | OpenGLCompositing, + OpenGL2Compositing = 1<<3 | OpenGLCompositing }; enum clientAreaOption { diff --git a/scene_opengl.h b/scene_opengl.h index 8ff0006a65..102dae3e8a 100644 --- a/scene_opengl.h +++ b/scene_opengl.h @@ -43,9 +43,6 @@ public: class Window; virtual ~SceneOpenGL(); virtual bool initFailed() const; - virtual CompositingType compositingType() const { - return OpenGLCompositing; - } virtual bool hasPendingFlush() const; virtual int paint(QRegion damage, ToplevelList windows); virtual void windowAdded(Toplevel*); @@ -90,6 +87,9 @@ class SceneOpenGL2 : public SceneOpenGL public: SceneOpenGL2(OpenGLBackend *backend); virtual ~SceneOpenGL2(); + virtual CompositingType compositingType() const { + return OpenGL2Compositing; + } static bool supported(OpenGLBackend *backend); @@ -107,6 +107,9 @@ public: virtual ~SceneOpenGL1(); virtual void screenGeometryChanged(const QSize &size); virtual int paint(QRegion damage, ToplevelList windows); + virtual CompositingType compositingType() const { + return OpenGL1Compositing; + } static bool supported(OpenGLBackend *backend); diff --git a/shadow.cpp b/shadow.cpp index de989c7955..c9966c00a4 100644 --- a/shadow.cpp +++ b/shadow.cpp @@ -49,7 +49,7 @@ Shadow *Shadow::createShadow(Toplevel *toplevel) QVector data = Shadow::readX11ShadowProperty(toplevel->window()); if (!data.isEmpty()) { Shadow *shadow = NULL; - if (effects->compositingType() == OpenGLCompositing) { + if (effects->isOpenGLCompositing()) { shadow = new SceneOpenGLShadow(toplevel); } else if (effects->compositingType() == XRenderCompositing) { #ifdef KWIN_HAVE_XRENDER_COMPOSITING diff --git a/workspace.cpp b/workspace.cpp index 5b37aee2bc..de2d219269 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -2121,6 +2121,8 @@ QString Workspace::supportInformation() const if (effects) { support.append("Compositing is active\n"); switch (effects->compositingType()) { + case OpenGL1Compositing: + case OpenGL2Compositing: case OpenGLCompositing: { #ifdef KWIN_HAVE_OPENGLES support.append("Compositing Type: OpenGL ES 2.0\n");