From a0b8a970ef3bc89cfbcb3d44f7ea2200e2ee3886 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Sat, 8 Feb 2020 13:17:53 +0100 Subject: [PATCH] Workaround KWin screenshot bug by using screenArea manually On some/most devices screenshotFullscreen captures only a part of the screen. --- containments/panel/phonepanel.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/containments/panel/phonepanel.cpp b/containments/panel/phonepanel.cpp index 3455fffc..ab9d43d4 100644 --- a/containments/panel/phonepanel.cpp +++ b/containments/panel/phonepanel.cpp @@ -22,8 +22,10 @@ #include #include -#include #include +#include +#include +#include #include #include #include @@ -81,7 +83,11 @@ void PhonePanel::toggleTorch() void PhonePanel::takeScreenshot() { auto *interface = new org::kde::kwin::Screenshot(QStringLiteral("org.kde.KWin"), QStringLiteral("/Screenshot"), QDBusConnection::sessionBus(), this); - QDBusPendingReply reply = interface->screenshotFullscreen(); + + // screenshot fullscreen currently doesn't work on all devices -> we need to use screenshot area + // this won't work with multiple screens + QSize screenSize = QGuiApplication::primaryScreen()->size(); + QDBusPendingReply reply = interface->screenshotArea(0, 0, screenSize.width(), screenSize.height()); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); connect(watcher, &QDBusPendingCallWatcher::finished, this, [=](QDBusPendingCallWatcher *watcher) {