Reacts to screen hot-plug / virtual-screen reconfiguration / compositor restart; drives surface recreations via the registries. More...
#include <phosphor-layer/include/PhosphorLayer/TopologyCoordinator.h>
Public Types | |
| using | Config = TopologyConfig |
Convenience alias — existing call sites that spell out the full name still compile, but TopologyCoordinator::Config reads fine too. | |
| using | SyncCallback = std::function< void()> |
| Register a callback invoked whenever the coordinator decides the screen set has materially changed. | |
| using | CallbackId = quint64 |
Signals | |
| void | screensChanging () |
| Debounce fired; the consumer should snapshot any state that depends on the current screen set before sync callbacks start rebuilding it. | |
| void | screensChanged () |
| All sync callbacks have run; the screen set is stable again. | |
| void | compositorRestarted () |
| Transport signalled compositor loss (wlr-layer-shell global removed). | |
Public Member Functions | |
| TopologyCoordinator (IScreenProvider *screens, ILayerShellTransport *transport, TopologyConfig cfg={}, QObject *parent=nullptr) | |
| ~TopologyCoordinator () override | |
| CallbackId | attachSyncCallback (SyncCallback cb) |
| void | detachSyncCallback (CallbackId id) |
Reacts to screen hot-plug / virtual-screen reconfiguration / compositor restart; drives surface recreations via the registries.
Qt's QGuiApplication emits screensChanged repeatedly during hot-plug (one per wl_output event, plus scaling updates). The coordinator debounces these into a single recreation cycle.
Multiple registries may be attached — e.g. a notification daemon that keeps both a per-screen OSD registry and a singleton modal, where only the former should respond to topology changes.
| using PhosphorLayer::TopologyCoordinator::CallbackId = quint64 |
Convenience alias — existing call sites that spell out the full name still compile, but TopologyCoordinator::Config reads fine too.
| using PhosphorLayer::TopologyCoordinator::SyncCallback = std::function<void()> |
Register a callback invoked whenever the coordinator decides the screen set has materially changed.
The callback receives no arguments; the consumer queries the IScreenProvider to diff the old/new sets. Runs on the GUI thread.
Returns a cookie that can be passed to detachSyncCallback() to unregister. Unregistering during a callback invocation is safe.
Note: v1 exposes callbacks (not typed ScreenSurfaceRegistry handles) so the coordinator can fan out to any consumer-defined state container without knowing the registry's surface type parameter.
| PhosphorLayer::TopologyCoordinator::TopologyCoordinator | ( | IScreenProvider * | screens, |
| ILayerShellTransport * | transport, | ||
| TopologyConfig | cfg = {}, |
||
| QObject * | parent = nullptr |
||
| ) |
|
override |
| CallbackId PhosphorLayer::TopologyCoordinator::attachSyncCallback | ( | SyncCallback | cb | ) |
|
signal |
Transport signalled compositor loss (wlr-layer-shell global removed).
Consumers must assume every surface has been torn down and will be respawned once the transport is re-bound.
| void PhosphorLayer::TopologyCoordinator::detachSyncCallback | ( | CallbackId | id | ) |
|
signal |
All sync callbacks have run; the screen set is stable again.
|
signal |
Debounce fired; the consumer should snapshot any state that depends on the current screen set before sync callbacks start rebuilding it.