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) | 61 | static struct { | |||
---|---|---|---|---|---|
62 | ConnectionThread *connection = nullptr; | 62 | ConnectionThread *connection = nullptr; | ||
63 | EventQueue *queue = nullptr; | 63 | EventQueue *queue = nullptr; | ||
64 | Compositor *compositor = nullptr; | 64 | Compositor *compositor = nullptr; | ||
65 | ServerSideDecorationManager *decoration = nullptr; | 65 | ServerSideDecorationManager *decoration = nullptr; | ||
66 | ShadowManager *shadowManager = nullptr; | 66 | ShadowManager *shadowManager = nullptr; | ||
67 | Shell *shell = nullptr; | 67 | Shell *shell = nullptr; | ||
68 | XdgShell *xdgShellV5 = nullptr; | 68 | XdgShell *xdgShellV5 = nullptr; | ||
69 | XdgShell *xdgShellV6 = nullptr; | 69 | XdgShell *xdgShellV6 = nullptr; | ||
70 | XdgShell *xdgShellStable = nullptr; | ||||
70 | ShmPool *shm = nullptr; | 71 | ShmPool *shm = nullptr; | ||
71 | Seat *seat = nullptr; | 72 | Seat *seat = nullptr; | ||
72 | PlasmaShell *plasmaShell = nullptr; | 73 | PlasmaShell *plasmaShell = nullptr; | ||
73 | PlasmaWindowManagement *windowManagement = nullptr; | 74 | PlasmaWindowManagement *windowManagement = nullptr; | ||
74 | PointerConstraints *pointerConstraints = nullptr; | 75 | PointerConstraints *pointerConstraints = nullptr; | ||
75 | Registry *registry = nullptr; | 76 | Registry *registry = nullptr; | ||
76 | QThread *thread = nullptr; | 77 | QThread *thread = nullptr; | ||
77 | QVector<Output*> outputs; | 78 | QVector<Output*> outputs; | ||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Line(s) | 84 | { | |||
154 | s_waylandConnection.xdgShellV5 = registry->createXdgShell(registry->interface(Registry::Interface::XdgShellUnstableV5).name, registry->interface(Registry::Interface::XdgShellUnstableV5).version); | 155 | s_waylandConnection.xdgShellV5 = registry->createXdgShell(registry->interface(Registry::Interface::XdgShellUnstableV5).name, registry->interface(Registry::Interface::XdgShellUnstableV5).version); | ||
155 | if (!s_waylandConnection.xdgShellV5->isValid()) { | 156 | if (!s_waylandConnection.xdgShellV5->isValid()) { | ||
156 | return false; | 157 | return false; | ||
157 | } | 158 | } | ||
158 | s_waylandConnection.xdgShellV6 = registry->createXdgShell(registry->interface(Registry::Interface::XdgShellUnstableV6).name, registry->interface(Registry::Interface::XdgShellUnstableV6).version); | 159 | s_waylandConnection.xdgShellV6 = registry->createXdgShell(registry->interface(Registry::Interface::XdgShellUnstableV6).name, registry->interface(Registry::Interface::XdgShellUnstableV6).version); | ||
159 | if (!s_waylandConnection.xdgShellV6->isValid()) { | 160 | if (!s_waylandConnection.xdgShellV6->isValid()) { | ||
160 | return false; | 161 | return false; | ||
161 | } | 162 | } | ||
163 | s_waylandConnection.xdgShellStable = registry->createXdgShell(registry->interface(Registry::Interface::XdgShellStable).name, registry->interface(Registry::Interface::XdgShellStable).version); | ||||
164 | if (!s_waylandConnection.xdgShellStable->isValid()) { | ||||
165 | return false; | ||||
166 | } | ||||
162 | if (flags.testFlag(AdditionalWaylandInterface::Seat)) { | 167 | if (flags.testFlag(AdditionalWaylandInterface::Seat)) { | ||
163 | s_waylandConnection.seat = registry->createSeat(registry->interface(Registry::Interface::Seat).name, registry->interface(Registry::Interface::Seat).version); | 168 | s_waylandConnection.seat = registry->createSeat(registry->interface(Registry::Interface::Seat).name, registry->interface(Registry::Interface::Seat).version); | ||
164 | if (!s_waylandConnection.seat->isValid()) { | 169 | if (!s_waylandConnection.seat->isValid()) { | ||
165 | return false; | 170 | return false; | ||
166 | } | 171 | } | ||
167 | } | 172 | } | ||
168 | if (flags.testFlag(AdditionalWaylandInterface::ShadowManager)) { | 173 | if (flags.testFlag(AdditionalWaylandInterface::ShadowManager)) { | ||
169 | s_waylandConnection.shadowManager = registry->createShadowManager(registry->interface(Registry::Interface::Shadow).name, | 174 | s_waylandConnection.shadowManager = registry->createShadowManager(registry->interface(Registry::Interface::Shadow).name, | ||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 226 | { | |||
232 | delete s_waylandConnection.seat; | 237 | delete s_waylandConnection.seat; | ||
233 | s_waylandConnection.seat = nullptr; | 238 | s_waylandConnection.seat = nullptr; | ||
234 | delete s_waylandConnection.pointerConstraints; | 239 | delete s_waylandConnection.pointerConstraints; | ||
235 | s_waylandConnection.pointerConstraints = nullptr; | 240 | s_waylandConnection.pointerConstraints = nullptr; | ||
236 | delete s_waylandConnection.xdgShellV5; | 241 | delete s_waylandConnection.xdgShellV5; | ||
237 | s_waylandConnection.xdgShellV5 = nullptr; | 242 | s_waylandConnection.xdgShellV5 = nullptr; | ||
238 | delete s_waylandConnection.xdgShellV6; | 243 | delete s_waylandConnection.xdgShellV6; | ||
239 | s_waylandConnection.xdgShellV6 = nullptr; | 244 | s_waylandConnection.xdgShellV6 = nullptr; | ||
245 | delete s_waylandConnection.xdgShellStable; | ||||
246 | s_waylandConnection.xdgShellStable = nullptr; | ||||
240 | delete s_waylandConnection.shell; | 247 | delete s_waylandConnection.shell; | ||
241 | s_waylandConnection.shell = nullptr; | 248 | s_waylandConnection.shell = nullptr; | ||
242 | delete s_waylandConnection.shadowManager; | 249 | delete s_waylandConnection.shadowManager; | ||
243 | s_waylandConnection.shadowManager = nullptr; | 250 | s_waylandConnection.shadowManager = nullptr; | ||
244 | delete s_waylandConnection.idleInhibit; | 251 | delete s_waylandConnection.idleInhibit; | ||
245 | s_waylandConnection.idleInhibit = nullptr; | 252 | s_waylandConnection.idleInhibit = nullptr; | ||
246 | delete s_waylandConnection.shm; | 253 | delete s_waylandConnection.shm; | ||
247 | s_waylandConnection.shm = nullptr; | 254 | s_waylandConnection.shm = nullptr; | ||
▲ Show 20 Lines • Show All 207 Lines • ▼ Show 20 Line(s) | 458 | { | |||
455 | auto s = s_waylandConnection.xdgShellV6->createSurface(surface, parent); | 462 | auto s = s_waylandConnection.xdgShellV6->createSurface(surface, parent); | ||
456 | if (!s->isValid()) { | 463 | if (!s->isValid()) { | ||
457 | delete s; | 464 | delete s; | ||
458 | return nullptr; | 465 | return nullptr; | ||
459 | } | 466 | } | ||
460 | return s; | 467 | return s; | ||
461 | } | 468 | } | ||
462 | 469 | | |||
470 | XdgShellSurface *createXdgShellStableSurface(Surface *surface, QObject *parent) | ||||
471 | { | ||||
472 | if (!s_waylandConnection.xdgShellStable) { | ||||
473 | return nullptr; | ||||
474 | } | ||||
475 | auto s = s_waylandConnection.xdgShellStable->createSurface(surface, parent); | ||||
476 | if (!s->isValid()) { | ||||
477 | delete s; | ||||
478 | return nullptr; | ||||
479 | } | ||||
480 | return s; | ||||
481 | } | ||||
482 | | ||||
463 | QObject *createShellSurface(ShellSurfaceType type, KWayland::Client::Surface *surface, QObject *parent) | 483 | QObject *createShellSurface(ShellSurfaceType type, KWayland::Client::Surface *surface, QObject *parent) | ||
464 | { | 484 | { | ||
465 | switch (type) { | 485 | switch (type) { | ||
466 | case ShellSurfaceType::WlShell: | 486 | case ShellSurfaceType::WlShell: | ||
467 | return createShellSurface(surface, parent); | 487 | return createShellSurface(surface, parent); | ||
468 | case ShellSurfaceType::XdgShellV5: | 488 | case ShellSurfaceType::XdgShellV5: | ||
469 | return createXdgShellV5Surface(surface, parent); | 489 | return createXdgShellV5Surface(surface, parent); | ||
470 | case ShellSurfaceType::XdgShellV6: | 490 | case ShellSurfaceType::XdgShellV6: | ||
471 | return createXdgShellV6Surface(surface, parent); | 491 | return createXdgShellV6Surface(surface, parent); | ||
492 | case ShellSurfaceType::XdgShellStable: | ||||
493 | return createXdgShellStableSurface(surface, parent); | ||||
472 | default: | 494 | default: | ||
473 | Q_UNREACHABLE(); | 495 | Q_UNREACHABLE(); | ||
474 | return nullptr; | 496 | return nullptr; | ||
475 | } | 497 | } | ||
476 | } | 498 | } | ||
477 | 499 | | |||
478 | bool waitForWindowDestroyed(AbstractClient *client) | 500 | bool waitForWindowDestroyed(AbstractClient *client) | ||
479 | { | 501 | { | ||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |