Experiments with screenshots, graphics using shm

Zdeněk Žamberský zzambers at redhat.com
Thu Sep 23 13:03:27 UTC 2021


I have done some experiments with dbus APIs:

portals dbus API:
- libportal is not available on rhel-8, however dbus API/libs are there
   (I think it is provided by xdg-desktop-portals* packages)
- I have made simple program calling dbus API directly [1]
- Screenshot call is asynchronous, this means you perform call to make 
screenshot (it returns immediately),
   url to the screenshot file is delivered later by signal (dbus)
- this means you need to create even loop (to wait for signal)
- When screenshot is requested, user is presented with dialog asking for 
confirmation (see rhel-8 example [2]).
   There seem no way to avoid it (even with "interactive" option to false)
- API works on RHEL-8/gnome-shell(3), F34/gnome-shell(40), but 
confirmation dialog is shown, as I wrote earlier
- I also tried it on f33/XFCE/X11 screenshot call was successful, but no 
dialog was shown
   and dbus signal was not delivered (so test app basically hanged 
waiting for signal...)
- All in all, I don't have really good impression of this API (user 
interaction needed, eventloop needed),
   in current form it does not fit our needs very well, I would see it 
as last resort

gnome-shell dbus API:
- obviously gnome only (there are other desktop specific backends)
- In the past I have created experimental patch using it as a backend 
for Robot on wayland
- I have quickly rebased it to current jdk [3]
- This API is syncronous, screenshot call directly returns path to 
screenshot file
- It does not require user interaction (does not show any dialogs)
- API works on RHEL-8/gnome-shell(3), F34/gnome-shell(40)
- Theoretically could be one of the options to try by openjdk
   (I have seen this in multiple screenshoting apps as on of their backends)


wayland shm:
- I have created simple wayland program which uses shared memory for 
graphics [4]
- Looking at OpenJDK source code a bit, using this as backend should be 
relatively easy to do, I think

[4] https://github.com/zzambers/wayland-experiments/tree/main/wl-shm

Zdeněk Žamberský
Red Hat

More information about the wakefield-dev mailing list