Commit 7b0219ea authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

ScreenCast: Make cursor mode effective with window screencasting

One can request a window screencast with cursor, but that won't work
in Plasma Wayland because the cursor mode isn't forwarded to
stream_window request.

CCBUG: 452960
parent 57f17b2d
Pipeline #215605 passed with stage
in 1 minute and 8 seconds
......@@ -284,7 +284,7 @@ uint ScreenCastPortal::Start(const QDBusObjectPath &handle,
streams << stream;
}
for (const auto &win : qAsConst(selectedWindows)) {
WaylandIntegration::Stream stream = WaylandIntegration::startStreamingWindow(win);
WaylandIntegration::Stream stream = WaylandIntegration::startStreamingWindow(win, Screencasting::CursorMode(session->cursorMode()));
if (!stream.isValid()) {
qCWarning(XdgDesktopPortalKdeScreenCast) << "Invalid window!" << win;
return 2;
......
......@@ -124,9 +124,9 @@ WaylandIntegration::Stream WaylandIntegration::startStreamingVirtual(const QStri
return globalWaylandIntegration->startStreamingVirtualOutput(name, size, mode);
}
WaylandIntegration::Stream WaylandIntegration::startStreamingWindow(const QMap<int, QVariant> &win)
WaylandIntegration::Stream WaylandIntegration::startStreamingWindow(const QMap<int, QVariant> &win, Screencasting::CursorMode mode)
{
return globalWaylandIntegration->startStreamingWindow(win);
return globalWaylandIntegration->startStreamingWindow(win, mode);
}
void WaylandIntegration::stopAllStreaming()
......@@ -260,12 +260,13 @@ void WaylandIntegration::WaylandIntegrationPrivate::startStreamingInput()
m_streamInput = true;
}
WaylandIntegration::Stream WaylandIntegration::WaylandIntegrationPrivate::startStreamingWindow(const QMap<int, QVariant> &win)
WaylandIntegration::Stream WaylandIntegration::WaylandIntegrationPrivate::startStreamingWindow(const QMap<int, QVariant> &win,
Screencasting::CursorMode cursorMode)
{
auto uuid = win[KWayland::Client::PlasmaWindowModel::Uuid].toString();
QString iconName = win[Qt::DecorationRole].value<QIcon>().name();
iconName = iconName.isEmpty() ? QStringLiteral("applications-all") : iconName;
return startStreaming(m_screencasting->createWindowStream(uuid, Screencasting::Hidden),
return startStreaming(m_screencasting->createWindowStream(uuid, cursorMode),
iconName,
i18n("Recording window \"%1\"...", win[Qt::DisplayRole].toString()),
{{QLatin1String("source_type"), static_cast<uint>(ScreenCastPortal::Window)}});
......
......@@ -133,7 +133,7 @@ void startStreamingInput();
Stream startStreamingOutput(quint32 outputName, Screencasting::CursorMode mode);
Stream startStreamingWorkspace(Screencasting::CursorMode mode);
Stream startStreamingVirtual(const QString &name, const QSize &size, Screencasting::CursorMode mode);
Stream startStreamingWindow(const QMap<int, QVariant> &win);
Stream startStreamingWindow(const QMap<int, QVariant> &win, Screencasting::CursorMode mode);
void stopAllStreaming();
void stopStreaming(uint node);
......
......@@ -65,7 +65,7 @@ public:
void startStreamingInput();
Stream startStreamingOutput(quint32 outputName, Screencasting::CursorMode mode);
Stream startStreamingWindow(const QMap<int, QVariant> &win);
Stream startStreamingWindow(const QMap<int, QVariant> &win, Screencasting::CursorMode mode);
Stream startStreamingWorkspace(Screencasting::CursorMode mode);
Stream startStreamingVirtualOutput(const QString &name, const QSize &size, Screencasting::CursorMode mode);
void stopStreaming(uint32_t nodeid);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment