Add screen cast portal

Authored by jgrulich on Mar 2 2018, 10:42 AM.



Add support for screen casting, using pipewire for creating streams. Screen data
is supplied by KWin which sends us GBM fd using Remote Access interface from KWayland.

Note that this is meant for sandboxed and also not sandboxed applications as plan for Pipewire is that
if application talks directly to Pipewire, not calling xdg-desktop-portal (the middle man), then Pipewire
will still call backend implementation internally, in our case xdg-desktop-portal-kde to get screen cast stream.

Depends on D1231 and D1230

Diff Detail

R838 Flatpak Support: KDE Portal for XDG Desktop
No Linters Available
No Unit Test Coverage
jgrulich requested review of this revision.Mar 2 2018, 10:42 AM
jgrulich created this revision.
jgrulich added a subscriber: Plasma.

Hi Jan, I'll take a look in the evening once I'm home.

jgrulich edited the summary of this revision. (Show Details)Mar 2 2018, 10:48 AM
jgrulich edited the summary of this revision. (Show Details)Mar 2 2018, 10:51 AM
jgrulich edited the summary of this revision. (Show Details)
Kanedias added inline comments.Mar 4 2018, 10:50 AM

Is this code actually reachable?


We can use QTimer::singleShot here, no?


You can use QScopedPointer<ScreenChooserDialog, QScopedPointerDeleteLater> when you define the dialog to avoid duplication of ->deleteLater() calls


Some methods have first letter upper-case, some not, why?


This is not a list ,this is a map. The variable name is confusing.

I'd wrap some pipewire structures into some kind of PipewirePointer like WaylandPointer in KWayland does. But maybe I'm too picky, overall this stuff looks really good!

jgrulich marked 4 inline comments as done.Mar 5 2018, 7:37 AM
jgrulich added inline comments.

See [1]. We are supposed to reimplement this interface and these methods are defined by xdg-desktop-portal so we have to follow their naming.

[1] -

jgrulich updated this revision to Diff 28668.Mar 5 2018, 7:39 AM

Fix issues mentioned in review

jgrulich updated this revision to Diff 28670.Mar 5 2018, 7:41 AM

Screen chooser dialog will be deleted automatically

Kanedias accepted this revision.Mar 7 2018, 2:23 PM
This revision is now accepted and ready to land.Mar 7 2018, 2:23 PM

I'll push it once your GBM stuff is merged, thank you for your review.

Provide a Findgbm.cmake module file. For example


With self-compiled Pipewire 0.1.9 I needed this to be <spa/lib/pod.h>.

jgrulich updated this revision to Diff 30014.Mar 20 2018, 5:11 PM

Add Findgbm.cmake module and fix build against newer Pipewire

Provide a Findgbm.cmake module file. For example

Weird it wasn't pushed, I had that module file locally since the beginning.

Both required reviews for GBM stuff have been already merged, can we proceed with this one? If there are no objections I will push it.

From me there are no objections. I haven't looked in detail through the code.

I could compile, but not test it because according to our last discussion the official Ubuntu xdp PPA isn't compiled with Pipewire support. So if this diff lands it would be good if Pipewire support in the PPA follows swiftly so people on Kubuntu/Neon can test it this way and we don't get needless bug reports.

If there are no objections I will move forward with this review.

This revision was automatically updated to reflect the committed changes.