diff --git a/src/plugins/screenshot/org.kde.KWin.ScreenShot2.xml b/src/plugins/screenshot/org.kde.KWin.ScreenShot2.xml index 65911c65a3..da0d163b99 100644 --- a/src/plugins/screenshot/org.kde.KWin.ScreenShot2.xml +++ b/src/plugins/screenshot/org.kde.KWin.ScreenShot2.xml @@ -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 diff --git a/src/plugins/screenshot/screenshot.cpp b/src/plugins/screenshot/screenshot.cpp index e246108fcf..8267201fa0 100644 --- a/src/plugins/screenshot/screenshot.cpp +++ b/src/plugins/screenshot/screenshot.cpp @@ -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(); diff --git a/src/plugins/screenshot/screenshot.h b/src/plugins/screenshot/screenshot.h index bae051581a..8e9c5eabbc 100644 --- a/src/plugins/screenshot/screenshot.h +++ b/src/plugins/screenshot/screenshot.h @@ -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) diff --git a/src/plugins/screenshot/screenshotdbusinterface2.cpp b/src/plugins/screenshot/screenshotdbusinterface2.cpp index c2fdcf92bb..ad3eefc92e 100644 --- a/src/plugins/screenshot/screenshotdbusinterface2.cpp +++ b/src/plugins/screenshot/screenshotdbusinterface2.cpp @@ -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;