Changeset View
Changeset View
Standalone View
Standalone View
wayland_server.cpp
Show All 17 Lines | |||||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "wayland_server.h" | 20 | #include "wayland_server.h" | ||
21 | #include "client.h" | 21 | #include "client.h" | ||
22 | #include "platform.h" | 22 | #include "platform.h" | ||
23 | #include "composite.h" | 23 | #include "composite.h" | ||
24 | #include "idle_inhibition.h" | 24 | #include "idle_inhibition.h" | ||
25 | #include "internal_client.h" | 25 | #include "internal_client.h" | ||
26 | #include "scene.h" | ||||
26 | #include "screens.h" | 27 | #include "screens.h" | ||
27 | #include "shell_client.h" | 28 | #include "shell_client.h" | ||
28 | #include "workspace.h" | 29 | #include "workspace.h" | ||
29 | 30 | | |||
30 | // Client | 31 | // Client | ||
31 | #include <KWayland/Client/connection_thread.h> | 32 | #include <KWayland/Client/connection_thread.h> | ||
32 | #include <KWayland/Client/event_queue.h> | 33 | #include <KWayland/Client/event_queue.h> | ||
33 | #include <KWayland/Client/registry.h> | 34 | #include <KWayland/Client/registry.h> | ||
34 | #include <KWayland/Client/compositor.h> | 35 | #include <KWayland/Client/compositor.h> | ||
35 | #include <KWayland/Client/seat.h> | 36 | #include <KWayland/Client/seat.h> | ||
36 | #include <KWayland/Client/datadevicemanager.h> | 37 | #include <KWayland/Client/datadevicemanager.h> | ||
37 | #include <KWayland/Client/shm_pool.h> | 38 | #include <KWayland/Client/shm_pool.h> | ||
38 | #include <KWayland/Client/surface.h> | 39 | #include <KWayland/Client/surface.h> | ||
39 | // Server | 40 | // Server | ||
40 | #include <KWayland/Server/appmenu_interface.h> | 41 | #include <KWayland/Server/appmenu_interface.h> | ||
41 | #include <KWayland/Server/compositor_interface.h> | 42 | #include <KWayland/Server/compositor_interface.h> | ||
42 | #include <KWayland/Server/datadevicemanager_interface.h> | 43 | #include <KWayland/Server/datadevicemanager_interface.h> | ||
43 | #include <KWayland/Server/datasource_interface.h> | 44 | #include <KWayland/Server/datasource_interface.h> | ||
44 | #include <KWayland/Server/display.h> | 45 | #include <KWayland/Server/display.h> | ||
45 | #include <KWayland/Server/dpms_interface.h> | 46 | #include <KWayland/Server/dpms_interface.h> | ||
46 | #include <KWayland/Server/idle_interface.h> | 47 | #include <KWayland/Server/idle_interface.h> | ||
47 | #include <KWayland/Server/idleinhibit_interface.h> | 48 | #include <KWayland/Server/idleinhibit_interface.h> | ||
49 | #include <KWayland/Server/linuxdmabuf_v1_interface.h> | ||||
48 | #include <KWayland/Server/output_interface.h> | 50 | #include <KWayland/Server/output_interface.h> | ||
49 | #include <KWayland/Server/plasmashell_interface.h> | 51 | #include <KWayland/Server/plasmashell_interface.h> | ||
50 | #include <KWayland/Server/plasmavirtualdesktop_interface.h> | 52 | #include <KWayland/Server/plasmavirtualdesktop_interface.h> | ||
51 | #include <KWayland/Server/plasmawindowmanagement_interface.h> | 53 | #include <KWayland/Server/plasmawindowmanagement_interface.h> | ||
52 | #include <KWayland/Server/pointerconstraints_interface.h> | 54 | #include <KWayland/Server/pointerconstraints_interface.h> | ||
53 | #include <KWayland/Server/pointergestures_interface.h> | 55 | #include <KWayland/Server/pointergestures_interface.h> | ||
54 | #include <KWayland/Server/qtsurfaceextension_interface.h> | 56 | #include <KWayland/Server/qtsurfaceextension_interface.h> | ||
55 | #include <KWayland/Server/seat_interface.h> | 57 | #include <KWayland/Server/seat_interface.h> | ||
Show All 27 Lines | |||||
83 | 85 | | |||
84 | using namespace KWayland::Server; | 86 | using namespace KWayland::Server; | ||
85 | 87 | | |||
86 | namespace KWin | 88 | namespace KWin | ||
87 | { | 89 | { | ||
88 | 90 | | |||
89 | KWIN_SINGLETON_FACTORY(WaylandServer) | 91 | KWIN_SINGLETON_FACTORY(WaylandServer) | ||
90 | 92 | | |||
93 | class LinuxDmabufBridge : public LinuxDmabufUnstableV1Interface::Bridge | ||||
94 | { | ||||
95 | public: | ||||
96 | LinuxDmabufBridge() = default; | ||||
97 | ~LinuxDmabufBridge() = default; | ||||
98 | | ||||
99 | QVector<uint32_t> supportedFormats() const override final; | ||||
100 | QVector<uint64_t> supportedModifiers(uint32_t format) const override final; | ||||
101 | LinuxDmabuf::Buffer *importBuffer(const QVector<LinuxDmabuf::Plane> &planes, uint32_t format, const QSize &size, LinuxDmabuf::Flags flags) override final; | ||||
102 | }; | ||||
103 | | ||||
104 | QVector<uint32_t> LinuxDmabufBridge::supportedFormats() const | ||||
105 | { | ||||
106 | return Compositor::self()->scene()->supportedDrmFormats(); | ||||
107 | } | ||||
108 | | ||||
109 | QVector<uint64_t> LinuxDmabufBridge::supportedModifiers(uint32_t format) const | ||||
110 | { | ||||
111 | return Compositor::self()->scene()->supportedDrmModifiers(format); | ||||
112 | } | ||||
113 | | ||||
114 | LinuxDmabuf::Buffer *LinuxDmabufBridge::importBuffer(const QVector<LinuxDmabuf::Plane> &planes, uint32_t format, const QSize &size, LinuxDmabuf::Flags flags) | ||||
115 | { | ||||
116 | return Compositor::self()->scene()->importDmabufBuffer(planes, format, size, flags); | ||||
117 | } | ||||
118 | | ||||
91 | WaylandServer::WaylandServer(QObject *parent) | 119 | WaylandServer::WaylandServer(QObject *parent) | ||
92 | : QObject(parent) | 120 | : QObject(parent) | ||
93 | { | 121 | { | ||
94 | qRegisterMetaType<KWayland::Server::OutputInterface::DpmsMode>(); | 122 | qRegisterMetaType<KWayland::Server::OutputInterface::DpmsMode>(); | ||
95 | 123 | | |||
96 | connect(kwinApp(), &Application::screensCreated, this, &WaylandServer::initOutputs); | 124 | connect(kwinApp(), &Application::screensCreated, this, &WaylandServer::initOutputs); | ||
97 | } | 125 | } | ||
98 | 126 | | |||
99 | WaylandServer::~WaylandServer() | 127 | WaylandServer::~WaylandServer() | ||
100 | { | 128 | { | ||
101 | destroyInputMethodConnection(); | 129 | destroyInputMethodConnection(); | ||
130 | m_linuxDmabuf->setBridge(nullptr); | ||||
131 | delete m_linuxDmabufBridge; | ||||
102 | } | 132 | } | ||
103 | 133 | | |||
104 | void WaylandServer::destroyInternalConnection() | 134 | void WaylandServer::destroyInternalConnection() | ||
105 | { | 135 | { | ||
106 | emit terminatingInternalClientConnection(); | 136 | emit terminatingInternalClientConnection(); | ||
107 | if (m_internalConnection.client) { | 137 | if (m_internalConnection.client) { | ||
108 | // delete all connections hold by plugins like e.g. widget style | 138 | // delete all connections hold by plugins like e.g. widget style | ||
109 | const auto connections = KWayland::Client::ConnectionThread::connections(); | 139 | const auto connections = KWayland::Client::ConnectionThread::connections(); | ||
▲ Show 20 Lines • Show All 260 Lines • ▼ Show 20 Line(s) | 231 | { | |||
370 | m_xdgOutputManager = m_display->createXdgOutputManager(m_display); | 400 | m_xdgOutputManager = m_display->createXdgOutputManager(m_display); | ||
371 | m_xdgOutputManager->create(); | 401 | m_xdgOutputManager->create(); | ||
372 | 402 | | |||
373 | m_display->createSubCompositor(m_display)->create(); | 403 | m_display->createSubCompositor(m_display)->create(); | ||
374 | 404 | | |||
375 | m_XdgForeign = m_display->createXdgForeignInterface(m_display); | 405 | m_XdgForeign = m_display->createXdgForeignInterface(m_display); | ||
376 | m_XdgForeign->create(); | 406 | m_XdgForeign->create(); | ||
377 | 407 | | |||
408 | m_linuxDmabufBridge = new LinuxDmabufBridge; | ||||
409 | | ||||
410 | m_linuxDmabuf = m_display->createLinuxDmabufInterface(m_display); | ||||
411 | m_linuxDmabuf->setBridge(m_linuxDmabufBridge); | ||||
412 | m_linuxDmabuf->create(); | ||||
413 | | ||||
378 | m_keyState = m_display->createKeyStateInterface(m_display); | 414 | m_keyState = m_display->createKeyStateInterface(m_display); | ||
379 | m_keyState->create(); | 415 | m_keyState->create(); | ||
380 | 416 | | |||
381 | return true; | 417 | return true; | ||
382 | } | 418 | } | ||
383 | 419 | | |||
384 | SurfaceInterface *WaylandServer::findForeignTransientForSurface(SurfaceInterface *surface) | 420 | SurfaceInterface *WaylandServer::findForeignTransientForSurface(SurfaceInterface *surface) | ||
385 | { | 421 | { | ||
▲ Show 20 Lines • Show All 387 Lines • Show Last 20 Lines |