mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 10:14:45 +00:00
Merge branch 'lnj/plasma-phone-components-fix/screen-not-fully-captured'
This commit is contained in:
commit
913b9d6db9
1 changed files with 42 additions and 35 deletions
|
|
@ -80,8 +80,14 @@ void PhonePanel::toggleTorch()
|
||||||
|
|
||||||
void PhonePanel::takeScreenshot()
|
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);
|
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);
|
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
|
||||||
|
|
||||||
connect(watcher, &QDBusPendingCallWatcher::finished, this, [=](QDBusPendingCallWatcher *watcher) {
|
connect(watcher, &QDBusPendingCallWatcher::finished, this, [=](QDBusPendingCallWatcher *watcher) {
|
||||||
|
|
@ -122,6 +128,7 @@ void PhonePanel::takeScreenshot()
|
||||||
watcher->deleteLater();
|
watcher->deleteLater();
|
||||||
interface->deleteLater();
|
interface->deleteLater();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
K_EXPORT_PLASMA_APPLET_WITH_JSON(quicksettings, PhonePanel, "metadata.json")
|
K_EXPORT_PLASMA_APPLET_WITH_JSON(quicksettings, PhonePanel, "metadata.json")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue