Changeset View
Changeset View
Standalone View
Standalone View
src/windowsystem/waylandintegration.cpp
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | * Copyright 2014 Martin Gräßlin <mgraesslin@kde.org> | 2 | * Copyright 2014 Martin Gräßlin <mgraesslin@kde.org> | ||
3 | * Copyright 2015 Marco Martin <mart@kde.org> | 3 | * Copyright 2015 Marco Martin <mart@kde.org> | ||
4 | * Copyright 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org> | ||||
4 | * | 5 | * | ||
5 | * This library is free software; you can redistribute it and/or | 6 | * This library is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU Lesser General Public | 7 | * modify it under the terms of the GNU Lesser General Public | ||
7 | * License as published by the Free Software Foundation; either | 8 | * License as published by the Free Software Foundation; either | ||
8 | * version 2.1 of the License, or (at your option) version 3, or any | 9 | * version 2.1 of the License, or (at your option) version 3, or any | ||
9 | * later version accepted by the membership of KDE e.V. (or its | 10 | * later version accepted by the membership of KDE e.V. (or its | ||
10 | * successor approved by the membership of KDE e.V.), which shall | 11 | * successor approved by the membership of KDE e.V.), which shall | ||
11 | * act as a proxy defined in Section 6 of version 3 of the license. | 12 | * act as a proxy defined in Section 6 of version 3 of the license. | ||
Show All 15 Lines | |||||
27 | #include <KWayland/Client/compositor.h> | 28 | #include <KWayland/Client/compositor.h> | ||
28 | #include <KWayland/Client/plasmawindowmanagement.h> | 29 | #include <KWayland/Client/plasmawindowmanagement.h> | ||
29 | #include <KWayland/Client/plasmashell.h> | 30 | #include <KWayland/Client/plasmashell.h> | ||
30 | #include <KWayland/Client/surface.h> | 31 | #include <KWayland/Client/surface.h> | ||
31 | #include <KWayland/Client/blur.h> | 32 | #include <KWayland/Client/blur.h> | ||
32 | #include <KWayland/Client/contrast.h> | 33 | #include <KWayland/Client/contrast.h> | ||
33 | #include <KWayland/Client/region.h> | 34 | #include <KWayland/Client/region.h> | ||
34 | #include <KWayland/Client/slide.h> | 35 | #include <KWayland/Client/slide.h> | ||
36 | #include <KWayland/Client/shadow.h> | ||||
37 | #include <KWayland/Client/shm_pool.h> | ||||
35 | 38 | | |||
36 | #include <KWindowSystem/KWindowSystem> | 39 | #include <KWindowSystem/KWindowSystem> | ||
37 | 40 | | |||
38 | #include <QGuiApplication> | 41 | #include <QGuiApplication> | ||
39 | 42 | | |||
40 | class WaylandIntegrationSingleton | 43 | class WaylandIntegrationSingleton | ||
41 | { | 44 | { | ||
42 | public: | 45 | public: | ||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | 140 | [this] () { | |||
138 | m_waylandSlideManager->deleteLater(); | 141 | m_waylandSlideManager->deleteLater(); | ||
139 | } | 142 | } | ||
140 | ); | 143 | ); | ||
141 | } | 144 | } | ||
142 | 145 | | |||
143 | return m_waylandSlideManager; | 146 | return m_waylandSlideManager; | ||
144 | } | 147 | } | ||
145 | 148 | | |||
149 | KWayland::Client::ShadowManager *WaylandIntegration::waylandShadowManager() | ||||
150 | { | ||||
151 | if (!m_waylandShadowManager && m_registry) { | ||||
152 | const KWayland::Client::Registry::AnnouncedInterface wmInterface = m_registry->interface(KWayland::Client::Registry::Interface::Shadow); | ||||
153 | | ||||
154 | if (wmInterface.name == 0) { | ||||
155 | qCWarning(KWAYLAND_KWS) << "This compositor does not support the Shadow interface"; | ||||
156 | return nullptr; | ||||
157 | } | ||||
158 | | ||||
159 | m_waylandShadowManager = m_registry->createShadowManager(wmInterface.name, wmInterface.version, qApp); | ||||
160 | | ||||
161 | connect(m_waylandShadowManager, &KWayland::Client::ShadowManager::removed, this, | ||||
162 | [this] () { | ||||
163 | m_waylandShadowManager->deleteLater(); | ||||
164 | } | ||||
165 | ); | ||||
166 | } | ||||
167 | | ||||
168 | return m_waylandShadowManager; | ||||
169 | } | ||||
170 | | ||||
146 | KWayland::Client::Compositor *WaylandIntegration::waylandCompositor() const | 171 | KWayland::Client::Compositor *WaylandIntegration::waylandCompositor() const | ||
147 | { | 172 | { | ||
148 | return m_waylandCompositor; | 173 | return m_waylandCompositor; | ||
149 | } | 174 | } | ||
150 | 175 | | |||
151 | KWayland::Client::PlasmaWindowManagement *WaylandIntegration::plasmaWindowManagement() | 176 | KWayland::Client::PlasmaWindowManagement *WaylandIntegration::plasmaWindowManagement() | ||
152 | { | 177 | { | ||
153 | using namespace KWayland::Client; | 178 | using namespace KWayland::Client; | ||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 225 | if (!m_waylandPlasmaShell && m_registry) { | |||
203 | if (wmInterface.name == 0) { | 228 | if (wmInterface.name == 0) { | ||
204 | return nullptr; | 229 | return nullptr; | ||
205 | } | 230 | } | ||
206 | 231 | | |||
207 | m_waylandPlasmaShell = m_registry->createPlasmaShell(wmInterface.name, wmInterface.version, qApp); | 232 | m_waylandPlasmaShell = m_registry->createPlasmaShell(wmInterface.name, wmInterface.version, qApp); | ||
208 | } | 233 | } | ||
209 | return m_waylandPlasmaShell; | 234 | return m_waylandPlasmaShell; | ||
210 | } | 235 | } | ||
236 | | ||||
237 | KWayland::Client::ShmPool *WaylandIntegration::waylandShmPool() | ||||
238 | { | ||||
239 | if (!m_waylandShmPool && m_registry) { | ||||
240 | const KWayland::Client::Registry::AnnouncedInterface wmInterface = m_registry->interface(KWayland::Client::Registry::Interface::Shm); | ||||
241 | | ||||
242 | if (wmInterface.name == 0) { | ||||
243 | return nullptr; | ||||
244 | } | ||||
245 | | ||||
246 | m_waylandShmPool = m_registry->createShmPool(wmInterface.name, wmInterface.version, qApp); | ||||
247 | | ||||
248 | connect(m_waylandShmPool, &KWayland::Client::ShmPool::removed, this, | ||||
249 | [this] () { | ||||
250 | m_waylandShmPool->deleteLater(); | ||||
251 | } | ||||
252 | ); | ||||
253 | } | ||||
254 | | ||||
255 | return m_waylandShmPool; | ||||
256 | } |