Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/test_helpers.cpp
Show All 30 Lines | |||||
31 | #include <KWayland/Client/plasmawindowmanagement.h> | 31 | #include <KWayland/Client/plasmawindowmanagement.h> | ||
32 | #include <KWayland/Client/pointerconstraints.h> | 32 | #include <KWayland/Client/pointerconstraints.h> | ||
33 | #include <KWayland/Client/seat.h> | 33 | #include <KWayland/Client/seat.h> | ||
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/subcompositor.h> | ||||
40 | #include <KWayland/Client/subsurface.h> | ||||
39 | #include <KWayland/Client/surface.h> | 41 | #include <KWayland/Client/surface.h> | ||
40 | #include <KWayland/Client/appmenu.h> | 42 | #include <KWayland/Client/appmenu.h> | ||
41 | #include <KWayland/Client/xdgshell.h> | 43 | #include <KWayland/Client/xdgshell.h> | ||
42 | #include <KWayland/Client/xdgdecoration.h> | 44 | #include <KWayland/Client/xdgdecoration.h> | ||
43 | #include <KWayland/Server/display.h> | 45 | #include <KWayland/Server/display.h> | ||
44 | 46 | | |||
45 | //screenlocker | 47 | //screenlocker | ||
46 | #include <KScreenLocker/KsldApp> | 48 | #include <KScreenLocker/KsldApp> | ||
Show All 11 Lines | |||||
58 | { | 60 | { | ||
59 | namespace Test | 61 | namespace Test | ||
60 | { | 62 | { | ||
61 | 63 | | |||
62 | static struct { | 64 | static struct { | ||
63 | ConnectionThread *connection = nullptr; | 65 | ConnectionThread *connection = nullptr; | ||
64 | EventQueue *queue = nullptr; | 66 | EventQueue *queue = nullptr; | ||
65 | Compositor *compositor = nullptr; | 67 | Compositor *compositor = nullptr; | ||
68 | SubCompositor *subCompositor = nullptr; | ||||
66 | ServerSideDecorationManager *decoration = nullptr; | 69 | ServerSideDecorationManager *decoration = nullptr; | ||
67 | ShadowManager *shadowManager = nullptr; | 70 | ShadowManager *shadowManager = nullptr; | ||
68 | Shell *shell = nullptr; | 71 | Shell *shell = nullptr; | ||
69 | XdgShell *xdgShellV5 = nullptr; | 72 | XdgShell *xdgShellV5 = nullptr; | ||
70 | XdgShell *xdgShellV6 = nullptr; | 73 | XdgShell *xdgShellV6 = nullptr; | ||
71 | XdgShell *xdgShellStable = nullptr; | 74 | XdgShell *xdgShellStable = nullptr; | ||
72 | ShmPool *shm = nullptr; | 75 | ShmPool *shm = nullptr; | ||
73 | Seat *seat = nullptr; | 76 | Seat *seat = nullptr; | ||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | 89 | { | |||
141 | if (!allAnnounced.wait()) { | 144 | if (!allAnnounced.wait()) { | ||
142 | return false; | 145 | return false; | ||
143 | } | 146 | } | ||
144 | 147 | | |||
145 | s_waylandConnection.compositor = registry->createCompositor(registry->interface(Registry::Interface::Compositor).name, registry->interface(Registry::Interface::Compositor).version); | 148 | s_waylandConnection.compositor = registry->createCompositor(registry->interface(Registry::Interface::Compositor).name, registry->interface(Registry::Interface::Compositor).version); | ||
146 | if (!s_waylandConnection.compositor->isValid()) { | 149 | if (!s_waylandConnection.compositor->isValid()) { | ||
147 | return false; | 150 | return false; | ||
148 | } | 151 | } | ||
152 | s_waylandConnection.subCompositor = registry->createSubCompositor(registry->interface(Registry::Interface::SubCompositor).name, registry->interface(Registry::Interface::SubCompositor).version); | ||||
153 | if (!s_waylandConnection.subCompositor->isValid()) { | ||||
154 | return false; | ||||
155 | } | ||||
149 | s_waylandConnection.shm = registry->createShmPool(registry->interface(Registry::Interface::Shm).name, registry->interface(Registry::Interface::Shm).version); | 156 | s_waylandConnection.shm = registry->createShmPool(registry->interface(Registry::Interface::Shm).name, registry->interface(Registry::Interface::Shm).version); | ||
150 | if (!s_waylandConnection.shm->isValid()) { | 157 | if (!s_waylandConnection.shm->isValid()) { | ||
151 | return false; | 158 | return false; | ||
152 | } | 159 | } | ||
153 | s_waylandConnection.shell = registry->createShell(registry->interface(Registry::Interface::Shell).name, registry->interface(Registry::Interface::Shell).version); | 160 | s_waylandConnection.shell = registry->createShell(registry->interface(Registry::Interface::Shell).name, registry->interface(Registry::Interface::Shell).version); | ||
154 | if (!s_waylandConnection.shell->isValid()) { | 161 | if (!s_waylandConnection.shell->isValid()) { | ||
155 | return false; | 162 | return false; | ||
156 | } | 163 | } | ||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | |||||
229 | 236 | | |||
230 | return true; | 237 | return true; | ||
231 | } | 238 | } | ||
232 | 239 | | |||
233 | void destroyWaylandConnection() | 240 | void destroyWaylandConnection() | ||
234 | { | 241 | { | ||
235 | delete s_waylandConnection.compositor; | 242 | delete s_waylandConnection.compositor; | ||
236 | s_waylandConnection.compositor = nullptr; | 243 | s_waylandConnection.compositor = nullptr; | ||
244 | delete s_waylandConnection.subCompositor; | ||||
245 | s_waylandConnection.subCompositor = nullptr; | ||||
237 | delete s_waylandConnection.windowManagement; | 246 | delete s_waylandConnection.windowManagement; | ||
238 | s_waylandConnection.windowManagement = nullptr; | 247 | s_waylandConnection.windowManagement = nullptr; | ||
239 | delete s_waylandConnection.plasmaShell; | 248 | delete s_waylandConnection.plasmaShell; | ||
240 | s_waylandConnection.plasmaShell = nullptr; | 249 | s_waylandConnection.plasmaShell = nullptr; | ||
241 | delete s_waylandConnection.decoration; | 250 | delete s_waylandConnection.decoration; | ||
242 | s_waylandConnection.decoration = nullptr; | 251 | s_waylandConnection.decoration = nullptr; | ||
243 | delete s_waylandConnection.decoration; | 252 | delete s_waylandConnection.decoration; | ||
244 | s_waylandConnection.decoration = nullptr; | 253 | s_waylandConnection.decoration = nullptr; | ||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 295 | { | |||
287 | return s_waylandConnection.connection; | 296 | return s_waylandConnection.connection; | ||
288 | } | 297 | } | ||
289 | 298 | | |||
290 | Compositor *waylandCompositor() | 299 | Compositor *waylandCompositor() | ||
291 | { | 300 | { | ||
292 | return s_waylandConnection.compositor; | 301 | return s_waylandConnection.compositor; | ||
293 | } | 302 | } | ||
294 | 303 | | |||
304 | SubCompositor *waylandSubCompositor() | ||||
305 | { | ||||
306 | return s_waylandConnection.subCompositor; | ||||
307 | } | ||||
308 | | ||||
295 | ShadowManager *waylandShadowManager() | 309 | ShadowManager *waylandShadowManager() | ||
296 | { | 310 | { | ||
297 | return s_waylandConnection.shadowManager; | 311 | return s_waylandConnection.shadowManager; | ||
298 | } | 312 | } | ||
299 | 313 | | |||
300 | Shell *waylandShell() | 314 | Shell *waylandShell() | ||
301 | { | 315 | { | ||
302 | return s_waylandConnection.shell; | 316 | return s_waylandConnection.shell; | ||
▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Line(s) | 449 | { | |||
439 | auto s = s_waylandConnection.compositor->createSurface(parent); | 453 | auto s = s_waylandConnection.compositor->createSurface(parent); | ||
440 | if (!s->isValid()) { | 454 | if (!s->isValid()) { | ||
441 | delete s; | 455 | delete s; | ||
442 | return nullptr; | 456 | return nullptr; | ||
443 | } | 457 | } | ||
444 | return s; | 458 | return s; | ||
445 | } | 459 | } | ||
446 | 460 | | |||
461 | SubSurface *createSubSurface(Surface *surface, Surface *parentSurface, QObject *parent) | ||||
462 | { | ||||
463 | if (!s_waylandConnection.subCompositor) { | ||||
464 | return nullptr; | ||||
465 | } | ||||
466 | auto s = s_waylandConnection.subCompositor->createSubSurface(surface, parentSurface, parent); | ||||
467 | if (!s->isValid()) { | ||||
468 | delete s; | ||||
469 | return nullptr; | ||||
470 | } | ||||
471 | return s; | ||||
472 | } | ||||
473 | | ||||
447 | ShellSurface *createShellSurface(Surface *surface, QObject *parent) | 474 | ShellSurface *createShellSurface(Surface *surface, QObject *parent) | ||
448 | { | 475 | { | ||
449 | if (!s_waylandConnection.shell) { | 476 | if (!s_waylandConnection.shell) { | ||
450 | return nullptr; | 477 | return nullptr; | ||
451 | } | 478 | } | ||
452 | auto s = s_waylandConnection.shell->createSurface(surface, parent); | 479 | auto s = s_waylandConnection.shell->createSurface(surface, parent); | ||
453 | if (!s->isValid()) { | 480 | if (!s->isValid()) { | ||
454 | delete s; | 481 | delete s; | ||
▲ Show 20 Lines • Show All 152 Lines • Show Last 20 Lines |