Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorLayer::TopologyCoordinator Class Reference

Reacts to screen hot-plug / virtual-screen reconfiguration / compositor restart; drives surface recreations via the registries. More...

#include <phosphor-layer/include/PhosphorLayer/TopologyCoordinator.h>

Inheritance diagram for PhosphorLayer::TopologyCoordinator:
[legend]

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)
 

Detailed Description

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.

Note
Status (v0.1): not yet used by the reference consumer (PlasmaZones OverlayService, which wires screen signals directly to QGuiApplication because it also responds to a custom virtualScreensChanged signal not yet modelled here). The coordinator's public API and debounce contract are tested, but real-world behaviour under hot-plug bursts has only been exercised through MockScreenProvider.

Member Typedef Documentation

◆ CallbackId

◆ Config

Convenience alias — existing call sites that spell out the full name still compile, but TopologyCoordinator::Config reads fine too.

◆ SyncCallback

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.

Constructor & Destructor Documentation

◆ TopologyCoordinator()

PhosphorLayer::TopologyCoordinator::TopologyCoordinator ( IScreenProvider screens,
ILayerShellTransport transport,
TopologyConfig  cfg = {},
QObject *  parent = nullptr 
)

◆ ~TopologyCoordinator()

PhosphorLayer::TopologyCoordinator::~TopologyCoordinator ( )
override

Member Function Documentation

◆ attachSyncCallback()

CallbackId PhosphorLayer::TopologyCoordinator::attachSyncCallback ( SyncCallback  cb)

◆ compositorRestarted

void PhosphorLayer::TopologyCoordinator::compositorRestarted ( )
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.

◆ detachSyncCallback()

void PhosphorLayer::TopologyCoordinator::detachSyncCallback ( CallbackId  id)

◆ screensChanged

void PhosphorLayer::TopologyCoordinator::screensChanged ( )
signal

All sync callbacks have run; the screen set is stable again.

◆ screensChanging

void PhosphorLayer::TopologyCoordinator::screensChanging ( )
signal

Debounce fired; the consumer should snapshot any state that depends on the current screen set before sync callbacks start rebuilding it.


The documentation for this class was generated from the following file: