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

Abstracts the layer-shell protocol binding. More...

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

Inheritance diagram for PhosphorLayer::ILayerShellTransport:
[legend]

Public Types

using CompositorLostCallback = std::function< void()>
 Register a callback fired when the compositor's layer-shell global is removed (compositor crash / restart).
 
using CompositorLostCookie = quint64
 

Public Member Functions

 ILayerShellTransport ()=default
 
virtual ~ILayerShellTransport ()=default
 
virtual bool isSupported () const =0
 True if the compositor advertises wlr-layer-shell.
 
virtual std::unique_ptr< ITransportHandleattach (QQuickWindow *win, const TransportAttachArgs &args)=0
 Mark win as a layer-shell surface with the given initial configuration.
 
virtual CompositorLostCookie addCompositorLostCallback (CompositorLostCallback cb)=0
 
virtual void removeCompositorLostCallback (CompositorLostCookie cookie)=0
 

Detailed Description

Abstracts the layer-shell protocol binding.

Default implementation: PhosphorWaylandTransport (provided in a later phase, wraps PhosphorWayland::LayerSurface). Tests inject a MockTransport and exercise the full lifecycle without Wayland.

Member Typedef Documentation

◆ CompositorLostCallback

Register a callback fired when the compositor's layer-shell global is removed (compositor crash / restart).

The library's TopologyCoordinator uses this to tear down all attached handles; consumer code generally does not need to subscribe. Callbacks run on the Wayland event-dispatch context — consumers must marshal to the GUI thread themselves if needed.

Returns an opaque cookie; pass it to removeCompositorLostCallback to unsubscribe. 0 is reserved for "registration refused" (e.g. null callback) and is safe to pass to remove. Long-lived transports without unsubscribe accumulate dead callbacks indefinitely — always remove on consumer destruction.

◆ CompositorLostCookie

Constructor & Destructor Documentation

◆ ILayerShellTransport()

PhosphorLayer::ILayerShellTransport::ILayerShellTransport ( )
default

◆ ~ILayerShellTransport()

virtual PhosphorLayer::ILayerShellTransport::~ILayerShellTransport ( )
virtualdefault

Member Function Documentation

◆ addCompositorLostCallback()

virtual CompositorLostCookie PhosphorLayer::ILayerShellTransport::addCompositorLostCallback ( CompositorLostCallback  cb)
pure virtual

◆ attach()

virtual std::unique_ptr< ITransportHandle > PhosphorLayer::ILayerShellTransport::attach ( QQuickWindow *  win,
const TransportAttachArgs args 
)
pure virtual

Mark win as a layer-shell surface with the given initial configuration.

MUST be called before win's first show(). Post-show properties that the protocol forbids mutating (layer output, scope, anchors in v1–3) are fixed at this point; later changes require destroy + re-attach.

Returns nullptr on failure; callers propagate as Surface::Failed.

Implemented in PhosphorLayer::PhosphorWaylandTransport, and PhosphorLayer::XdgToplevelTransport.

◆ isSupported()

virtual bool PhosphorLayer::ILayerShellTransport::isSupported ( ) const
pure virtual

True if the compositor advertises wlr-layer-shell.

Surfaces fail construction with a logged reason when this returns false.

Implemented in PhosphorLayer::PhosphorWaylandTransport, and PhosphorLayer::XdgToplevelTransport.

◆ removeCompositorLostCallback()

virtual void PhosphorLayer::ILayerShellTransport::removeCompositorLostCallback ( CompositorLostCookie  cookie)
pure virtual

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