diff --git a/effects.cpp b/effects.cpp index 4fe22a8d80..f9fadb48cc 100644 --- a/effects.cpp +++ b/effects.cpp @@ -1651,12 +1651,12 @@ EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint if (m_style == EffectFrameStyled) { m_frame.setImagePath("widgets/background"); m_frame.setCacheAllRenderedFrames(true); - m_selection.setImagePath("widgets/viewitem"); - m_selection.setElementPrefix("hover"); - m_selection.setCacheAllRenderedFrames(true); - m_selection.setEnabledBorders(Plasma::FrameSvg::AllBorders); connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged())); } + m_selection.setImagePath("widgets/viewitem"); + m_selection.setElementPrefix("hover"); + m_selection.setCacheAllRenderedFrames(true); + m_selection.setEnabledBorders(Plasma::FrameSvg::AllBorders); if (effects->compositingType() == OpenGLCompositing) { #ifdef KWIN_HAVE_OPENGL_COMPOSITING diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index 126968c356..61a5c2099f 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -1778,7 +1778,6 @@ public: /** * Sets the geometry of a selection. * To remove the selection set a null rect. - * This is only available if the an styled EffectFrame is used. * @param selection The geometry of the selection in screen coordinates. **/ virtual void setSelection(const QRect& selection) = 0; diff --git a/scene_opengl.cpp b/scene_opengl.cpp index a3a8da8246..f43f2273b9 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -1333,18 +1333,26 @@ void SceneOpenGL::EffectFrame::render(QRegion region, double opacity, double fra m_texture->render(region, m_effectFrame->geometry().adjusted(-left, -top, right, bottom)); m_texture->unbind(); - if (!m_effectFrame->selection().isNull()) { - if (!m_selectionTexture) { // Lazy creation - QPixmap pixmap = m_effectFrame->selectionFrame().framePixmap(); - m_selectionTexture = new Texture(pixmap.handle(), pixmap.size(), pixmap.depth()); - m_selectionTexture->setYInverted(true); - } - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - m_selectionTexture->bind(); - m_selectionTexture->render(region, m_effectFrame->selection()); - m_selectionTexture->unbind(); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + if (!m_effectFrame->selection().isNull()) { + if (!m_selectionTexture) { // Lazy creation + QPixmap pixmap = m_effectFrame->selectionFrame().framePixmap(); + m_selectionTexture = new Texture(pixmap.handle(), pixmap.size(), pixmap.depth()); + m_selectionTexture->setYInverted(true); } + if (shader) { + const float a = opacity * frameOpacity; + shader->setUniform(GLShader::ModulationConstant, QVector4D(a, a, a, a)); + } +#ifndef KWIN_HAVE_OPENGLES + else + glColor4f(1.0, 1.0, 1.0, opacity * frameOpacity); +#endif + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + m_selectionTexture->bind(); + m_selectionTexture->render(region, m_effectFrame->selection()); + m_selectionTexture->unbind(); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } // Render icon diff --git a/scene_xrender.cpp b/scene_xrender.cpp index 3f4f7e865f..1682e6e639 100644 --- a/scene_xrender.cpp +++ b/scene_xrender.cpp @@ -904,14 +904,14 @@ void SceneXrender::EffectFrame::render(QRegion region, double opacity, double fr XRenderComposite(display(), PictOpOver, *m_picture, None, effects->xrenderBufferPicture(), 0, 0, 0, 0, geom.x(), geom.y(), geom.width(), geom.height()); - if (!m_effectFrame->selection().isNull()) { - if (!m_selectionPicture) { // Lazy creation - m_selectionPicture = new XRenderPicture(m_effectFrame->selectionFrame().framePixmap()); - } - geom = m_effectFrame->selection(); - XRenderComposite(display(), PictOpOver, *m_selectionPicture, None, effects->xrenderBufferPicture(), - 0, 0, 0, 0, geom.x(), geom.y(), geom.width(), geom.height()); + } + if (!m_effectFrame->selection().isNull()) { + if (!m_selectionPicture) { // Lazy creation + m_selectionPicture = new XRenderPicture(m_effectFrame->selectionFrame().framePixmap()); } + const QRect geom = m_effectFrame->selection(); + XRenderComposite(display(), PictOpOver, *m_selectionPicture, None, effects->xrenderBufferPicture(), + 0, 0, 0, 0, geom.x(), geom.y(), geom.width(), geom.height()); } XRenderPicture fill = xRenderBlendPicture(opacity);