mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-27 14:33:08 +00:00
Workaround KWin screenshot bug by using screenArea manually
On some/most devices screenshotFullscreen captures only a part of the screen.
This commit is contained in:
parent
25a85543cd
commit
a0b8a970ef
1 changed files with 8 additions and 2 deletions
|
|
@ -22,8 +22,10 @@
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDBusPendingReply>
|
#include <QDBusPendingReply>
|
||||||
#include <QFile>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QScreen>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QtConcurrent/QtConcurrent>
|
#include <QtConcurrent/QtConcurrent>
|
||||||
|
|
@ -81,7 +83,11 @@ void PhonePanel::toggleTorch()
|
||||||
void PhonePanel::takeScreenshot()
|
void PhonePanel::takeScreenshot()
|
||||||
{
|
{
|
||||||
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) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue