Changeset View
Changeset View
Standalone View
Standalone View
shell_client.cpp
Show First 20 Lines • Show All 247 Lines • ▼ Show 20 Line(s) | 184 | { | |||
---|---|---|---|---|---|
248 | } else if (m_xdgShellPopup) { | 248 | } else if (m_xdgShellPopup) { | ||
249 | connect(m_xdgShellPopup, &XdgShellPopupInterface::destroyed, this, &ShellClient::destroyClient); | 249 | connect(m_xdgShellPopup, &XdgShellPopupInterface::destroyed, this, &ShellClient::destroyClient); | ||
250 | } | 250 | } | ||
251 | 251 | | |||
252 | // setup shadow integration | 252 | // setup shadow integration | ||
253 | getShadow(); | 253 | getShadow(); | ||
254 | connect(s, &SurfaceInterface::shadowChanged, this, &Toplevel::getShadow); | 254 | connect(s, &SurfaceInterface::shadowChanged, this, &Toplevel::getShadow); | ||
255 | 255 | | |||
256 | connect(waylandServer(), &WaylandServer::foreignTransientChanged, this, [this](KWayland::Server::SurfaceInterface *child) { | ||||
257 | if (child == surface()) { | ||||
258 | setTransient(); | ||||
259 | } | ||||
260 | }); | ||||
256 | setTransient(); | 261 | setTransient(); | ||
257 | // check whether we have a ServerSideDecoration | 262 | // check whether we have a ServerSideDecoration | ||
258 | if (ServerSideDecorationInterface *deco = ServerSideDecorationInterface::get(s)) { | 263 | if (ServerSideDecorationInterface *deco = ServerSideDecorationInterface::get(s)) { | ||
259 | installServerSideDecoration(deco); | 264 | installServerSideDecoration(deco); | ||
260 | } | 265 | } | ||
261 | 266 | | |||
262 | updateColorScheme(QString()); | 267 | updateColorScheme(QString()); | ||
263 | updateApplicationMenu(); | 268 | updateApplicationMenu(); | ||
▲ Show 20 Lines • Show All 1051 Lines • ▼ Show 20 Line(s) | 1315 | { | |||
1315 | if (m_xdgShellSurface) { | 1320 | if (m_xdgShellSurface) { | ||
1316 | if (auto transient = m_xdgShellSurface->transientFor().data()) { | 1321 | if (auto transient = m_xdgShellSurface->transientFor().data()) { | ||
1317 | s = transient->surface(); | 1322 | s = transient->surface(); | ||
1318 | } | 1323 | } | ||
1319 | } | 1324 | } | ||
1320 | if (m_xdgShellPopup) { | 1325 | if (m_xdgShellPopup) { | ||
1321 | s = m_xdgShellPopup->transientFor().data(); | 1326 | s = m_xdgShellPopup->transientFor().data(); | ||
1322 | } | 1327 | } | ||
1328 | if (!s) { | ||||
1329 | s = waylandServer()->findForeignTransientForSurface(surface()); | ||||
graesslin: I would delegate this to waylandServer, so that there is no need to pass the foreign global to… | |||||
how could it be done as addtransient/transientfor/settransient are all protected? mart: how could it be done as addtransient/transientfor/settransient are all protected? | |||||
what I was thinking of is something like: SurfaceInterface *WaylandServer::findForeignForSurface(SurfaceInterface *surface) { return m_XdgForeign->transientFor(surface); } and here a simple: if (!s) { s = waylandSurface()->findForeignForSurface(surface()); } but I think your question is more about how to do the connect: just make waylandServer forward the signal, so that ShellClient can connect to it. What I don't want is that the global is passed to ShellClient - we don't do that for any other global in ShellClient. Normally it always goes through WaylandServer. There are very few exceptions to it where a class has direct access to a global. graesslin: what I was thinking of is something like:
```
SurfaceInterface *WaylandServer… | |||||
1330 | } | ||||
1323 | auto t = waylandServer()->findClient(s); | 1331 | auto t = waylandServer()->findClient(s); | ||
1324 | if (t != transientFor()) { | 1332 | if (t != transientFor()) { | ||
1325 | // remove from main client | 1333 | // remove from main client | ||
1326 | if (transientFor()) | 1334 | if (transientFor()) | ||
1327 | transientFor()->removeTransient(this); | 1335 | transientFor()->removeTransient(this); | ||
1328 | setTransientFor(t); | 1336 | setTransientFor(t); | ||
1329 | if (t) { | 1337 | if (t) { | ||
1330 | t->addTransient(this); | 1338 | t->addTransient(this); | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 1399 | [this] (ServerSideDecorationManagerInterface::Mode mode) { | |||
1397 | } | 1405 | } | ||
1398 | } | 1406 | } | ||
1399 | ); | 1407 | ); | ||
1400 | } | 1408 | } | ||
1401 | 1409 | | |||
1402 | bool ShellClient::shouldExposeToWindowManagement() | 1410 | bool ShellClient::shouldExposeToWindowManagement() | ||
1403 | { | 1411 | { | ||
1404 | if (isInternal()) { | 1412 | if (isInternal()) { | ||
1405 | return false; | 1413 | return false; | ||
This connect could be done in waylandServer then there would not be a reason to have this method at all. graesslin: This connect could be done in waylandServer then there would not be a reason to have this… | |||||
1406 | } | 1414 | } | ||
1407 | if (isLockScreen()) { | 1415 | if (isLockScreen()) { | ||
1408 | return false; | 1416 | return false; | ||
1409 | } | 1417 | } | ||
1410 | if (m_shellSurface) { | 1418 | if (m_shellSurface) { | ||
1411 | if (m_shellSurface->isTransient() && !m_shellSurface->acceptsKeyboardFocus()) { | 1419 | if (m_shellSurface->isTransient() && !m_shellSurface->acceptsKeyboardFocus()) { | ||
1412 | return false; | 1420 | return false; | ||
1413 | } | 1421 | } | ||
▲ Show 20 Lines • Show All 130 Lines • Show Last 20 Lines |
I would delegate this to waylandServer, so that there is no need to pass the foreign global to each ShellClient.