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

Per-surface decoration shader-pack chain and its per-pack parameters. More...

#include <PhosphorSurface/DecorationProfile.h>

Public Member Functions

QStringList effectiveChain () const
QVariantMap storedParameters () const
 The stored per-pack parameter map, without judgement.
QVariantMap effectiveParameters () const
 The parameter map a RENDERER should consume.
QStringList effectiveDisabledPacks () const
QVariantMap effectivePresetIds () const
QString presetIdFor (const QString &packId) const
 The preset chosen for packId, or an empty string when that layer uses none.
QStringList enabledChain () const
 The chain the RENDERERS consume: effectiveChain() minus the disabled packs.
DecorationProfile withDefaults () const
QJsonObject toJson () const
bool operator== (const DecorationProfile &other) const
bool operator!= (const DecorationProfile &other) const

Static Public Member Functions

static DecorationProfile fromJson (const QJsonObject &obj)
static void overlay (DecorationProfile &dst, const DecorationProfile &src)
 Overlay src onto dst: every engaged field in src replaces the corresponding field in dst.

Public Attributes

std::optional< QStringList > chain
 Ordered surface-pack ids, resolved by id from SurfaceShaderRegistry, e.g.
std::optional< QVariantMap > parameters
 Per-pack parameter overrides.
std::optional< QStringList > disabledPacks
 Pack ids from chain that are toggled OFF (the per-layer disable toggle — same semantics as a rule's enabled flag, inverted so an absent field means "everything on").
std::optional< QVariantMap > presetIds
 Per-pack preset selection.

Static Public Attributes

static constexpr auto JsonFieldChain = "chain"
static constexpr auto JsonFieldParameters = "parameters"
static constexpr auto JsonFieldDisabledPacks = "disabledPacks"
static constexpr auto JsonFieldPresetIds = "presetIds"

Detailed Description

Per-surface decoration shader-pack chain and its per-pack parameters.

Parallel to PhosphorAnimationShaders::ShaderProfile which configures a single transition effect per event, DecorationProfile configures the persistent decoration of a surface: an ordered chain of surface shader packs (border, glow, …) plus the per-pack parameters that style them. Border width, radius and colour are NOT decoration fields of their own — they are the border pack's parameters, carried in parameters. Both are resolved through a separate tree (DecorationProfileTree) over a dot-path surface namespace (window.tiled, popup.snapAssist, …) so the two concerns evolve independently.

"Set" vs "unset" semantics

Same contract as ShaderProfile: std::optional fields distinguish "inherit from parent" (nullopt) from "I explicitly chose this value" (engaged). A leaf with an engaged chain wins over a category that sets one. A leaf with chain = std::nullopt inherits whatever the category or baseline says.

An explicitly-empty chain (engaged optional containing an empty list) means "no decoration shader packs for this surface" — the surface runs no surface shader. This lets a child disable a parent's pack chain.

Member Function Documentation

◆ effectiveChain()

QStringList PhosphorSurfaceShaders::DecorationProfile::effectiveChain ( ) const
inline

◆ effectiveDisabledPacks()

QStringList PhosphorSurfaceShaders::DecorationProfile::effectiveDisabledPacks ( ) const
inline

◆ effectiveParameters()

QVariantMap PhosphorSurfaceShaders::DecorationProfile::effectiveParameters ( ) const
inline

The parameter map a RENDERER should consume.

Identical to storedParameters() once the presets have been applied, and a loud warning when they have not. "Flattened" is a convention here rather than a type — the only marker is that the consumed presetIds entries were cleared — so nothing in the type system stops a consumer from reading this on a RAW profile, where the answer is plausible and wrong because the presets' values are simply missing and the pack's declared min/max is unenforced.

The animation twin grew this warning first, and its absence here is exactly why the shell's chrome went unflattened unnoticed: every OTHER surface consumer happened to flatten, so nothing pointed at the one that did not.

In BOTH builds, for the reason the twin gives: a debug-only assert would have caught none of those sites in a user session. It warns rather than refusing because the result is degraded, not dangerous.

Only a NON-EMPTY preset id counts as unapplied. An empty-string entry is the blocking sentinel ("this pack follows no preset"), which the flatten deliberately PRESERVES, so warning on it would fire on every correctly flattened profile that carries one.

◆ effectivePresetIds()

QVariantMap PhosphorSurfaceShaders::DecorationProfile::effectivePresetIds ( ) const
inline

◆ enabledChain()

QStringList PhosphorSurfaceShaders::DecorationProfile::enabledChain ( ) const
inline

The chain the RENDERERS consume: effectiveChain() minus the disabled packs.

Edit-facing consumers (the settings chain editor) keep reading effectiveChain() so a disabled layer still shows in the list.

◆ fromJson()

DecorationProfile PhosphorSurfaceShaders::DecorationProfile::fromJson ( const QJsonObject & obj)
static

◆ operator!=()

bool PhosphorSurfaceShaders::DecorationProfile::operator!= ( const DecorationProfile & other) const
inline

◆ operator==()

bool PhosphorSurfaceShaders::DecorationProfile::operator== ( const DecorationProfile & other) const

◆ overlay()

void PhosphorSurfaceShaders::DecorationProfile::overlay ( DecorationProfile & dst,
const DecorationProfile & src )
static

Overlay src onto dst: every engaged field in src replaces the corresponding field in dst.

Unset fields in src are skipped.

◆ presetIdFor()

QString PhosphorSurfaceShaders::DecorationProfile::presetIdFor ( const QString & packId) const
inline

The preset chosen for packId, or an empty string when that layer uses none.

Only tests call this today, and it stays anyway: it is one of the effective* family every field on this value type carries, and the alternative is tests reading presetIds->value(...).toString() by hand, which re-spells the nullopt case at each site. Not dead code to prune.

◆ storedParameters()

QVariantMap PhosphorSurfaceShaders::DecorationProfile::storedParameters ( ) const
inline

The stored per-pack parameter map, without judgement.

For a caller that legitimately wants the RAW values while a preset is still engaged: the flatten itself, which needs them as the delta set, and the settings controller's edit-facing reads, which show and write what this node stores of its own. Named so those reads state their intent instead of sharing a spelling with the reads that want the effective answer. Mirrors the animation twin's storedParameters().

◆ toJson()

QJsonObject PhosphorSurfaceShaders::DecorationProfile::toJson ( ) const

◆ withDefaults()

DecorationProfile PhosphorSurfaceShaders::DecorationProfile::withDefaults ( ) const

Member Data Documentation

◆ chain

std::optional<QStringList> PhosphorSurfaceShaders::DecorationProfile::chain

Ordered surface-pack ids, resolved by id from SurfaceShaderRegistry, e.g.

{"border", "glow"}. std::nullopt = inherit. Engaged-but-empty list = explicitly no packs.

◆ disabledPacks

std::optional<QStringList> PhosphorSurfaceShaders::DecorationProfile::disabledPacks

Pack ids from chain that are toggled OFF (the per-layer disable toggle — same semantics as a rule's enabled flag, inverted so an absent field means "everything on").

A disabled pack stays in the chain with its parameters intact; only enabledChain() filters it, so re-enabling restores the exact prior look. std::nullopt = inherit. Engaged-but-empty list = explicitly nothing disabled.

◆ JsonFieldChain

auto PhosphorSurfaceShaders::DecorationProfile::JsonFieldChain = "chain"
staticconstexpr

◆ JsonFieldDisabledPacks

auto PhosphorSurfaceShaders::DecorationProfile::JsonFieldDisabledPacks = "disabledPacks"
staticconstexpr

◆ JsonFieldParameters

auto PhosphorSurfaceShaders::DecorationProfile::JsonFieldParameters = "parameters"
staticconstexpr

◆ JsonFieldPresetIds

auto PhosphorSurfaceShaders::DecorationProfile::JsonFieldPresetIds = "presetIds"
staticconstexpr

◆ parameters

std::optional<QVariantMap> PhosphorSurfaceShaders::DecorationProfile::parameters

Per-pack parameter overrides.

Shape: { packId -> { paramId -> value } }. Keys are pack ids from chain; inner keys are parameter ids declared in the pack's SurfaceShaderEffect::parameters. std::nullopt = inherit. Engaged-but-empty map = explicitly use all defaults.

◆ presetIds

std::optional<QVariantMap> PhosphorSurfaceShaders::DecorationProfile::presetIds

Per-pack preset selection.

Shape: { packId -> presetId }, resolved by id from PhosphorShaders::ShaderPresetRegistry against that pack. std::nullopt = inherit. Engaged-but-empty map = explicitly no presets, so parameters is the whole tuning for every layer.

Naturally pack-keyed, like parameters, so a chain can carry a preset on one layer and hand-tuned values on the next. Where a pack appears here, its entry in parameters holds DELTAS on top of the preset: a parameter present there overrides the preset's value, and every parameter absent follows the preset. An entry naming a pack the resolved chain does not contain is inert, the same as a parameters entry for such a pack.


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