Per-screen layer-shell shell hosts, slot vocabulary, and animator-config wiring for multi-slot overlays.
Helper layer on top of `phosphor-layer`, `phosphor-surfaces`, and `phosphor-animation`. Given a consumer-provided surface factory, ShellHost owns the per-screen layer-shell shell lifecycle (create / destroy / rekey), the slot map keyed by consumer-chosen slot names, animator-driven slot hides, and per-role animator-config registration. The library knows nothing about zones, layouts, or specific content. Consumers wire their slot vocabulary through callbacks.
| Type | Purpose |
|---|---|
| PhosphorOverlay::ShellHost | Owns the per-screen ShellState map, lifecycle methods, animator wiring. |
| PhosphorOverlay::ShellState | Per-screen mechanism state: layer-shell surface, QQuickWindow, physical screen, slot map. |
| PhosphorOverlay::SlotEntry | One slot entry: QPointer<QQuickItem> item + PhosphorLayer::Role role. |
| PhosphorOverlay::makePerInstanceRole() | Build a per-instance Role by appending -{screenId}-{generation} to a base scope prefix. |
using namespace PhosphorOverlay;
ShellHost host;
host.setSurfaceAnimator(&animator); // from phosphor-animation
host.setSurfaceFactory([&](const QString& sid, QScreen* s) {
const auto role = makePerInstanceRole(MyShellBaseRole, sid, mgr.nextScopeGeneration());
return mgr.createSurface(/* role, qml url, screen, ... */);
});
host.setPostCreateCallback([&](const QString& sid, ShellState& state) {
// Look up content slot Items by their QML object names, wire QML
// signals, prime the RHI pipeline. Insert one SlotEntry per slot:
auto* item = qvariant_cast<QQuickItem*>(state.shellWindow()->property("osdSlotItem"));
state.slots.insert(QStringLiteral("osd"), SlotEntry{item, MyOsdRole});
});
host.setPreDestroyCallback([&](const QString& sid) {
// Drop any parallel consumer-side per-screen state so a stale signal
// firing during teardown doesn't dereference a dangling pointer.
});
// Lifecycle:
host.registerConfigForRole(MyOsdRole, buildOsdConfig());
host.ensureShell(screenId, physScreen);
host.syncSurfaceState(screenId, {.visible = true, .inputGrabbing = false, .keyboardGrabbing = false});
host.hideSlot(screenId, QStringLiteral("osd"), [&]{ /* on hide-leg settle */ });
host.destroyShell(screenId);