plugins/screentransform: Properly exclude itself from previous screen capture

This commit is contained in:
Vlad Zahorodnii 2023-11-21 19:57:59 +02:00
parent 57ff600c98
commit 41df430aa8
2 changed files with 8 additions and 1 deletions

View file

@ -89,6 +89,12 @@ void ScreenTransformEffect::addScreen(Output *screen)
SceneDelegate delegate(scene, screen);
delegate.setLayer(&layer);
// Avoid including this effect while capturing previous screen state.
m_capturing = true;
auto resetCapturing = qScopeGuard([this]() {
m_capturing = false;
});
scene->prePaint(&delegate);
effects->makeOpenGLContextCurrent();
@ -264,7 +270,7 @@ void ScreenTransformEffect::paintScreen(const RenderTarget &renderTarget, const
bool ScreenTransformEffect::isActive() const
{
return !m_states.isEmpty();
return !m_states.isEmpty() && !m_capturing;
}
} // namespace KWin

View file

@ -64,6 +64,7 @@ private:
int m_currentTextureLocation = -1;
int m_modelViewProjectioMatrixLocation = -1;
int m_blendFactorLocation = -1;
bool m_capturing = false;
};
} // namespace KWin