Commit 6ebecda3 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Fix fullscreen and monitor screenshots

There are no screenshotFullscreen and screenshotScreen overloads that
have "hi" signature, only "hb", i.e. a pipe fd and whether to capture
the cursor.
parent 33d8d362
Pipeline #131280 passed with stage
in 41 seconds
......@@ -111,18 +111,6 @@ void ScreenshotDialog::takeScreenshotInteractive()
watcher->setFuture(future);
}
int ScreenshotDialog::mask()
{
int mask = 0;
if (m_theDialog->property("withBorders").toBool()) {
mask = Borders;
}
if (m_theDialog->property("withCursor").toBool()) {
mask |= Cursor;
}
return mask;
}
QFuture<QImage> ScreenshotDialog::takeScreenshot()
{
int pipeFds[2];
......@@ -131,14 +119,24 @@ QFuture<QImage> ScreenshotDialog::takeScreenshot()
return {};
}
const bool withBorders = m_theDialog->property("withBorders").toBool();
const bool withCursor = m_theDialog->property("withCursor").toBool();
QDBusInterface interface(QStringLiteral("org.kde.KWin"), QStringLiteral("/Screenshot"), QStringLiteral("org.kde.kwin.Screenshot"));
auto types = ScreenshotType(m_theDialog->property("screenshotType").toInt());
if (types == ActiveWindow) {
interface.asyncCall(QStringLiteral("interactive"), QVariant::fromValue(QDBusUnixFileDescriptor(pipeFds[1])), mask());
int mask = 0;
if (withBorders) {
mask = Borders;
}
if (withCursor) {
mask |= Cursor;
}
interface.asyncCall(QStringLiteral("interactive"), QVariant::fromValue(QDBusUnixFileDescriptor(pipeFds[1])), mask);
} else {
interface.asyncCall(types ? QStringLiteral("screenshotScreen") : QStringLiteral("screenshotFullscreen"),
QVariant::fromValue(QDBusUnixFileDescriptor(pipeFds[1])),
mask());
withCursor);
}
::close(pipeFds[1]);
......
......@@ -41,10 +41,9 @@ Q_SIGNALS:
void failed();
private:
QImage m_image;
int mask();
QFuture<QImage> takeScreenshot();
QImage m_image;
};
#endif // XDG_DESKTOP_PORTAL_KDE_SCREENSHOT_DIALOG_H
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment