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

Fallback transport for compositors without wlr-layer-shell. More...

#include <phosphor-layer/include/PhosphorLayer/defaults/XdgToplevelTransport.h>

Inheritance diagram for PhosphorLayer::XdgToplevelTransport:
[legend]

Public Member Functions

 XdgToplevelTransport ()
 
 ~XdgToplevelTransport () override
 
bool isSupported () const override
 True if the compositor advertises wlr-layer-shell.
 
std::unique_ptr< ITransportHandleattach (QQuickWindow *win, const TransportAttachArgs &args) override
 Mark win as a layer-shell surface with the given initial configuration.
 
CompositorLostCookie addCompositorLostCallback (CompositorLostCallback cb) override
 
void removeCompositorLostCallback (CompositorLostCookie cookie) override
 
void simulateCompositorLost ()
 Fire every registered compositor-lost callback.
 
- Public Member Functions inherited from PhosphorLayer::ILayerShellTransport
 ILayerShellTransport ()=default
 
virtual ~ILayerShellTransport ()=default
 

Additional Inherited Members

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

Detailed Description

Fallback transport for compositors without wlr-layer-shell.

xdg_toplevel is the standard "application window" role — every Wayland compositor supports it. This transport lets PhosphorLayer run on non-Plasma compositors (GNOME/Mutter without layer-shell, nested Wayland sessions, etc.) with degraded behaviour:

  • Layer (Background/Bottom/Top/Overlay): ignored. The window stacks like any other.
  • Anchors: converted to position hints via the compositor's geometry request; edge anchoring is best-effort and honours no protocol invariants (a "top-anchored panel" becomes a window the user can move).
  • Exclusive zone: ignored. Other surfaces may overlap the window.
  • Keyboard interactivity: forced to OnDemand. Exclusive and None cannot be expressed through xdg_toplevel alone.

Use via SurfaceFactory::Deps when PhosphorWaylandTransport:: isSupported() returns false. Typically consumers probe at startup:

auto plasma = std::make_unique<PhosphorWaylandTransport>();
std::unique_ptr<ILayerShellTransport> transport = plasma->isSupported()
? std::move(plasma)
: std::unique_ptr<ILayerShellTransport>(new XdgToplevelTransport);
Abstracts the layer-shell protocol binding.
Definition ILayerShellTransport.h:111
Fallback transport for compositors without wlr-layer-shell.
Definition XdgToplevelTransport.h:42

Constructor & Destructor Documentation

◆ XdgToplevelTransport()

PhosphorLayer::XdgToplevelTransport::XdgToplevelTransport ( )

◆ ~XdgToplevelTransport()

PhosphorLayer::XdgToplevelTransport::~XdgToplevelTransport ( )
override

Member Function Documentation

◆ addCompositorLostCallback()

CompositorLostCookie PhosphorLayer::XdgToplevelTransport::addCompositorLostCallback ( CompositorLostCallback  cb)
overridevirtual

◆ attach()

std::unique_ptr< ITransportHandle > PhosphorLayer::XdgToplevelTransport::attach ( QQuickWindow *  win,
const TransportAttachArgs args 
)
overridevirtual

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.

Implements PhosphorLayer::ILayerShellTransport.

◆ isSupported()

bool PhosphorLayer::XdgToplevelTransport::isSupported ( ) const
overridevirtual

True if the compositor advertises wlr-layer-shell.

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

Implements PhosphorLayer::ILayerShellTransport.

◆ removeCompositorLostCallback()

void PhosphorLayer::XdgToplevelTransport::removeCompositorLostCallback ( CompositorLostCookie  cookie)
overridevirtual

◆ simulateCompositorLost()

void PhosphorLayer::XdgToplevelTransport::simulateCompositorLost ( )

Fire every registered compositor-lost callback.

Exposed primarily for tests that want to exercise consumer teardown paths without tearing down QGuiApplication. Consumers may also use this to inject a synthetic compositor-lost event (e.g. when a higher-level transport wrapper detects a logical disconnect that xdg_toplevel itself does not surface). Idempotent: once fired, the broadcaster stays fired and subsequent calls are no-ops.


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