Commit 028f9377 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

screencast: When closing a session, only close the streams from that session

parent a6ac4394
......@@ -128,8 +128,12 @@ uint ScreenCastPortal::CreateSession(const QDBusObjectPath &handle,
return 2;
}
connect(session, &Session::closed, []() {
WaylandIntegration::stopAllStreaming();
connect(session, &Session::closed, [session] {
auto screencastSession = qobject_cast<ScreenCastSession *>(session);
const auto streams = screencastSession->streams();
for (const WaylandIntegration::Stream &stream : streams) {
WaylandIntegration::stopStreaming(stream.nodeId);
}
});
connect(WaylandIntegration::waylandIntegration(), &WaylandIntegration::WaylandIntegration::streamingStopped, session, &Session::close);
......@@ -299,6 +303,7 @@ uint ScreenCastPortal::Start(const QDBusObjectPath &handle,
return 2;
}
session->setStreams(streams);
results.insert(QStringLiteral("streams"), QVariant::fromValue<WaylandIntegration::Streams>(streams));
if (allowRestore) {
results.insert("persist_mode", quint32(persist));
......
......@@ -14,6 +14,7 @@
#include "remotedesktop.h"
#include "screencast.h"
#include "waylandintegration.h"
class Session : public QDBusVirtualObject
{
......@@ -70,12 +71,22 @@ public:
return m_persistMode;
}
WaylandIntegration::Streams streams() const
{
return m_streams;
}
void setStreams(const WaylandIntegration::Streams &streams)
{
m_streams = streams;
}
private:
bool m_multipleSources;
ScreenCastPortal::CursorModes m_cursorMode;
ScreenCastPortal::SourceType m_types;
ScreenCastPortal::PersistMode m_persistMode = ScreenCastPortal::NoPersist;
WaylandIntegration::Streams m_streams;
QVariant m_restoreData;
};
......
......@@ -135,6 +135,11 @@ void WaylandIntegration::stopAllStreaming()
globalWaylandIntegration->stopAllStreaming();
}
void WaylandIntegration::stopStreaming(uint node)
{
globalWaylandIntegration->stopStreaming(node);
}
void WaylandIntegration::requestPointerButtonPress(quint32 linuxButton)
{
globalWaylandIntegration->requestPointerButtonPress(linuxButton);
......
......@@ -135,6 +135,7 @@ Stream startStreamingWorkspace(Screencasting::CursorMode mode);
Stream startStreamingVirtual(const QString &name, const QSize &size, Screencasting::CursorMode mode);
Stream startStreamingWindow(const QMap<int, QVariant> &win);
void stopAllStreaming();
void stopStreaming(uint node);
void requestPointerButtonPress(quint32 linuxButton);
void requestPointerButtonRelease(quint32 linuxButton);
......
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