Changeset View
Changeset View
Standalone View
Standalone View
src/windowsystem/waylandintegration.cpp
Show All 20 Lines | |||||
21 | 21 | | |||
22 | #include "waylandintegration.h" | 22 | #include "waylandintegration.h" | ||
23 | #include "logging.h" | 23 | #include "logging.h" | ||
24 | 24 | | |||
25 | #include <KWayland/Client/connection_thread.h> | 25 | #include <KWayland/Client/connection_thread.h> | ||
26 | #include <KWayland/Client/registry.h> | 26 | #include <KWayland/Client/registry.h> | ||
27 | #include <KWayland/Client/compositor.h> | 27 | #include <KWayland/Client/compositor.h> | ||
28 | #include <KWayland/Client/plasmawindowmanagement.h> | 28 | #include <KWayland/Client/plasmawindowmanagement.h> | ||
29 | #include <KWayland/Client/plasmashell.h> | ||||
29 | #include <KWayland/Client/surface.h> | 30 | #include <KWayland/Client/surface.h> | ||
30 | #include <KWayland/Client/blur.h> | 31 | #include <KWayland/Client/blur.h> | ||
31 | #include <KWayland/Client/contrast.h> | 32 | #include <KWayland/Client/contrast.h> | ||
32 | #include <KWayland/Client/region.h> | 33 | #include <KWayland/Client/region.h> | ||
33 | #include <KWayland/Client/slide.h> | 34 | #include <KWayland/Client/slide.h> | ||
34 | 35 | | |||
35 | #include <KWindowSystem/KWindowSystem> | 36 | #include <KWindowSystem/KWindowSystem> | ||
36 | 37 | | |||
38 | #include <QGuiApplication> | ||||
39 | | ||||
37 | class WaylandIntegrationSingleton | 40 | class WaylandIntegrationSingleton | ||
38 | { | 41 | { | ||
39 | public: | 42 | public: | ||
40 | WaylandIntegration self; | 43 | WaylandIntegration self; | ||
41 | }; | 44 | }; | ||
42 | 45 | | |||
43 | Q_GLOBAL_STATIC(WaylandIntegrationSingleton, privateWaylandIntegrationSelf) | 46 | Q_GLOBAL_STATIC(WaylandIntegrationSingleton, privateWaylandIntegrationSelf) | ||
44 | 47 | | |||
Show All 13 Lines | 58 | { | |||
58 | if (!m_waylandConnection) { | 61 | if (!m_waylandConnection) { | ||
59 | qCWarning(KWAYLAND_KWS) << "Failed getting Wayland connection from QPA"; | 62 | qCWarning(KWAYLAND_KWS) << "Failed getting Wayland connection from QPA"; | ||
60 | return; | 63 | return; | ||
61 | } | 64 | } | ||
62 | m_registry = new Registry(this); | 65 | m_registry = new Registry(this); | ||
63 | m_registry->create(m_waylandConnection); | 66 | m_registry->create(m_waylandConnection); | ||
64 | m_waylandCompositor = Compositor::fromApplication(this); | 67 | m_waylandCompositor = Compositor::fromApplication(this); | ||
65 | 68 | | |||
69 | //when the Qt QPA closes it deletes the wl_display | ||||
70 | //closing wl_display deletes the wl_registry | ||||
71 | //when we destroy the kwayland wrapper we double delete | ||||
72 | //as we're a singleton we're not deleted till after qApp | ||||
73 | //we want to release our wayland parts first | ||||
74 | connect(qApp, &QCoreApplication::aboutToQuit, this, [=]() { | ||||
75 | if (m_waylandBlurManager) { | ||||
76 | m_waylandBlurManager->release(); | ||||
77 | } | ||||
78 | if (m_waylandContrastManager) { | ||||
79 | m_waylandContrastManager->release(); | ||||
graesslin: nitpick: indentation | |||||
80 | } | ||||
81 | if (m_waylandSlideManager) { | ||||
82 | m_waylandSlideManager->release(); | ||||
83 | } | ||||
84 | if (m_waylandCompositor) { | ||||
85 | m_waylandCompositor->release(); | ||||
86 | } | ||||
87 | if (m_wm) { | ||||
88 | m_wm->release(); | ||||
89 | } | ||||
90 | if (m_waylandPlasmaShell) { | ||||
91 | m_waylandPlasmaShell->release(); | ||||
92 | } | ||||
93 | m_registry->release(); | ||||
94 | }); | ||||
95 | | ||||
66 | m_registry->setup(); | 96 | m_registry->setup(); | ||
67 | m_waylandConnection->roundtrip(); | 97 | m_waylandConnection->roundtrip(); | ||
68 | } | 98 | } | ||
69 | 99 | | |||
70 | WaylandIntegration *WaylandIntegration::self() | 100 | WaylandIntegration *WaylandIntegration::self() | ||
71 | { | 101 | { | ||
72 | return &privateWaylandIntegrationSelf()->self; | 102 | return &privateWaylandIntegrationSelf()->self; | ||
73 | } | 103 | } | ||
▲ Show 20 Lines • Show All 132 Lines • Show Last 20 Lines |
nitpick: indentation