[plasma/xdg-desktop-portal-kde/Plasma/6.7] src: screencast: Implement v5; provide mapping_id for eis users

David Redondo <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 8351ad7f8aa717d3a13f7a96258d0f573a4636c7 by David Redondo.
Committed on 22/07/2026 at 11:56.
Pushed by davidre into branch 'Plasma/6.7'.

screencast: Implement v5; provide mapping_id for eis users

The id matches the one set by KWin on absolute devices, so
apps can now whic device to use.


(cherry picked from commit 30f7494ab23e33a204a0df1b83c8848d84c4e83a)

Co-authored-by: David Redondo <[email protected]>

M  +1    -1    src/screencast.h
M  +6    -3    src/screencasting.cpp

https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/commit/8351ad7f8aa717d3a13f7a96258d0f573a4636c7

diff --git a/src/screencast.h b/src/screencast.h
index 88943347..7bf55e39 100644
--- a/src/screencast.h
+++ b/src/screencast.h
@@ -52,7 +52,7 @@ public:
 
     uint version() const
     {
-        return 4;
+        return 5;
     }
     uint AvailableSourceTypes() const
     {
diff --git a/src/screencasting.cpp b/src/screencasting.cpp
index c1535243..934419c0 100644
--- a/src/screencasting.cpp
+++ b/src/screencasting.cpp
@@ -134,6 +134,7 @@ ScreencastingStream *Screencasting::createOutputStream(QScreen *screen, CursorMo
         {QLatin1String("position"), screen->geometry().topLeft()},
         {QLatin1String("size"), screen->size()},
         {QLatin1String("source_type"), static_cast<uint>(ScreenCastPortal::Monitor)},
+        {QLatin1String("mapping_id"), screen->name()},
     };
     return stream;
 }
@@ -171,9 +172,10 @@ Screencasting::createVirtualOutputStream(const QString &name, const QString &des
     } else {
         stream->d->init(d->stream_virtual_output(name, s.width(), s.height(), wl_fixed_from_double(scale), mode));
     }
-    connect(qGuiApp, &QGuiApplication::screenAdded, stream, [stream, name](const QScreen *screen) {
-        // KWin adds "Virtual-" to virtual screen naems
-        if (screen->name() == QLatin1StringView("Virtual-") + name) {
+    // KWin adds "Virtual-" to virtual screen naems
+    const QString screenId = QLatin1StringView("Virtual-") + name;
+    connect(qGuiApp, &QGuiApplication::screenAdded, stream, [stream, screenId](const QScreen *screen) {
+        if (screen->name() == screenId) {
             stream->d->m_geometry = screen->geometry();
             connect(screen, &QScreen::geometryChanged, stream, [stream](const QRect &geometry) {
                 stream->d->m_geometry = geometry;
@@ -183,6 +185,7 @@ Screencasting::createVirtualOutputStream(const QString &name, const QString &des
     stream->d->metaData = {
         {QLatin1String("size"), s},
         {QLatin1String("source_type"), static_cast<uint>(ScreenCastPortal::Virtual)},
+        {QLatin1String("mapping_id"), screenId}
     };
     return stream;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.