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

Hierarchical ShaderProfile storage with walk-up inheritance. More...

#include <phosphor-animation/include/PhosphorAnimation/ShaderProfileTree.h>

Public Member Functions

 ShaderProfileTree ()=default
 
 ShaderProfileTree (const ShaderProfileTree &)=default
 
ShaderProfileTreeoperator= (const ShaderProfileTree &)=default
 
 ShaderProfileTree (ShaderProfileTree &&)=default
 
ShaderProfileTreeoperator= (ShaderProfileTree &&)=default
 
ShaderProfile resolve (const QString &path) const
 
ShaderProfile directOverride (const QString &path) const
 
bool hasOverride (const QString &path) const
 
QStringList overriddenPaths () const
 
void setOverride (const QString &path, const ShaderProfile &profile)
 
bool clearOverride (const QString &path)
 
void clearAllOverrides ()
 
ShaderProfile baseline () const
 
void setBaseline (const ShaderProfile &profile)
 
QJsonObject toJson () const
 
bool operator== (const ShaderProfileTree &other) const
 
bool operator!= (const ShaderProfileTree &other) const
 

Static Public Member Functions

static ShaderProfileTree fromJson (const QJsonObject &obj)
 

Detailed Description

Hierarchical ShaderProfile storage with walk-up inheritance.

Same inheritance semantics as PhosphorAnimation::ProfileTree but carrying ShaderProfile payloads instead of Profile. The two trees share the same dot-path namespace (ProfilePaths) so a consumer can resolve both motion and shader config for the same event path.

Walk-up inheritance

For "window.appearance.open", resolve() walks:

  1. "window.appearance.open" (leaf override)
  2. "window.appearance" (appearance contract group — the "All Appearance" node)
  3. "window" (category — the all-windows node)
  4. "global" (the assignable root node — a real chain member a user can store an override on)
  5. the tree baseline (setBaseline(), NOT the same thing as 4)
  6. library default (empty ShaderProfile — no effect)

Steps 4 and 5 are two independent levels and cutting one does not cut the other. That distinction is load-bearing for both exceptions below: an isolation that drops only the baseline still lets whatever the user assigned on the global node cascade in.

At each step, engaged optionals replace the accumulator. Unset fields pass through.

EXCEPTION 1, a leaf that inherits NOTHING: the interactive-drag leaf (window.movement.move) and the tab-switch leaf (scrolling.tabSwitch) take no inherited shader — resolve() reads only their direct override. The two are in the predicate for different reasons. The drag leaf's ancestor picks are single-surface crossfade packs by construction and cannot drive the held drag transition (see EventClassMove in ProfilePaths.h). The tab leaf's class is OPT-IN rather than universal-permissive — a pack must declare appliesTo: ["tab"] to be offered (see EventClassTab in ProfilePaths.h) — so every pack a picker offers on an ancestor FOR THAT ANCESTOR'S OWN SAKE is refused here. Note the leaf has three levels above it, not one: parentPath("scrolling") is global, not empty, and the baseline sits above that. The one pack that would survive the gate is a HYBRID declaring tab beside the ancestor's class (["tab","appearance"] is assignable on global, ["tab","strip"] on scrolling), so isolating the leaf is a policy choice for that case rather than a proof: a hybrid the user engaged for window appearance must not silently start driving tab swaps. For everything else the refusal is structural, and it happens when the transition BEGINS (shaderEffectAppliesToEventPath), not at install. Predicate: shaderPathResolvesInIsolation().

EXCEPTION 2, a SUBTREE that inherits normally within itself while nothing above it reaches in: today the shell root. Inheritance between the root and its legs works as usual, so a pack on the root cascades to them, but resolve() substitutes an empty baseline AND trims the chain back to the root, closing steps 4 and 5 together. Predicate: shaderPathIsolationRoot().

Thread safety

Value type, not internally synchronized. Same as ProfileTree.

Constructor & Destructor Documentation

◆ ShaderProfileTree() [1/3]

PhosphorAnimationShaders::ShaderProfileTree::ShaderProfileTree ( )
default

◆ ShaderProfileTree() [2/3]

PhosphorAnimationShaders::ShaderProfileTree::ShaderProfileTree ( const ShaderProfileTree )
default

◆ ShaderProfileTree() [3/3]

PhosphorAnimationShaders::ShaderProfileTree::ShaderProfileTree ( ShaderProfileTree &&  )
default

Member Function Documentation

◆ baseline()

ShaderProfile PhosphorAnimationShaders::ShaderProfileTree::baseline ( ) const
inline

◆ clearAllOverrides()

void PhosphorAnimationShaders::ShaderProfileTree::clearAllOverrides ( )

◆ clearOverride()

bool PhosphorAnimationShaders::ShaderProfileTree::clearOverride ( const QString &  path)

◆ directOverride()

ShaderProfile PhosphorAnimationShaders::ShaderProfileTree::directOverride ( const QString &  path) const

◆ fromJson()

static ShaderProfileTree PhosphorAnimationShaders::ShaderProfileTree::fromJson ( const QJsonObject &  obj)
static

◆ hasOverride()

bool PhosphorAnimationShaders::ShaderProfileTree::hasOverride ( const QString &  path) const

◆ operator!=()

bool PhosphorAnimationShaders::ShaderProfileTree::operator!= ( const ShaderProfileTree other) const
inline

◆ operator=() [1/2]

ShaderProfileTree & PhosphorAnimationShaders::ShaderProfileTree::operator= ( const ShaderProfileTree )
default

◆ operator=() [2/2]

ShaderProfileTree & PhosphorAnimationShaders::ShaderProfileTree::operator= ( ShaderProfileTree &&  )
default

◆ operator==()

bool PhosphorAnimationShaders::ShaderProfileTree::operator== ( const ShaderProfileTree other) const

◆ overriddenPaths()

QStringList PhosphorAnimationShaders::ShaderProfileTree::overriddenPaths ( ) const

◆ resolve()

ShaderProfile PhosphorAnimationShaders::ShaderProfileTree::resolve ( const QString &  path) const

◆ setBaseline()

void PhosphorAnimationShaders::ShaderProfileTree::setBaseline ( const ShaderProfile profile)

◆ setOverride()

void PhosphorAnimationShaders::ShaderProfileTree::setOverride ( const QString &  path,
const ShaderProfile profile 
)

◆ toJson()

QJsonObject PhosphorAnimationShaders::ShaderProfileTree::toJson ( ) const

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