Immutable per-surface configuration passed to SurfaceFactory::create(). More...
#include <phosphor-layer/include/PhosphorLayer/SurfaceConfig.h>
Public Member Functions | |
| Layer | effectiveLayer () const noexcept |
| Anchors | effectiveAnchors () const noexcept |
| int | effectiveExclusiveZone () const noexcept |
| KeyboardInteractivity | effectiveKeyboard () const noexcept |
| QMargins | effectiveMargins () const noexcept |
| QString | effectiveDebugName () const |
| SurfaceConfig () | |
| ~SurfaceConfig () | |
| SurfaceConfig (const SurfaceConfig &)=delete | |
| SurfaceConfig & | operator= (const SurfaceConfig &)=delete |
| SurfaceConfig (SurfaceConfig &&) noexcept | |
| SurfaceConfig & | operator= (SurfaceConfig &&) noexcept |
Public Attributes | |
| Role | role |
| Protocol-level defaults. Required. | |
| QUrl | contentUrl |
QML root component URL (qrc:/… or file://…). | |
| std::unique_ptr< QQuickItem > | contentItem |
| Pre-built QQuickItem. | |
| QScreen * | screen = nullptr |
| Target screen. | |
| QVariantMap | contextProperties |
| Injected into the surface's QML root context. | |
| QVariantMap | windowProperties |
| Applied to the QQuickWindow as dynamic properties (via QObject:: setProperty) BEFORE the QML content loads. | |
| QQmlEngine * | sharedEngine = nullptr |
| Opt-in shared QQmlEngine. | |
| std::optional< Layer > | layerOverride |
| std::optional< Anchors > | anchorsOverride |
| std::optional< int > | exclusiveZoneOverride |
| std::optional< KeyboardInteractivity > | keyboardOverride |
| std::optional< QMargins > | marginsOverride |
| bool | keepMappedOnHide = false |
| When true, Surface::hide() does NOT call QQuickWindow::hide(); the surface stays Qt-visible and the visual "hidden" state is driven by the injected ISurfaceAnimator (typically by animating the root QML item's opacity to 0). | |
| QSize | initialSize = {} |
| Initial size committed to the wl_surface during warm-up. | |
| QString | debugName |
| Logged in state transitions. Defaults to Role::scopePrefix when empty. | |
Immutable per-surface configuration passed to SurfaceFactory::create().
Aggregates a Role (protocol-level defaults) with per-instance data: content source, target screen, per-instance overrides of role defaults, optional shared QML engine.
Reconfiguration = destroy + recreate. This matches wlr-layer-shell, which forbids most post-show property changes (layer, anchors, output, scope are all immutable per protocol).
Exactly one of contentUrl / contentItem must be non-empty.
| PhosphorLayer::SurfaceConfig::SurfaceConfig | ( | ) |
| PhosphorLayer::SurfaceConfig::~SurfaceConfig | ( | ) |
|
delete |
|
noexcept |
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
delete |
|
noexcept |
| std::optional<Anchors> PhosphorLayer::SurfaceConfig::anchorsOverride |
| std::unique_ptr<QQuickItem> PhosphorLayer::SurfaceConfig::contentItem |
Pre-built QQuickItem.
Ownership is transferred to the Surface at construction. Mutually exclusive with contentUrl. Note: unique_ptr is intentionally non-copyable — SurfaceConfig containing a contentItem is move-only.
| QUrl PhosphorLayer::SurfaceConfig::contentUrl |
QML root component URL (qrc:/… or file://…).
Mutually exclusive with contentItem.
| QVariantMap PhosphorLayer::SurfaceConfig::contextProperties |
Injected into the surface's QML root context.
Keys become context properties visible to the loaded QML as global identifiers.
| QString PhosphorLayer::SurfaceConfig::debugName |
Logged in state transitions. Defaults to Role::scopePrefix when empty.
| std::optional<int> PhosphorLayer::SurfaceConfig::exclusiveZoneOverride |
| QSize PhosphorLayer::SurfaceConfig::initialSize = {} |
Initial size committed to the wl_surface during warm-up.
Determines the size of the first Vulkan swapchain Qt allocates.
When isEmpty() (the default QSize{}), warm-up sizes the wrapper QQuickWindow to the target screen's full geometry. That guarantees a non-zero buffer for partial-anchor layer surfaces (see the "non-zero
size BEFORE completeCreate" invariant in surface.cpp::instantiateFromComponent), but it costs a full-screen swapchain (~25 MB at 4K × 3 buffers on NVIDIA) even when the eventual visible content is a small toast.
When non-empty, surface.cpp uses this as the warm-up geometry instead. Subsequent imperative setWidth/setHeight calls still resize the surface; this only governs the size of the warm-up commit. Pass the largest size the surface is expected to grow to in practice — that way Qt avoids the "small swapchain → resize on first show" round trip on NVIDIA, where swapchain resize is destroy + recreate.
QSize::isEmpty() (any non-positive dimension) is the unset sentinel; partially-zero sizes are silently treated as "use the
default" — pass a fully-positive size or leave it default.
| bool PhosphorLayer::SurfaceConfig::keepMappedOnHide = false |
When true, Surface::hide() does NOT call QQuickWindow::hide(); the surface stays Qt-visible and the visual "hidden" state is driven by the injected ISurfaceAnimator (typically by animating the root QML item's opacity to 0).
The library still flips the underlying QWindow's Qt::WindowTransparentForInput flag during the hide so the still-mapped layer surface stops intercepting clicks at its screen position.
Use this for overlays where reattaching the wl_surface (and its Vulkan swapchain) on every show/hide cycle is too expensive — the PlasmaZones layout picker, navigation OSD, and zone selector all fall into this category. The Phase-4 LayoutOsd "L3 v2" pattern pioneered this for OSDs; Phase 5 generalises it into the library.
Default false preserves the original lifecycle: hide() unmaps the window immediately and a future show() pays the reattach cost.
| std::optional<KeyboardInteractivity> PhosphorLayer::SurfaceConfig::keyboardOverride |
| std::optional<Layer> PhosphorLayer::SurfaceConfig::layerOverride |
| std::optional<QMargins> PhosphorLayer::SurfaceConfig::marginsOverride |
| Role PhosphorLayer::SurfaceConfig::role |
Protocol-level defaults. Required.
| QScreen* PhosphorLayer::SurfaceConfig::screen = nullptr |
Target screen.
Nullptr means "let the factory resolve to the screen
provider's primary()". Consumers that want focus-follows-surface can pass IScreenProvider::focused() here.
| QQmlEngine* PhosphorLayer::SurfaceConfig::sharedEngine = nullptr |
| QVariantMap PhosphorLayer::SurfaceConfig::windowProperties |
Applied to the QQuickWindow as dynamic properties (via QObject:: setProperty) BEFORE the QML content loads.
Lets the QML access them via the implicit window.foo binding. Distinct from contextProperties: window properties are per-surface (won't leak between shared-engine surfaces) and are observable through Qt's property system (QVariant).