Commit 78a60708 authored by Andrius Štikonas's avatar Andrius Štikonas
Browse files

Do not use QDBusInterface.

Saves one blocking introspection call

See Also: plasma-workspace commit 6fcc54a5e4784587fc5cdc9cabc0fd67f2731c3d
parent c93821db
......@@ -1120,9 +1120,12 @@ bool MainWindow::focusNextPrevChild(bool)
void MainWindow::toggleWindowState()
{
if (m_isWayland) {
QDBusInterface strutManager(QStringLiteral("org.kde.plasmashell"), QStringLiteral("/StrutManager"), QStringLiteral("org.kde.PlasmaShell.StrutManager"));
QDBusPendingCall async = strutManager.asyncCall(QStringLiteral("availableScreenRect"), QGuiApplication::screens().at(getScreen())->name());
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(async, this);
auto message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.plasmashell"), QStringLiteral("/StrutManager"),
QStringLiteral("org.kde.PlasmaShell.StrutManager"), QStringLiteral("availableScreenRect"));
message.setArguments({QGuiApplication::screens().at(getScreen())->name()});
QDBusPendingCall call = QDBusConnection::sessionBus().asyncCall(message);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [=]() {
QDBusPendingReply<QRect> reply = *watcher;
m_availableScreenRect = reply.isValid() ? reply.value() : QRect();
......
Markdown is supported
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