Merge branch 'lnj/plasma-phone-components-fix/screen-not-fully-captured'

This commit is contained in:
Marco Martin 2020-02-10 10:45:36 +01:00
commit 913b9d6db9

View file

@ -80,8 +80,14 @@ void PhonePanel::toggleTorch()
void PhonePanel::takeScreenshot()
{
// wait ~200 ms to wait for rest of animations
QTimer::singleShot(200, [=]() {
auto *interface = new org::kde::kwin::Screenshot(QStringLiteral("org.kde.KWin"), QStringLiteral("/Screenshot"), QDBusConnection::sessionBus(), this);
QDBusPendingReply<QString> 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<QString> reply = interface->screenshotArea(0, 0, screenSize.width(), screenSize.height());
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [=](QDBusPendingCallWatcher *watcher) {
@ -122,6 +128,7 @@ void PhonePanel::takeScreenshot()
watcher->deleteLater();
interface->deleteLater();
});
});
}
K_EXPORT_PLASMA_APPLET_WITH_JSON(quicksettings, PhonePanel, "metadata.json")