diff --git a/plugins/kdecorations/aurorae/src/aurorae.cpp b/plugins/kdecorations/aurorae/src/aurorae.cpp index 9407d64e4..0fa36f194 100644 --- a/plugins/kdecorations/aurorae/src/aurorae.cpp +++ b/plugins/kdecorations/aurorae/src/aurorae.cpp @@ -337,6 +337,7 @@ void Decoration::init() if (usingGL) { // first create the context QSurfaceFormat format; + format.setSwapBehavior(QSurfaceFormat::SingleBuffer); format.setDepthBufferSize(16); format.setStencilBufferSize(8); m_context.reset(new QOpenGLContext); @@ -353,38 +354,39 @@ void Decoration::init() m_updateTimer.reset(new QTimer); m_updateTimer->setSingleShot(true); m_updateTimer->setInterval(5); - connect(m_updateTimer.data(), &QTimer::timeout, this, - [this, usingGL] { - if (usingGL) { - if (!m_context->makeCurrent(m_offscreenSurface.data())) { + + + auto updateBuffer = [this, usingGL] { + if (usingGL) { + if (!m_context->makeCurrent(m_offscreenSurface.data())) { + return; + } + if (m_fbo.isNull() || m_fbo->size() != m_view->size()) { + m_fbo.reset(new QOpenGLFramebufferObject(m_view->size(), QOpenGLFramebufferObject::CombinedDepthStencil)); + if (!m_fbo->isValid()) { + qCWarning(AURORAE) << "Creating FBO as render target failed"; + m_fbo.reset(); return; } - if (m_fbo.isNull() || m_fbo->size() != m_view->size()) { - m_fbo.reset(new QOpenGLFramebufferObject(m_view->size(), QOpenGLFramebufferObject::CombinedDepthStencil)); - if (!m_fbo->isValid()) { - qCWarning(AURORAE) << "Creating FBO as render target failed"; - m_fbo.reset(); - return; - } - } - m_view->setRenderTarget(m_fbo.data()); - m_view->resetOpenGLState(); } + m_view->setRenderTarget(m_fbo.data()); + m_view->resetOpenGLState(); + } - m_buffer = m_renderControl->grab(); - - m_contentRect = QRect(QPoint(0, 0), m_buffer.size()); - if (m_padding && - (m_padding->left() > 0 || m_padding->top() > 0 || m_padding->right() > 0 || m_padding->bottom() > 0) && - !client().data()->isMaximized()) { - m_contentRect = m_contentRect.adjusted(m_padding->left(), m_padding->top(), -m_padding->right(), -m_padding->bottom()); - } - updateShadow(); + m_buffer = m_renderControl->grab(); - QOpenGLFramebufferObject::bindDefault(); - update(); + m_contentRect = QRect(QPoint(0, 0), m_buffer.size()); + if (m_padding && + (m_padding->left() > 0 || m_padding->top() > 0 || m_padding->right() > 0 || m_padding->bottom() > 0) && + !client().data()->isMaximized()) { + m_contentRect = m_contentRect.adjusted(m_padding->left(), m_padding->top(), -m_padding->right(), -m_padding->bottom()); } - ); + updateShadow(); + + QOpenGLFramebufferObject::bindDefault(); + update(); + }; + connect(m_updateTimer.data(), &QTimer::timeout, this, updateBuffer); auto requestUpdate = [this] { if (m_updateTimer->isActive()) { return; @@ -401,6 +403,7 @@ void Decoration::init() m_renderControl->initialize(m_context.data()); m_context->doneCurrent(); } + updateBuffer(); } setupBorders(m_item); // TODO: Is there a more efficient way to react to border changes?