Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/test_helpers.cpp
Show All 33 Lines | |||||
34 | #include <KWayland/Client/server_decoration.h> | 34 | #include <KWayland/Client/server_decoration.h> | ||
35 | #include <KWayland/Client/shadow.h> | 35 | #include <KWayland/Client/shadow.h> | ||
36 | #include <KWayland/Client/shell.h> | 36 | #include <KWayland/Client/shell.h> | ||
37 | #include <KWayland/Client/shm_pool.h> | 37 | #include <KWayland/Client/shm_pool.h> | ||
38 | #include <KWayland/Client/output.h> | 38 | #include <KWayland/Client/output.h> | ||
39 | #include <KWayland/Client/surface.h> | 39 | #include <KWayland/Client/surface.h> | ||
40 | #include <KWayland/Client/appmenu.h> | 40 | #include <KWayland/Client/appmenu.h> | ||
41 | #include <KWayland/Client/xdgshell.h> | 41 | #include <KWayland/Client/xdgshell.h> | ||
42 | #include <KWayland/Client/xdgdecoration.h> | ||||
42 | #include <KWayland/Server/display.h> | 43 | #include <KWayland/Server/display.h> | ||
43 | 44 | | |||
44 | //screenlocker | 45 | //screenlocker | ||
45 | #include <KScreenLocker/KsldApp> | 46 | #include <KScreenLocker/KsldApp> | ||
46 | 47 | | |||
47 | #include <QThread> | 48 | #include <QThread> | ||
48 | 49 | | |||
49 | // system | 50 | // system | ||
Show All 23 Lines | 62 | static struct { | |||
73 | PlasmaShell *plasmaShell = nullptr; | 74 | PlasmaShell *plasmaShell = nullptr; | ||
74 | PlasmaWindowManagement *windowManagement = nullptr; | 75 | PlasmaWindowManagement *windowManagement = nullptr; | ||
75 | PointerConstraints *pointerConstraints = nullptr; | 76 | PointerConstraints *pointerConstraints = nullptr; | ||
76 | Registry *registry = nullptr; | 77 | Registry *registry = nullptr; | ||
77 | QThread *thread = nullptr; | 78 | QThread *thread = nullptr; | ||
78 | QVector<Output*> outputs; | 79 | QVector<Output*> outputs; | ||
79 | IdleInhibitManager *idleInhibit = nullptr; | 80 | IdleInhibitManager *idleInhibit = nullptr; | ||
80 | AppMenuManager *appMenu = nullptr; | 81 | AppMenuManager *appMenu = nullptr; | ||
82 | XdgDecorationManager *xdgDecoration = nullptr; | ||||
81 | } s_waylandConnection; | 83 | } s_waylandConnection; | ||
82 | 84 | | |||
83 | bool setupWaylandConnection(AdditionalWaylandInterfaces flags) | 85 | bool setupWaylandConnection(AdditionalWaylandInterfaces flags) | ||
84 | { | 86 | { | ||
85 | if (s_waylandConnection.connection) { | 87 | if (s_waylandConnection.connection) { | ||
86 | return false; | 88 | return false; | ||
87 | } | 89 | } | ||
88 | 90 | | |||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Line(s) | 210 | if (flags.testFlag(AdditionalWaylandInterface::IdleInhibition)) { | |||
213 | } | 215 | } | ||
214 | } | 216 | } | ||
215 | if (flags.testFlag(AdditionalWaylandInterface::AppMenu)) { | 217 | if (flags.testFlag(AdditionalWaylandInterface::AppMenu)) { | ||
216 | s_waylandConnection.appMenu = registry->createAppMenuManager(registry->interface(Registry::Interface::AppMenu).name, registry->interface(Registry::Interface::AppMenu).version); | 218 | s_waylandConnection.appMenu = registry->createAppMenuManager(registry->interface(Registry::Interface::AppMenu).name, registry->interface(Registry::Interface::AppMenu).version); | ||
217 | if (!s_waylandConnection.appMenu->isValid()) { | 219 | if (!s_waylandConnection.appMenu->isValid()) { | ||
218 | return false; | 220 | return false; | ||
219 | } | 221 | } | ||
220 | } | 222 | } | ||
223 | if (flags.testFlag(AdditionalWaylandInterface::XdgDecoration)) { | ||||
224 | s_waylandConnection.xdgDecoration = registry->createXdgDecorationManager(registry->interface(Registry::Interface::XdgDecorationUnstableV1).name, registry->interface(Registry::Interface::XdgDecorationUnstableV1).version); | ||||
225 | if (!s_waylandConnection.xdgDecoration->isValid()) { | ||||
226 | return false; | ||||
227 | } | ||||
228 | } | ||||
221 | 229 | | |||
222 | return true; | 230 | return true; | ||
223 | } | 231 | } | ||
224 | 232 | | |||
225 | void destroyWaylandConnection() | 233 | void destroyWaylandConnection() | ||
226 | { | 234 | { | ||
227 | delete s_waylandConnection.compositor; | 235 | delete s_waylandConnection.compositor; | ||
228 | s_waylandConnection.compositor = nullptr; | 236 | s_waylandConnection.compositor = nullptr; | ||
Show All 24 Lines | |||||
253 | delete s_waylandConnection.shm; | 261 | delete s_waylandConnection.shm; | ||
254 | s_waylandConnection.shm = nullptr; | 262 | s_waylandConnection.shm = nullptr; | ||
255 | delete s_waylandConnection.queue; | 263 | delete s_waylandConnection.queue; | ||
256 | s_waylandConnection.queue = nullptr; | 264 | s_waylandConnection.queue = nullptr; | ||
257 | delete s_waylandConnection.registry; | 265 | delete s_waylandConnection.registry; | ||
258 | s_waylandConnection.registry = nullptr; | 266 | s_waylandConnection.registry = nullptr; | ||
259 | delete s_waylandConnection.appMenu; | 267 | delete s_waylandConnection.appMenu; | ||
260 | s_waylandConnection.appMenu = nullptr; | 268 | s_waylandConnection.appMenu = nullptr; | ||
269 | delete s_waylandConnection.xdgDecoration; | ||||
270 | s_waylandConnection.xdgDecoration = nullptr; | ||||
261 | if (s_waylandConnection.thread) { | 271 | if (s_waylandConnection.thread) { | ||
262 | QSignalSpy spy(s_waylandConnection.connection, &QObject::destroyed); | 272 | QSignalSpy spy(s_waylandConnection.connection, &QObject::destroyed); | ||
263 | s_waylandConnection.connection->deleteLater(); | 273 | s_waylandConnection.connection->deleteLater(); | ||
264 | if (spy.isEmpty()) { | 274 | if (spy.isEmpty()) { | ||
265 | QVERIFY(spy.wait()); | 275 | QVERIFY(spy.wait()); | ||
266 | } | 276 | } | ||
267 | s_waylandConnection.thread->quit(); | 277 | s_waylandConnection.thread->quit(); | ||
268 | s_waylandConnection.thread->wait(); | 278 | s_waylandConnection.thread->wait(); | ||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | 336 | { | |||
327 | return s_waylandConnection.idleInhibit; | 337 | return s_waylandConnection.idleInhibit; | ||
328 | } | 338 | } | ||
329 | 339 | | |||
330 | AppMenuManager* waylandAppMenuManager() | 340 | AppMenuManager* waylandAppMenuManager() | ||
331 | { | 341 | { | ||
332 | return s_waylandConnection.appMenu; | 342 | return s_waylandConnection.appMenu; | ||
333 | } | 343 | } | ||
334 | 344 | | |||
345 | XdgDecorationManager *xdgDecorationManager() | ||||
346 | { | ||||
347 | return s_waylandConnection.xdgDecoration; | ||||
348 | } | ||||
349 | | ||||
350 | | ||||
335 | bool waitForWaylandPointer() | 351 | bool waitForWaylandPointer() | ||
336 | { | 352 | { | ||
337 | if (!s_waylandConnection.seat) { | 353 | if (!s_waylandConnection.seat) { | ||
338 | return false; | 354 | return false; | ||
339 | } | 355 | } | ||
340 | QSignalSpy hasPointerSpy(s_waylandConnection.seat, &Seat::hasPointerChanged); | 356 | QSignalSpy hasPointerSpy(s_waylandConnection.seat, &Seat::hasPointerChanged); | ||
341 | if (!hasPointerSpy.isValid()) { | 357 | if (!hasPointerSpy.isValid()) { | ||
342 | return false; | 358 | return false; | ||
▲ Show 20 Lines • Show All 248 Lines • Show Last 20 Lines |