Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KDE Portal for XDG Desktop
Commits
2aa7431b
Commit
2aa7431b
authored
Sep 27, 2022
by
Aleix Pol Gonzalez
🐧
Committed by
Aleix Pol Gonzalez
Sep 28, 2022
Browse files
ScreenCast: Make sure we close sessions when all streams are done
(cherry picked from commit
65c7d5a3
)
parent
b78f6b79
Pipeline
#237944
canceled with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/session.cpp
View file @
2aa7431b
...
...
@@ -14,6 +14,7 @@
#include
<QDBusMessage>
#include
<QDBusPendingCall>
#include
<QDBusPendingCallWatcher>
#include
<screencast_debug.h>
static
QMap
<
QString
,
Session
*>
sessionList
;
...
...
@@ -204,3 +205,28 @@ void RemoteDesktopSession::setScreenSharingEnabled(bool enabled)
{
m_screenSharingEnabled
=
enabled
;
}
void
ScreenCastSession
::
setStreams
(
const
WaylandIntegration
::
Streams
&
streams
)
{
m_streams
=
streams
;
for
(
const
auto
&
s
:
streams
)
{
connect
(
s
.
stream
,
&
ScreencastingStream
::
closed
,
this
,
&
ScreenCastSession
::
streamClosed
);
connect
(
s
.
stream
,
&
ScreencastingStream
::
failed
,
this
,
[
this
](
const
QString
&
error
)
{
qCWarning
(
XdgDesktopPortalKdeScreenCast
)
<<
"ScreenCast session failed"
<<
error
;
streamClosed
();
});
}
}
void
ScreenCastSession
::
streamClosed
()
{
ScreencastingStream
*
stream
=
qobject_cast
<
ScreencastingStream
*>
(
sender
());
std
::
remove_if
(
m_streams
.
begin
(),
m_streams
.
end
(),
[
stream
](
const
WaylandIntegration
::
Stream
&
s
)
{
return
s
.
stream
==
stream
;
});
if
(
m_streams
.
isEmpty
())
{
close
();
}
}
src/session.h
View file @
2aa7431b
...
...
@@ -75,16 +75,14 @@ public:
{
return
m_streams
;
}
void
setStreams
(
const
WaylandIntegration
::
Streams
&
streams
)
{
m_streams
=
streams
;
}
void
setStreams
(
const
WaylandIntegration
::
Streams
&
streams
);
private:
bool
m_multipleSources
;
ScreenCastPortal
::
CursorModes
m_cursorMode
;
ScreenCastPortal
::
SourceType
m_types
;
ScreenCastPortal
::
PersistMode
m_persistMode
=
ScreenCastPortal
::
NoPersist
;
void
streamClosed
();
WaylandIntegration
::
Streams
m_streams
;
QVariant
m_restoreData
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment