Changeset View
Changeset View
Standalone View
Standalone View
dbusinterface.cpp
Show All 17 Lines | |||||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | 20 | | |||
21 | // own | 21 | // own | ||
22 | #include "dbusinterface.h" | 22 | #include "dbusinterface.h" | ||
23 | #include "compositingadaptor.h" | 23 | #include "compositingadaptor.h" | ||
24 | 24 | | |||
25 | // kwin | 25 | // kwin | ||
26 | #include "abstract_client.h" | ||||
26 | #include "atoms.h" | 27 | #include "atoms.h" | ||
27 | #include "composite.h" | 28 | #include "composite.h" | ||
28 | #include "debug_console.h" | 29 | #include "debug_console.h" | ||
29 | #include "main.h" | 30 | #include "main.h" | ||
30 | #include "placement.h" | 31 | #include "placement.h" | ||
31 | #include "platform.h" | 32 | #include "platform.h" | ||
32 | #include "kwinadaptor.h" | 33 | #include "kwinadaptor.h" | ||
33 | #include "scene.h" | 34 | #include "scene.h" | ||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Line(s) | |||||
182 | } | 183 | } | ||
183 | 184 | | |||
184 | void DBusInterface::showDebugConsole() | 185 | void DBusInterface::showDebugConsole() | ||
185 | { | 186 | { | ||
186 | DebugConsole *console = new DebugConsole; | 187 | DebugConsole *console = new DebugConsole; | ||
187 | console->show(); | 188 | console->show(); | ||
188 | } | 189 | } | ||
189 | 190 | | |||
191 | QVariantMap DBusInterface::queryWindowInfo() | ||||
192 | { | ||||
193 | m_replyQueryWindowInfo = message(); | ||||
davidedmundson: can you add:
if (m_replyQuery...) {sendError()}
otherwise if a user makes two calls without… | |||||
That's already the case. If we get into this situation the underlying functionality returns nullptr and thus error message is send. graesslin: That's already the case. If we get into this situation the underlying functionality returns… | |||||
194 | setDelayedReply(true); | ||||
195 | kwinApp()->platform()->startInteractiveWindowSelection( | ||||
196 | [this] (Toplevel *t) { | ||||
197 | if (auto c = qobject_cast<AbstractClient*>(t)) { | ||||
198 | const QVariantMap ret{ | ||||
199 | {QStringLiteral("resourceClass"), c->resourceClass()}, | ||||
Can you use introspection to fill this QVariantMap rather than manually doing this? broulik: Can you use introspection to fill this `QVariantMap` rather than manually doing this? | |||||
We don't have properties for all of them and it's currently hand picked for what the kcm needs. graesslin: We don't have properties for all of them and it's currently hand picked for what the kcm needs. | |||||
200 | {QStringLiteral("resourceName"), c->resourceName()}, | ||||
201 | {QStringLiteral("role"), c->windowRole()}, | ||||
202 | {QStringLiteral("caption"), c->captionNormal()}, | ||||
203 | {QStringLiteral("clientMachine"), c->wmClientMachine(true)}, | ||||
204 | {QStringLiteral("type"), c->windowType()}, | ||||
205 | {QStringLiteral("x"), c->x()}, | ||||
206 | {QStringLiteral("y"), c->y()}, | ||||
207 | {QStringLiteral("width"), c->width()}, | ||||
208 | {QStringLiteral("height"), c->height()}, | ||||
209 | {QStringLiteral("x11DesktopNumber"), c->desktop()}, | ||||
210 | {QStringLiteral("minimized"), c->isMinimized()}, | ||||
211 | {QStringLiteral("shaded"), c->isShade()}, | ||||
212 | {QStringLiteral("fullscreen"), c->isFullScreen()}, | ||||
213 | {QStringLiteral("keepAbove"), c->keepAbove()}, | ||||
214 | {QStringLiteral("keepBelow"), c->keepBelow()}, | ||||
215 | {QStringLiteral("noBorder"), c->noBorder()}, | ||||
216 | {QStringLiteral("skipTaskbar"), c->skipTaskbar()}, | ||||
217 | {QStringLiteral("skipPager"), c->skipPager()}, | ||||
218 | {QStringLiteral("skipSwitcher"), c->skipSwitcher()}, | ||||
219 | {QStringLiteral("maximizeHorizontal"), c->maximizeMode() & MaximizeHorizontal}, | ||||
220 | {QStringLiteral("maximizeVertical"), c->maximizeMode() & MaximizeVertical} | ||||
221 | }; | ||||
222 | QDBusConnection::sessionBus().send(m_replyQueryWindowInfo.createReply(ret)); | ||||
223 | } else { | ||||
224 | QDBusConnection::sessionBus().send(m_replyQueryWindowInfo.createErrorReply(QString(), QString())); | ||||
225 | } | ||||
226 | } | ||||
227 | ); | ||||
228 | return QVariantMap{}; | ||||
229 | } | ||||
230 | | ||||
190 | CompositorDBusInterface::CompositorDBusInterface(Compositor *parent) | 231 | CompositorDBusInterface::CompositorDBusInterface(Compositor *parent) | ||
191 | : QObject(parent) | 232 | : QObject(parent) | ||
192 | , m_compositor(parent) | 233 | , m_compositor(parent) | ||
193 | { | 234 | { | ||
194 | connect(m_compositor, &Compositor::compositingToggled, this, &CompositorDBusInterface::compositingToggled); | 235 | connect(m_compositor, &Compositor::compositingToggled, this, &CompositorDBusInterface::compositingToggled); | ||
195 | new CompositingAdaptor(this); | 236 | new CompositingAdaptor(this); | ||
196 | QDBusConnection dbus = QDBusConnection::sessionBus(); | 237 | QDBusConnection dbus = QDBusConnection::sessionBus(); | ||
197 | dbus.registerObject(QStringLiteral("/Compositor"), this); | 238 | dbus.registerObject(QStringLiteral("/Compositor"), this); | ||
▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines |
can you add:
if (m_replyQuery...) {sendError()}
otherwise if a user makes two calls without selecting a window inbetween the first call will just never get a response