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.
namespace  LockSurfaceProps
 Property keys used by LockSurface ↔ QPA plugin communication.

Classes

class  BackgroundEffect
 Compositor blur behind a region of a window, through the standard ext-background-effect-v1 protocol. More...
class  ClipboardDevice
 Client-side wrapper around zwlr_data_control_device_v1. More...
class  ForeignToplevelManager
 Client-side wrapper around zwlr_foreign_toplevel_manager_v1. More...
class  ForeignToplevel
 A single toplevel window owned by some other Wayland client. 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  LockSurface
 Marks a QWindow as an ext_session_lock_surface_v1 for one output. More...
class  SessionLock
 Client-side wrapper around ext_session_lock_manager_v1 / ext_session_lock_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 quint32 surfaceObjectId (QWindow *window)
 The Wayland protocol object id of window's wl_surface, or 0 when the window has no realised Wayland surface (not yet shown, or a non-Wayland platform).
PHOSPHORWAYLAND_EXPORT bool isToplevelDragSupported ()

Typedef Documentation

◆ CompositorLostCallback

using PhosphorWayland::CompositorLostCallback = 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

Function Documentation

◆ addCompositorLostCallback()

PHOSPHORWAYLAND_EXPORT CompositorLostCookie PhosphorWayland::addCompositorLostCallback ( CompositorLostCallback cb)
nodiscard

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 there is a Wayland connection to make: WAYLAND_SOCKET is set, WAYLAND_DISPLAY is set, or a wayland-0 or wayland-1 socket exists in XDG_RUNTIME_DIR.

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).

◆ surfaceObjectId()

PHOSPHORWAYLAND_EXPORT quint32 PhosphorWayland::surfaceObjectId ( QWindow * window)
nodiscard

The Wayland protocol object id of window's wl_surface, or 0 when the window has no realised Wayland surface (not yet shown, or a non-Wayland platform).

The id is the one thing about a surface that BOTH sides of the protocol can name: a client's wl_proxy_get_id and a compositor's wl_resource_get_id return the same number for the same object. That makes it the handle a client uses to tell a compositor-side component WHICH of its surfaces it is talking about — nothing else about a layer surface (its class, its title, its role, its geometry) survives the trip in a form a compositor exposes per surface.

The id is unique only among a client's LIVE objects; Wayland reuses ids after an object is destroyed. A holder of one must therefore drop it when the surface goes, not keep it as a permanent name.