plugins/screenshot: make window shadows optional

Right now screenshots of windows always have drop shadows. This change
makes the shadows optional. Resolves a 7-year-old bug report in
conjunction with an incoming change to Spectacle.

BUG: 372408
master
Kristen McWilliam 11 months ago committed by Noah Davis
parent 3eb90b2c60
commit 5c8b85861e

@ -38,6 +38,8 @@
Defaults to false
* "include-decoration" (b): Whether the decoration should be included.
Defaults to false
* "include-shadow" (b): Whether the shadow should be included.
Defaults to false
* "native-resolution" (b): Whether the screenshot should be in
native size. Defaults to false
@ -86,6 +88,8 @@
Defaults to false
* "include-decoration" (b): Whether the decoration should be included.
Defaults to false
* "include-shadow" (b): Whether the shadow should be included.
Defaults to false
* "native-resolution" (b): Whether the screenshot should be in
native size. Defaults to false
@ -268,6 +272,8 @@
Defaults to false
* "include-decoration" (b): Whether the decoration should be included.
Defaults to false
* "include-shadow" (b): Whether the shadow should be included.
Defaults to false
* "native-resolution" (b): Whether the screenshot should be in
native size. Defaults to false

@ -231,6 +231,9 @@ void ScreenShotEffect::takeScreenShot(ScreenShotWindowData *screenshot)
if (window->hasDecoration() && !(screenshot->flags & ScreenShotIncludeDecoration)) {
geometry = window->clientGeometry();
}
if (window->hasDecoration() && !(screenshot->flags & ScreenShotIncludeShadow)) {
geometry = window->frameGeometry();
}
if (screenshot->flags & ScreenShotNativeResolution) {
if (const EffectScreen *screen = window->screen()) {
devicePixelRatio = screen->devicePixelRatio();

@ -26,6 +26,7 @@ enum ScreenShotFlag {
ScreenShotIncludeDecoration = 0x1, ///< Include window titlebar and borders
ScreenShotIncludeCursor = 0x2, ///< Include the cursor
ScreenShotNativeResolution = 0x4, ///< Take the screenshot at the native resolution
ScreenShotIncludeShadow = 0x8, ///< Include the window shadow
};
Q_DECLARE_FLAGS(ScreenShotFlags, ScreenShotFlag)

@ -107,6 +107,11 @@ static ScreenShotFlags screenShotFlagsFromOptions(const QVariantMap &options)
flags |= ScreenShotIncludeDecoration;
}
const QVariant includeShadow = options.value(QStringLiteral("include-shadow"));
if (includeShadow.toBool()) {
flags |= ScreenShotIncludeShadow;
}
const QVariant includeCursor = options.value(QStringLiteral("include-cursor"));
if (includeCursor.toBool()) {
flags |= ScreenShotIncludeCursor;

Loading…
Cancel
Save