Refactor pixmap grabbing, add robustness

Review Request #129176 - Created Oct. 13, 2016 and submitted

Information
Peter Wu
spectacle
370303
ed2c786...
Reviewers
kdegraphics
bgupta
Do not go in an infinite loop when the root window cannot be captured
(bug 370303). Avoid crashing xcb_image_destroy by checking for NULL.

Split the getWindowPixmap into three logical methods depending on the
consumer: obtaining a pixmap from KWin, obtaining a pixmap from a single
window and obtaining a pixmap from a full screen. This enables some
optimizations, like obtaining a smaller area of the screen without
cropping. Additionally, it will make fixing HiDPI support easier.

Added robustness: if KWin somehow fails, now it will fallback to a
fullscreen capture instead of an null pixmap.

BUG: 370303

Tried all options, with/with decoration/cursor. Picture is still grabbed correctly.
Made isKwinAvailable return false to try the fallback path.

The linked bug is fixed as side-effect, now it does not crash anymore in Weston/XWayland, but the picture is still empty.

Boudhayan Gupta
Peter Wu
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted with commit 7a5603fda8f1e591d31dba1ad178c44ad6847cc2 by Peter Wu to branch master.
Loading...