plugins/screencast: Allow including cursor in window screencasts

BUG: 452960
This commit is contained in:
Vlad Zahorodnii 2022-08-09 18:07:27 +03:00
parent 1a475a73de
commit c3f9aab329
2 changed files with 14 additions and 4 deletions

View file

@ -32,8 +32,7 @@ namespace KWin
ScreencastManager::ScreencastManager()
: m_screencast(new KWaylandServer::ScreencastV1Interface(waylandServer()->display(), this))
{
connect(m_screencast, &KWaylandServer::ScreencastV1Interface::windowScreencastRequested,
this, &ScreencastManager::streamWindow);
connect(m_screencast, &KWaylandServer::ScreencastV1Interface::windowScreencastRequested, this, &ScreencastManager::streamWindow);
connect(m_screencast, &KWaylandServer::ScreencastV1Interface::outputScreencastRequested, this, &ScreencastManager::streamWaylandOutput);
connect(m_screencast, &KWaylandServer::ScreencastV1Interface::virtualOutputScreencastRequested, this, &ScreencastManager::streamVirtualOutput);
connect(m_screencast, &KWaylandServer::ScreencastV1Interface::regionScreencastRequested, this, &ScreencastManager::streamRegion);
@ -84,7 +83,9 @@ private:
Window *m_window;
};
void ScreencastManager::streamWindow(KWaylandServer::ScreencastStreamV1Interface *waylandStream, const QString &winid)
void ScreencastManager::streamWindow(KWaylandServer::ScreencastStreamV1Interface *waylandStream,
const QString &winid,
KWaylandServer::ScreencastV1Interface::CursorMode mode)
{
auto window = Workspace::self()->findToplevel(QUuid(winid));
if (!window) {
@ -93,6 +94,13 @@ void ScreencastManager::streamWindow(KWaylandServer::ScreencastStreamV1Interface
}
auto stream = new WindowStream(window, this);
stream->setCursorMode(mode, 1, window->clientGeometry().toRect());
if (mode != KWaylandServer::ScreencastV1Interface::CursorMode::Hidden) {
connect(window, &Window::clientGeometryChanged, stream, [window, stream, mode]() {
stream->setCursorMode(mode, 1, window->clientGeometry().toRect());
});
}
integrateStreams(waylandStream, stream);
}

View file

@ -25,7 +25,9 @@ public:
explicit ScreencastManager();
private:
void streamWindow(KWaylandServer::ScreencastStreamV1Interface *stream, const QString &winid);
void streamWindow(KWaylandServer::ScreencastStreamV1Interface *stream,
const QString &winid,
KWaylandServer::ScreencastV1Interface::CursorMode mode);
void streamWaylandOutput(KWaylandServer::ScreencastStreamV1Interface *stream,
KWaylandServer::OutputInterface *output,
KWaylandServer::ScreencastV1Interface::CursorMode mode);