Make openGL context current when recording frame triggered by cursor move

recordFrame requires an openGL context. This is typically done after a
frame is rendered, but when we send a frame after a cursor move this is
not guaranteed.

BUG: 448162
This commit is contained in:
David Edmundson 2022-02-10 15:04:10 +00:00 committed by Vlad Zahorodnii
parent c0cb349cb8
commit 12427932de

View file

@ -8,6 +8,7 @@
#include "screencaststream.h"
#include "cursor.h"
#include "composite.h"
#include "dmabuftexture.h"
#include "eglnativefence.h"
#include "kwinglplatform.h"
@ -17,6 +18,7 @@
#include "main.h"
#include "pipewirecore.h"
#include "platform.h"
#include "scene.h"
#include "screencastsource.h"
#include "utils/common.h"
@ -306,6 +308,9 @@ bool ScreenCastStream::createStream()
if (m_cursor.mode == KWaylandServer::ScreencastV1Interface::Embedded) {
connect(Cursors::self(), &Cursors::positionChanged, this, [this] {
if (auto scene = Compositor::self()->scene()) {
scene->makeOpenGLContextCurrent();
}
recordFrame(QRegion{m_cursor.lastRect} | cursorGeometry(Cursors::self()->currentCursor()));
});
} else if (m_cursor.mode == KWaylandServer::ScreencastV1Interface::Metadata) {