Changeset View
Changeset View
Standalone View
Standalone View
src/plasmaquick/waylandintegration.cpp
Show All 21 Lines | |||||
22 | */ | 22 | */ | ||
23 | 23 | | |||
24 | #include "waylandintegration_p.h" | 24 | #include "waylandintegration_p.h" | ||
25 | #include "debug_p.h" | 25 | #include "debug_p.h" | ||
26 | 26 | | |||
27 | #include <KWayland/Client/connection_thread.h> | 27 | #include <KWayland/Client/connection_thread.h> | ||
28 | #include <KWayland/Client/plasmashell.h> | 28 | #include <KWayland/Client/plasmashell.h> | ||
29 | #include <KWayland/Client/registry.h> | 29 | #include <KWayland/Client/registry.h> | ||
30 | #include <KWayland/Client/shadow.h> | | |||
31 | #include <KWayland/Client/shm_pool.h> | | |||
32 | 30 | | |||
33 | #include <QCoreApplication> | 31 | #include <QCoreApplication> | ||
34 | 32 | | |||
35 | class WaylandIntegrationSingleton | 33 | class WaylandIntegrationSingleton | ||
36 | { | 34 | { | ||
37 | public: | 35 | public: | ||
38 | WaylandIntegration self; | 36 | WaylandIntegration self; | ||
39 | }; | 37 | }; | ||
Show All 26 Lines | 53 | if (!m_waylandPlasmaShell && m_registry) { | |||
66 | connect(m_waylandPlasmaShell, &KWayland::Client::PlasmaShell::removed, this, [this]() { | 64 | connect(m_waylandPlasmaShell, &KWayland::Client::PlasmaShell::removed, this, [this]() { | ||
67 | m_waylandPlasmaShell->deleteLater(); | 65 | m_waylandPlasmaShell->deleteLater(); | ||
68 | }); | 66 | }); | ||
69 | } | 67 | } | ||
70 | 68 | | |||
71 | return m_waylandPlasmaShell; | 69 | return m_waylandPlasmaShell; | ||
72 | } | 70 | } | ||
73 | 71 | | |||
74 | KWayland::Client::ShadowManager *WaylandIntegration::waylandShadowManager() | | |||
75 | { | | |||
76 | if (!m_waylandShadowManager && m_registry) { | | |||
77 | const KWayland::Client::Registry::AnnouncedInterface interface = | | |||
78 | m_registry->interface(KWayland::Client::Registry::Interface::Shadow); | | |||
79 | | ||||
80 | if (interface.name == 0) { | | |||
81 | qCWarning(LOG_PLASMAQUICK) << "The compositor does not support the shadow protocol"; | | |||
82 | return nullptr; | | |||
83 | } | | |||
84 | | ||||
85 | m_waylandShadowManager = m_registry->createShadowManager(interface.name, interface.version, qApp); | | |||
86 | | ||||
87 | connect(m_waylandShadowManager, &KWayland::Client::ShadowManager::removed, this, [this]() { | | |||
88 | m_waylandShadowManager->deleteLater(); | | |||
89 | }); | | |||
90 | } | | |||
91 | | ||||
92 | return m_waylandShadowManager; | | |||
93 | } | | |||
94 | | ||||
95 | KWayland::Client::ShmPool *WaylandIntegration::waylandShmPool() | | |||
96 | { | | |||
97 | if (!m_waylandShmPool && m_registry) { | | |||
98 | const KWayland::Client::Registry::AnnouncedInterface interface = | | |||
99 | m_registry->interface(KWayland::Client::Registry::Interface::Shm); | | |||
100 | | ||||
101 | if (interface.name == 0) { | | |||
102 | return nullptr; | | |||
103 | } | | |||
104 | | ||||
105 | m_waylandShmPool = m_registry->createShmPool(interface.name, interface.version, qApp); | | |||
106 | | ||||
107 | connect(m_waylandShmPool, &KWayland::Client::ShmPool::removed, this, [this]() { | | |||
108 | m_waylandShmPool->deleteLater(); | | |||
109 | }); | | |||
110 | } | | |||
111 | | ||||
112 | return m_waylandShmPool; | | |||
113 | } | | |||
114 | | ||||
115 | WaylandIntegration *WaylandIntegration::self() | 72 | WaylandIntegration *WaylandIntegration::self() | ||
116 | { | 73 | { | ||
117 | return &privateWaylandIntegrationSelf()->self; | 74 | return &privateWaylandIntegrationSelf()->self; | ||
118 | } | 75 | } | ||
119 | 76 | | |||
120 | void WaylandIntegration::setupKWaylandIntegration() | 77 | void WaylandIntegration::setupKWaylandIntegration() | ||
121 | { | 78 | { | ||
122 | KWayland::Client::ConnectionThread *connection = KWayland::Client::ConnectionThread::fromApplication(this); | 79 | KWayland::Client::ConnectionThread *connection = KWayland::Client::ConnectionThread::fromApplication(this); | ||
Show All 10 Lines |