Changeset View
Changeset View
Standalone View
Standalone View
wayland_server.cpp
Show All 19 Lines | |||||
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 "screens.h" | 25 | #include "screens.h" | ||
26 | #include "shell_client.h" | 26 | #include "shell_client.h" | ||
27 | #include "workspace.h" | 27 | #include "workspace.h" | ||
28 | #include "scene.h" | ||||
28 | 29 | | |||
29 | // Client | 30 | // Client | ||
30 | #include <KWayland/Client/connection_thread.h> | 31 | #include <KWayland/Client/connection_thread.h> | ||
31 | #include <KWayland/Client/event_queue.h> | 32 | #include <KWayland/Client/event_queue.h> | ||
32 | #include <KWayland/Client/registry.h> | 33 | #include <KWayland/Client/registry.h> | ||
33 | #include <KWayland/Client/shm_pool.h> | 34 | #include <KWayland/Client/shm_pool.h> | ||
34 | #include <KWayland/Client/surface.h> | 35 | #include <KWayland/Client/surface.h> | ||
35 | // Server | 36 | // Server | ||
Show All 17 Lines | |||||
53 | #include <KWayland/Server/shadow_interface.h> | 54 | #include <KWayland/Server/shadow_interface.h> | ||
54 | #include <KWayland/Server/subcompositor_interface.h> | 55 | #include <KWayland/Server/subcompositor_interface.h> | ||
55 | #include <KWayland/Server/blur_interface.h> | 56 | #include <KWayland/Server/blur_interface.h> | ||
56 | #include <KWayland/Server/shell_interface.h> | 57 | #include <KWayland/Server/shell_interface.h> | ||
57 | #include <KWayland/Server/outputmanagement_interface.h> | 58 | #include <KWayland/Server/outputmanagement_interface.h> | ||
58 | #include <KWayland/Server/outputconfiguration_interface.h> | 59 | #include <KWayland/Server/outputconfiguration_interface.h> | ||
59 | #include <KWayland/Server/xdgshell_interface.h> | 60 | #include <KWayland/Server/xdgshell_interface.h> | ||
60 | #include <KWayland/Server/xdgforeign_interface.h> | 61 | #include <KWayland/Server/xdgforeign_interface.h> | ||
62 | #include <KWayland/Server/linuxdmabuf_v1_interface.h> | ||||
61 | 63 | | |||
62 | // Qt | 64 | // Qt | ||
63 | #include <QThread> | 65 | #include <QThread> | ||
64 | #include <QWindow> | 66 | #include <QWindow> | ||
65 | 67 | | |||
66 | // system | 68 | // system | ||
67 | #include <sys/types.h> | 69 | #include <sys/types.h> | ||
68 | #include <sys/socket.h> | 70 | #include <sys/socket.h> | ||
69 | #include <unistd.h> | 71 | #include <unistd.h> | ||
70 | 72 | | |||
71 | //screenlocker | 73 | //screenlocker | ||
72 | #include <KScreenLocker/KsldApp> | 74 | #include <KScreenLocker/KsldApp> | ||
73 | 75 | | |||
74 | using namespace KWayland::Server; | 76 | using namespace KWayland::Server; | ||
75 | 77 | | |||
76 | namespace KWin | 78 | namespace KWin | ||
77 | { | 79 | { | ||
78 | 80 | | |||
79 | KWIN_SINGLETON_FACTORY(WaylandServer) | 81 | KWIN_SINGLETON_FACTORY(WaylandServer) | ||
80 | 82 | | |||
83 | | ||||
84 | class LinuxDmabufBridge : public LinuxDmabufUnstableV1Interface::Bridge | ||||
85 | { | ||||
86 | public: | ||||
87 | LinuxDmabufBridge() = default; | ||||
88 | ~LinuxDmabufBridge() = default; | ||||
89 | | ||||
90 | QVector<uint32_t> supportedFormats() const override final; | ||||
91 | QVector<uint64_t> supportedModifiers(uint32_t format) const override final; | ||||
92 | LinuxDmabuf::Buffer *importBuffer(const QVector<LinuxDmabuf::Plane> &planes, uint32_t format, const QSize &size, LinuxDmabuf::Flags flags) override final; | ||||
93 | }; | ||||
94 | | ||||
95 | QVector<uint32_t> LinuxDmabufBridge::supportedFormats() const | ||||
96 | { | ||||
97 | return Compositor::self()->scene()->supportedDrmFormats(); | ||||
98 | } | ||||
99 | | ||||
100 | QVector<uint64_t> LinuxDmabufBridge::supportedModifiers(uint32_t format) const | ||||
101 | { | ||||
102 | return Compositor::self()->scene()->supportedDrmModifiers(format); | ||||
103 | } | ||||
104 | | ||||
105 | LinuxDmabuf::Buffer *LinuxDmabufBridge::importBuffer(const QVector<LinuxDmabuf::Plane> &planes, uint32_t format, const QSize &size, LinuxDmabuf::Flags flags) | ||||
106 | { | ||||
107 | return Compositor::self()->scene()->importDmabufBuffer(planes, format, size, flags); | ||||
108 | } | ||||
109 | | ||||
110 | | ||||
111 | | ||||
112 | // -------------------------------------------------------------------- | ||||
113 | | ||||
114 | | ||||
115 | | ||||
81 | WaylandServer::WaylandServer(QObject *parent) | 116 | WaylandServer::WaylandServer(QObject *parent) | ||
82 | : QObject(parent) | 117 | : QObject(parent) | ||
83 | { | 118 | { | ||
84 | qRegisterMetaType<KWayland::Server::OutputInterface::DpmsMode>(); | 119 | qRegisterMetaType<KWayland::Server::OutputInterface::DpmsMode>(); | ||
85 | 120 | | |||
86 | connect(kwinApp(), &Application::screensCreated, this, &WaylandServer::initOutputs); | 121 | connect(kwinApp(), &Application::screensCreated, this, &WaylandServer::initOutputs); | ||
87 | connect(kwinApp(), &Application::x11ConnectionChanged, this, &WaylandServer::setupX11ClipboardSync); | 122 | connect(kwinApp(), &Application::x11ConnectionChanged, this, &WaylandServer::setupX11ClipboardSync); | ||
88 | } | 123 | } | ||
89 | 124 | | |||
90 | WaylandServer::~WaylandServer() | 125 | WaylandServer::~WaylandServer() | ||
91 | { | 126 | { | ||
92 | destroyInputMethodConnection(); | 127 | destroyInputMethodConnection(); | ||
128 | m_linuxDmabuf->setBridge(nullptr); | ||||
129 | delete m_linuxDmabufBridge; | ||||
93 | } | 130 | } | ||
94 | 131 | | |||
95 | void WaylandServer::destroyInternalConnection() | 132 | void WaylandServer::destroyInternalConnection() | ||
96 | { | 133 | { | ||
97 | emit terminatingInternalClientConnection(); | 134 | emit terminatingInternalClientConnection(); | ||
98 | if (m_internalConnection.client) { | 135 | if (m_internalConnection.client) { | ||
99 | // delete all connections hold by plugins like e.g. widget style | 136 | // delete all connections hold by plugins like e.g. widget style | ||
100 | const auto connections = KWayland::Client::ConnectionThread::connections(); | 137 | const auto connections = KWayland::Client::ConnectionThread::connections(); | ||
▲ Show 20 Lines • Show All 253 Lines • ▼ Show 20 Line(s) | 218 | { | |||
354 | }); | 391 | }); | ||
355 | m_outputManagement->create(); | 392 | m_outputManagement->create(); | ||
356 | 393 | | |||
357 | m_display->createSubCompositor(m_display)->create(); | 394 | m_display->createSubCompositor(m_display)->create(); | ||
358 | 395 | | |||
359 | m_XdgForeign = m_display->createXdgForeignInterface(m_display); | 396 | m_XdgForeign = m_display->createXdgForeignInterface(m_display); | ||
360 | m_XdgForeign->create(); | 397 | m_XdgForeign->create(); | ||
361 | 398 | | |||
399 | m_linuxDmabufBridge = new LinuxDmabufBridge; | ||||
400 | | ||||
401 | m_linuxDmabuf = m_display->createLinuxDmabufInterface(m_display); | ||||
402 | m_linuxDmabuf->setBridge(m_linuxDmabufBridge); | ||||
403 | m_linuxDmabuf->create(); | ||||
404 | | ||||
362 | return true; | 405 | return true; | ||
363 | } | 406 | } | ||
364 | 407 | | |||
365 | SurfaceInterface *WaylandServer::findForeignTransientForSurface(SurfaceInterface *surface) | 408 | SurfaceInterface *WaylandServer::findForeignTransientForSurface(SurfaceInterface *surface) | ||
366 | { | 409 | { | ||
367 | return m_XdgForeign->transientFor(surface); | 410 | return m_XdgForeign->transientFor(surface); | ||
368 | } | 411 | } | ||
369 | 412 | | |||
▲ Show 20 Lines • Show All 396 Lines • Show Last 20 Lines |