Introduce a KWin/Wayland image grabber
ClosedPublic

Authored by graesslin on Nov 18 2016, 9:17 AM.

Details

Summary

This new ImageGrabber makes use of the new DBus interface introduced
with D3412 in KWin.

Taking a screen shot on Wayland is significantly different to how
screenshot taking on X11 works. No application is able to access a
window buffer or even able to figure out which window is at a given
mouse position.

Due to that the complete interaction needs to go through the compositor.
The only supported mode is thus window under cursor with click. There is
no other mode available. The idea is to keep the user always under
control of the screen shot taking - a security feature.

Full screen shot or screen region shot is currently not yet supported.

Explaining the dbus interaction: spectacle creates a pipe fd which gets
passed to the compositor through the dbus call. It starts to read from
the pipe in a dedicated thread (to keep gui thread responsive) with a
timeout of 30 sec. Spectacle doesn't know when the user clicks, so a
reasonable timeout is required.

In case the user cancels the selection or clicks a "non window"
spectacle cannot know that and will read an empty image from the pipe.

Diff Detail

Repository
R166 Spectacle
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
graesslin updated this revision to Diff 8299.Nov 18 2016, 9:17 AM
graesslin retitled this revision from to Introduce a KWin/Wayland image grabber.
graesslin updated this object.
graesslin edited the test plan for this revision. (Show Details)
Restricted Application added a project: Plasma on Wayland. · View Herald TranscriptNov 18 2016, 9:17 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
mart accepted this revision.Nov 18 2016, 11:38 AM
mart added a reviewer: mart.
This revision is now accepted and ready to land.Nov 18 2016, 11:38 AM
bgupta accepted this revision.Nov 18 2016, 5:41 PM
bgupta edited edge metadata.

This is lovely.

Thanks for doing this.

This revision was automatically updated to reflect the committed changes.