Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorWayland Namespace Reference

Namespaces

namespace  LayerSurfaceProps
 Property keys used by LayerSurface ↔ QPA plugin communication.
 

Classes

class  ForeignToplevel
 A single toplevel window owned by some other Wayland client. More...
 
class  ForeignToplevelManager
 Client-side wrapper around zwlr_foreign_toplevel_manager_v1. More...
 
class  IdleInhibitor
 Prevents the compositor from idling the output that the associated surface is visible on. More...
 
class  IdleNotifier
 
class  LayerSurface
 Wayland layer-shell surface backed by zwlr_layer_shell_v1. More...
 
class  SinglePixelBuffer
 

Typedefs

using CompositorLostCallback = std::function< void()>
 Public seam over the QPA plugin's wlr-layer-shell global-removal signal.
 
using CompositorLostCookie = std::uint64_t
 

Functions

PHOSPHORWAYLAND_EXPORT CompositorLostCookie addCompositorLostCallback (CompositorLostCallback cb)
 Register a callback fired when the compositor removes the zwlr_layer_shell_v1 global.
 
PHOSPHORWAYLAND_EXPORT void removeCompositorLostCallback (CompositorLostCookie cookie)
 Unregister a callback previously returned by addCompositorLostCallback.
 
void registerLayerShellPlugin ()
 Call before QGuiApplication to register the phosphorwayland QPA plugin.
 
PHOSPHORWAYLAND_EXPORT bool isToplevelDragSupported ()
 

Typedef Documentation

◆ CompositorLostCallback

using PhosphorWayland::CompositorLostCallback = typedef std::function<void()>

Public seam over the QPA plugin's wlr-layer-shell global-removal signal.

The QPA plugin observes wl_registry::global_remove for zwlr_layer_shell_v1 and uses that to invalidate its cached binding when the compositor restarts or stops. This header forwards the same edge to process-wide consumers: anyone holding LayerSurface instances or built-on state (e.g. PhosphorLayer::PhosphorWaylandTransport) needs to drop them when the global is gone, otherwise subsequent protocol requests target a dead binding.

Semantics

  • Fires at most once per process. After the first fire, the broadcaster stays in the fired state and any later registration invokes the new callback synchronously.
  • Callbacks fire on the Wayland event-dispatch thread (Qt's GUI thread for the standard QGuiApplication setup); marshal to your own thread if the work isn't safe there.
  • Registration is valid before the QPA plugin is initialised. The broadcaster is independent of the integration singleton; the QPA plugin's wl_registry::global_remove handler forwards into it, so callbacks registered pre-load are still reached when the compositor signals removal later.

Cleanup Long-lived consumers MUST removeCompositorLostCallback() before the callback's captures become invalid. Cookies are monotonic and never reused within a process; cookie 0 is reserved for "registration refused" (null callback) and is safe to pass to remove.

◆ CompositorLostCookie

using PhosphorWayland::CompositorLostCookie = typedef std::uint64_t

Function Documentation

◆ addCompositorLostCallback()

PHOSPHORWAYLAND_EXPORT CompositorLostCookie PhosphorWayland::addCompositorLostCallback ( CompositorLostCallback  cb)

Register a callback fired when the compositor removes the zwlr_layer_shell_v1 global.

Returns a non-zero cookie on success; 0 if cb is null. If the global has already been removed, cb is invoked synchronously before this function returns and the returned cookie is inert.

◆ isToplevelDragSupported()

PHOSPHORWAYLAND_EXPORT bool PhosphorWayland::isToplevelDragSupported ( )

◆ registerLayerShellPlugin()

void PhosphorWayland::registerLayerShellPlugin ( )
inline

Call before QGuiApplication to register the phosphorwayland QPA plugin.

Lightweight header — does not pull in Qt Wayland private headers. Respects any existing QT_WAYLAND_SHELL_INTEGRATION value (e.g. for debugging). Only sets the env var when WAYLAND_DISPLAY is set (proves a compositor is running).

Note: if the application is started before the compositor sets WAYLAND_DISPLAY (e.g. early systemd unit ordering), this will not register the plugin and windows will fall back to xdg_toplevel. Ensure the application's systemd unit has After=graphical-session.target or equivalent to guarantee the compositor is running before the application starts.

◆ removeCompositorLostCallback()

PHOSPHORWAYLAND_EXPORT void PhosphorWayland::removeCompositorLostCallback ( CompositorLostCookie  cookie)

Unregister a callback previously returned by addCompositorLostCallback.

Safe with cookie == 0 and with cookies whose callbacks have already fired (no-op).