Changeset View
Changeset View
Standalone View
Standalone View
autotests/integration/test_helpers.cpp
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | |||||
62 | 62 | | |||
63 | static struct { | 63 | static struct { | ||
64 | ConnectionThread *connection = nullptr; | 64 | ConnectionThread *connection = nullptr; | ||
65 | EventQueue *queue = nullptr; | 65 | EventQueue *queue = nullptr; | ||
66 | Compositor *compositor = nullptr; | 66 | Compositor *compositor = nullptr; | ||
67 | SubCompositor *subCompositor = nullptr; | 67 | SubCompositor *subCompositor = nullptr; | ||
68 | ServerSideDecorationManager *decoration = nullptr; | 68 | ServerSideDecorationManager *decoration = nullptr; | ||
69 | ShadowManager *shadowManager = nullptr; | 69 | ShadowManager *shadowManager = nullptr; | ||
70 | XdgShell *xdgShellV5 = nullptr; | | |||
71 | XdgShell *xdgShellV6 = nullptr; | 70 | XdgShell *xdgShellV6 = nullptr; | ||
72 | XdgShell *xdgShellStable = nullptr; | 71 | XdgShell *xdgShellStable = nullptr; | ||
73 | ShmPool *shm = nullptr; | 72 | ShmPool *shm = nullptr; | ||
74 | Seat *seat = nullptr; | 73 | Seat *seat = nullptr; | ||
75 | PlasmaShell *plasmaShell = nullptr; | 74 | PlasmaShell *plasmaShell = nullptr; | ||
76 | PlasmaWindowManagement *windowManagement = nullptr; | 75 | PlasmaWindowManagement *windowManagement = nullptr; | ||
77 | PointerConstraints *pointerConstraints = nullptr; | 76 | PointerConstraints *pointerConstraints = nullptr; | ||
78 | Registry *registry = nullptr; | 77 | Registry *registry = nullptr; | ||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | 86 | { | |||
150 | s_waylandConnection.subCompositor = registry->createSubCompositor(registry->interface(Registry::Interface::SubCompositor).name, registry->interface(Registry::Interface::SubCompositor).version); | 149 | s_waylandConnection.subCompositor = registry->createSubCompositor(registry->interface(Registry::Interface::SubCompositor).name, registry->interface(Registry::Interface::SubCompositor).version); | ||
151 | if (!s_waylandConnection.subCompositor->isValid()) { | 150 | if (!s_waylandConnection.subCompositor->isValid()) { | ||
152 | return false; | 151 | return false; | ||
153 | } | 152 | } | ||
154 | s_waylandConnection.shm = registry->createShmPool(registry->interface(Registry::Interface::Shm).name, registry->interface(Registry::Interface::Shm).version); | 153 | s_waylandConnection.shm = registry->createShmPool(registry->interface(Registry::Interface::Shm).name, registry->interface(Registry::Interface::Shm).version); | ||
155 | if (!s_waylandConnection.shm->isValid()) { | 154 | if (!s_waylandConnection.shm->isValid()) { | ||
156 | return false; | 155 | return false; | ||
157 | } | 156 | } | ||
158 | s_waylandConnection.xdgShellV5 = registry->createXdgShell(registry->interface(Registry::Interface::XdgShellUnstableV5).name, registry->interface(Registry::Interface::XdgShellUnstableV5).version); | | |||
159 | if (!s_waylandConnection.xdgShellV5->isValid()) { | | |||
160 | return false; | | |||
161 | } | | |||
162 | s_waylandConnection.xdgShellV6 = registry->createXdgShell(registry->interface(Registry::Interface::XdgShellUnstableV6).name, registry->interface(Registry::Interface::XdgShellUnstableV6).version); | 157 | s_waylandConnection.xdgShellV6 = registry->createXdgShell(registry->interface(Registry::Interface::XdgShellUnstableV6).name, registry->interface(Registry::Interface::XdgShellUnstableV6).version); | ||
163 | if (!s_waylandConnection.xdgShellV6->isValid()) { | 158 | if (!s_waylandConnection.xdgShellV6->isValid()) { | ||
164 | return false; | 159 | return false; | ||
165 | } | 160 | } | ||
166 | s_waylandConnection.xdgShellStable = registry->createXdgShell(registry->interface(Registry::Interface::XdgShellStable).name, registry->interface(Registry::Interface::XdgShellStable).version); | 161 | s_waylandConnection.xdgShellStable = registry->createXdgShell(registry->interface(Registry::Interface::XdgShellStable).name, registry->interface(Registry::Interface::XdgShellStable).version); | ||
167 | if (!s_waylandConnection.xdgShellStable->isValid()) { | 162 | if (!s_waylandConnection.xdgShellStable->isValid()) { | ||
168 | return false; | 163 | return false; | ||
169 | } | 164 | } | ||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | 230 | { | |||
244 | delete s_waylandConnection.decoration; | 239 | delete s_waylandConnection.decoration; | ||
245 | s_waylandConnection.decoration = nullptr; | 240 | s_waylandConnection.decoration = nullptr; | ||
246 | delete s_waylandConnection.decoration; | 241 | delete s_waylandConnection.decoration; | ||
247 | s_waylandConnection.decoration = nullptr; | 242 | s_waylandConnection.decoration = nullptr; | ||
248 | delete s_waylandConnection.seat; | 243 | delete s_waylandConnection.seat; | ||
249 | s_waylandConnection.seat = nullptr; | 244 | s_waylandConnection.seat = nullptr; | ||
250 | delete s_waylandConnection.pointerConstraints; | 245 | delete s_waylandConnection.pointerConstraints; | ||
251 | s_waylandConnection.pointerConstraints = nullptr; | 246 | s_waylandConnection.pointerConstraints = nullptr; | ||
252 | delete s_waylandConnection.xdgShellV5; | | |||
253 | s_waylandConnection.xdgShellV5 = nullptr; | | |||
254 | delete s_waylandConnection.xdgShellV6; | 247 | delete s_waylandConnection.xdgShellV6; | ||
255 | s_waylandConnection.xdgShellV6 = nullptr; | 248 | s_waylandConnection.xdgShellV6 = nullptr; | ||
256 | delete s_waylandConnection.xdgShellStable; | 249 | delete s_waylandConnection.xdgShellStable; | ||
257 | s_waylandConnection.xdgShellStable = nullptr; | 250 | s_waylandConnection.xdgShellStable = nullptr; | ||
258 | delete s_waylandConnection.shadowManager; | 251 | delete s_waylandConnection.shadowManager; | ||
259 | s_waylandConnection.shadowManager = nullptr; | 252 | s_waylandConnection.shadowManager = nullptr; | ||
260 | delete s_waylandConnection.idleInhibit; | 253 | delete s_waylandConnection.idleInhibit; | ||
261 | s_waylandConnection.idleInhibit = nullptr; | 254 | s_waylandConnection.idleInhibit = nullptr; | ||
▲ Show 20 Lines • Show All 191 Lines • ▼ Show 20 Line(s) | 442 | { | |||
453 | auto s = s_waylandConnection.subCompositor->createSubSurface(surface, parentSurface, parent); | 446 | auto s = s_waylandConnection.subCompositor->createSubSurface(surface, parentSurface, parent); | ||
454 | if (!s->isValid()) { | 447 | if (!s->isValid()) { | ||
455 | delete s; | 448 | delete s; | ||
456 | return nullptr; | 449 | return nullptr; | ||
457 | } | 450 | } | ||
458 | return s; | 451 | return s; | ||
459 | } | 452 | } | ||
460 | 453 | | |||
461 | XdgShellSurface *createXdgShellV5Surface(Surface *surface, QObject *parent, CreationSetup creationSetup) | | |||
462 | { | | |||
463 | if (!s_waylandConnection.xdgShellV5) { | | |||
464 | return nullptr; | | |||
465 | } | | |||
466 | auto s = s_waylandConnection.xdgShellV5->createSurface(surface, parent); | | |||
467 | if (!s->isValid()) { | | |||
468 | delete s; | | |||
469 | return nullptr; | | |||
470 | } | | |||
471 | if (creationSetup == CreationSetup::CreateAndConfigure) { | | |||
472 | initXdgShellSurface(surface, s); | | |||
473 | } | | |||
474 | return s; | | |||
475 | } | | |||
476 | | ||||
477 | XdgShellSurface *createXdgShellV6Surface(Surface *surface, QObject *parent, CreationSetup creationSetup) | 454 | XdgShellSurface *createXdgShellV6Surface(Surface *surface, QObject *parent, CreationSetup creationSetup) | ||
478 | { | 455 | { | ||
479 | if (!s_waylandConnection.xdgShellV6) { | 456 | if (!s_waylandConnection.xdgShellV6) { | ||
480 | return nullptr; | 457 | return nullptr; | ||
481 | } | 458 | } | ||
482 | auto s = s_waylandConnection.xdgShellV6->createSurface(surface, parent); | 459 | auto s = s_waylandConnection.xdgShellV6->createSurface(surface, parent); | ||
483 | if (!s->isValid()) { | 460 | if (!s->isValid()) { | ||
484 | delete s; | 461 | delete s; | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 513 | { | |||
540 | surface->commit(Surface::CommitFlag::None); | 517 | surface->commit(Surface::CommitFlag::None); | ||
541 | QVERIFY(configureRequestedSpy.wait()); | 518 | QVERIFY(configureRequestedSpy.wait()); | ||
542 | shellPopup->ackConfigure(configureRequestedSpy.last()[1].toInt()); | 519 | shellPopup->ackConfigure(configureRequestedSpy.last()[1].toInt()); | ||
543 | } | 520 | } | ||
544 | 521 | | |||
545 | KWayland::Client::XdgShellSurface *createXdgShellSurface(XdgShellSurfaceType type, KWayland::Client::Surface *surface, QObject *parent, CreationSetup creationSetup) | 522 | KWayland::Client::XdgShellSurface *createXdgShellSurface(XdgShellSurfaceType type, KWayland::Client::Surface *surface, QObject *parent, CreationSetup creationSetup) | ||
546 | { | 523 | { | ||
547 | switch (type) { | 524 | switch (type) { | ||
548 | case XdgShellSurfaceType::XdgShellV5: | | |||
549 | return createXdgShellV5Surface(surface, parent, creationSetup); | | |||
550 | case XdgShellSurfaceType::XdgShellV6: | 525 | case XdgShellSurfaceType::XdgShellV6: | ||
551 | return createXdgShellV6Surface(surface, parent, creationSetup); | 526 | return createXdgShellV6Surface(surface, parent, creationSetup); | ||
552 | case XdgShellSurfaceType::XdgShellStable: | 527 | case XdgShellSurfaceType::XdgShellStable: | ||
553 | return createXdgShellStableSurface(surface, parent, creationSetup); | 528 | return createXdgShellStableSurface(surface, parent, creationSetup); | ||
554 | default: | 529 | default: | ||
555 | return nullptr; | 530 | return nullptr; | ||
556 | } | 531 | } | ||
557 | } | 532 | } | ||
▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines |