Commit cd8275c7 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 3dbd3665
Pipeline #183035 passed with stage
in 55 seconds
......@@ -68,8 +68,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);
......@@ -169,7 +173,8 @@ uint ScreenCastPortal::Start(const QDBusObjectPath &handle,
return 2;
}
results.insert(QStringLiteral("streams"), QVariant::fromValue(streams));
session->setStreams(streams);
results.insert(QStringLiteral("streams"), QVariant::fromValue<WaylandIntegration::Streams>(streams));
if (inhibitionsEnabled()) {
new NotificationInhibition(app_id, i18nc("Do not disturb mode is enabled because...", "Screen sharing in progress"), session);
......
......@@ -14,6 +14,7 @@
#include "remotedesktop.h"
#include "screencast.h"
#include "waylandintegration.h"
class Session : public QDBusVirtualObject
{
......@@ -62,10 +63,21 @@ public:
return SessionType::ScreenCast;
}
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;
WaylandIntegration::Streams m_streams;
};
class RemoteDesktopSession : public ScreenCastSession
......
......@@ -89,6 +89,11 @@ void WaylandIntegration::stopAllStreaming()
globalWaylandIntegration->stopAllStreaming();
}
void WaylandIntegration::stopStreaming(uint node)
{
globalWaylandIntegration->stopStreaming(node);
}
void WaylandIntegration::requestPointerButtonPress(quint32 linuxButton)
{
globalWaylandIntegration->requestPointerButtonPress(linuxButton);
......
......@@ -131,6 +131,7 @@ void startStreamingInput();
Stream startStreamingOutput(quint32 outputName, 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