Changeset View
Changeset View
Standalone View
Standalone View
wayland_server.cpp
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | |||||
47 | #include <KWayland/Server/server_decoration_interface.h> | 47 | #include <KWayland/Server/server_decoration_interface.h> | ||
48 | #include <KWayland/Server/shadow_interface.h> | 48 | #include <KWayland/Server/shadow_interface.h> | ||
49 | #include <KWayland/Server/subcompositor_interface.h> | 49 | #include <KWayland/Server/subcompositor_interface.h> | ||
50 | #include <KWayland/Server/blur_interface.h> | 50 | #include <KWayland/Server/blur_interface.h> | ||
51 | #include <KWayland/Server/shell_interface.h> | 51 | #include <KWayland/Server/shell_interface.h> | ||
52 | #include <KWayland/Server/outputmanagement_interface.h> | 52 | #include <KWayland/Server/outputmanagement_interface.h> | ||
53 | #include <KWayland/Server/outputconfiguration_interface.h> | 53 | #include <KWayland/Server/outputconfiguration_interface.h> | ||
54 | #include <KWayland/Server/xdgshell_interface.h> | 54 | #include <KWayland/Server/xdgshell_interface.h> | ||
55 | #include <KWayland/Server/xdgforeign_interface.h> | ||||
55 | 56 | | |||
56 | // Qt | 57 | // Qt | ||
57 | #include <QThread> | 58 | #include <QThread> | ||
58 | #include <QWindow> | 59 | #include <QWindow> | ||
59 | 60 | | |||
60 | // system | 61 | // system | ||
61 | #include <sys/types.h> | 62 | #include <sys/types.h> | ||
62 | #include <sys/socket.h> | 63 | #include <sys/socket.h> | ||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Line(s) | 130 | { | |||
153 | } else { | 154 | } else { | ||
154 | m_clients << client; | 155 | m_clients << client; | ||
155 | } | 156 | } | ||
156 | if (client->readyForPainting()) { | 157 | if (client->readyForPainting()) { | ||
157 | emit shellClientAdded(client); | 158 | emit shellClientAdded(client); | ||
158 | } else { | 159 | } else { | ||
159 | connect(client, &ShellClient::windowShown, this, &WaylandServer::shellClientShown); | 160 | connect(client, &ShellClient::windowShown, this, &WaylandServer::shellClientShown); | ||
160 | } | 161 | } | ||
162 | | ||||
163 | //not directly connected as the connection is tied to client instead of this | ||||
164 | connect(m_XdgForeign, &KWayland::Server::XdgForeignInterface::transientChanged, client, [this](KWayland::Server::SurfaceInterface *child, KWayland::Server::SurfaceInterface *parent) { | ||||
165 | emit foreignTransientChanged(child); | ||||
166 | }); | ||||
161 | } | 167 | } | ||
graesslin: Why is the xdgForeign passed to the client? | |||||
162 | 168 | | |||
163 | bool WaylandServer::init(const QByteArray &socketName, InitalizationFlags flags) | 169 | bool WaylandServer::init(const QByteArray &socketName, InitalizationFlags flags) | ||
164 | { | 170 | { | ||
165 | m_initFlags = flags; | 171 | m_initFlags = flags; | ||
166 | m_display = new KWayland::Server::Display(this); | 172 | m_display = new KWayland::Server::Display(this); | ||
167 | if (!socketName.isNull() && !socketName.isEmpty()) { | 173 | if (!socketName.isNull() && !socketName.isEmpty()) { | ||
graesslin: why the setModal? Why should a foreign transient be modal? | |||||
168 | m_display->setSocketName(QString::fromUtf8(socketName)); | 174 | m_display->setSocketName(QString::fromUtf8(socketName)); | ||
as an alternative feel free to make ShellClient::setTransient public (it's only private because nothing used it so far) and do: if (childClient && childClient->surface() == child) { childClient->setTransient(); } graesslin: as an alternative feel free to make ShellClient::setTransient public (it's only private because… | |||||
169 | } | 175 | } | ||
170 | m_display->start(); | 176 | m_display->start(); | ||
171 | if (!m_display->isRunning()) { | 177 | if (!m_display->isRunning()) { | ||
172 | return false; | 178 | return false; | ||
173 | } | 179 | } | ||
174 | m_compositor = m_display->createCompositor(m_display); | 180 | m_compositor = m_display->createCompositor(m_display); | ||
175 | m_compositor->create(); | 181 | m_compositor->create(); | ||
176 | connect(m_compositor, &CompositorInterface::surfaceCreated, this, | 182 | connect(m_compositor, &CompositorInterface::surfaceCreated, this, | ||
▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Line(s) | |||||
303 | connect(m_outputManagement, &OutputManagementInterface::configurationChangeRequested, | 309 | connect(m_outputManagement, &OutputManagementInterface::configurationChangeRequested, | ||
304 | this, [this](KWayland::Server::OutputConfigurationInterface *config) { | 310 | this, [this](KWayland::Server::OutputConfigurationInterface *config) { | ||
305 | kwinApp()->platform()->configurationChangeRequested(config); | 311 | kwinApp()->platform()->configurationChangeRequested(config); | ||
306 | }); | 312 | }); | ||
307 | m_outputManagement->create(); | 313 | m_outputManagement->create(); | ||
308 | 314 | | |||
309 | m_display->createSubCompositor(m_display)->create(); | 315 | m_display->createSubCompositor(m_display)->create(); | ||
310 | 316 | | |||
317 | m_XdgForeign = m_display->createXdgForeignInterface(m_display); | ||||
318 | m_XdgForeign->create(); | ||||
319 | | ||||
311 | return true; | 320 | return true; | ||
312 | } | 321 | } | ||
313 | 322 | | |||
323 | SurfaceInterface *WaylandServer::findForeignTransientForSurface(SurfaceInterface *surface) | ||||
324 | { | ||||
325 | return m_XdgForeign->transientFor(surface); | ||||
326 | } | ||||
327 | | ||||
314 | void WaylandServer::shellClientShown(Toplevel *t) | 328 | void WaylandServer::shellClientShown(Toplevel *t) | ||
315 | { | 329 | { | ||
316 | ShellClient *c = dynamic_cast<ShellClient*>(t); | 330 | ShellClient *c = dynamic_cast<ShellClient*>(t); | ||
317 | if (!c) { | 331 | if (!c) { | ||
318 | qCWarning(KWIN_CORE) << "Failed to cast a Toplevel which is supposed to be a ShellClient to ShellClient"; | 332 | qCWarning(KWIN_CORE) << "Failed to cast a Toplevel which is supposed to be a ShellClient to ShellClient"; | ||
319 | return; | 333 | return; | ||
320 | } | 334 | } | ||
321 | disconnect(c, &ShellClient::windowShown, this, &WaylandServer::shellClientShown); | 335 | disconnect(c, &ShellClient::windowShown, this, &WaylandServer::shellClientShown); | ||
▲ Show 20 Lines • Show All 381 Lines • Show Last 20 Lines |
Why is the xdgForeign passed to the client?