Configuration for how a physical screen is subdivided into virtual screens.
More...
#include <phosphor-screens/include/PhosphorScreens/VirtualScreen.h>
|
| static bool | isValid (const VirtualScreenConfig &cfg, const QString &expectedPhysicalScreenId, int maxScreensPerPhysical, QString *error=nullptr) |
| | Validate geometric and structural invariants for this config.
|
| |
Configuration for how a physical screen is subdivided into virtual screens.
When screens is empty, the physical screen has no subdivisions and acts as a single implicit virtual screen (backward-compatible default).
◆ approxEqual()
| bool Phosphor::Screens::VirtualScreenConfig::approxEqual |
( |
const VirtualScreenConfig & |
other | ) |
const |
|
inline |
Tolerance-aware equivalent of operator==: compares defs pairwise using VirtualScreenDef::approxEqual.
Order-sensitive (mirroring operator== semantics) — callers that need order-insensitive equivalence should do their own by-ID pairing. Non-transitive by construction; not safe as a hashed-container key.
◆ hasSubdivisions()
| bool Phosphor::Screens::VirtualScreenConfig::hasSubdivisions |
( |
| ) |
const |
|
inline |
◆ isEmpty()
| bool Phosphor::Screens::VirtualScreenConfig::isEmpty |
( |
| ) |
const |
|
inline |
◆ isValid()
| static bool Phosphor::Screens::VirtualScreenConfig::isValid |
( |
const VirtualScreenConfig & |
cfg, |
|
|
const QString & |
expectedPhysicalScreenId, |
|
|
int |
maxScreensPerPhysical, |
|
|
QString * |
error = nullptr |
|
) |
| |
|
inlinestatic |
Validate geometric and structural invariants for this config.
Returns true if the config is acceptable to apply (including the empty/removal case — empty configs are always valid). On failure, writes a single human-readable reason to *error.
Centralizing the checks here lets both Settings (writing the source of truth) and ScreenManager (refreshing its cache) reject the same invalid inputs the same way, avoiding the divergence where Settings stores invalid data that ScreenManager later refuses to apply.
◆ operator==()
Exact vector equality: order-sensitive (QVector::operator==) and delegates to VirtualScreenDef::operator== (also exact).
Two configs with the same VS defs in different array orders compare as NOT equal, even though they describe identical topology. The regionsOnly detection in ScreenManager::setVirtualScreenConfig is the order-insensitive path that catches reordered-but-identical configs and routes them through the cheaper regions-only signal. For tolerance-aware comparison (JSON round-trip change detection) use approxEqual.
◆ rotateRegions()
| bool Phosphor::Screens::VirtualScreenConfig::rotateRegions |
( |
const QVector< QString > & |
orderedIds, |
|
|
bool |
clockwise |
|
) |
| |
|
inline |
Rotate the region fields through the defs identified by orderedIds.
Convention matches WindowTrackingService::calculateRotation — with clockwise = true, the def at position i in the ring inherits the region of its successor (position (i+1) mod n); with clockwise = false, it inherits the region of its predecessor (position (i-1) mod n).
Read another way: on a CW rotation, each region's content moves backward one slot in the ordered ring (the region that was at def[1] now sits at def[0], so callers walking the ring in order see content shifting toward index 0 with the index-0 region wrapping to position n-1). When orderedIds is constructed from a spatial CW angle sort of a 2D grid, this matches the visual expectation that "CW rotate" cycles content clockwise around the ring.
IDs and all other def fields are preserved. orderedIds may be a subset of the config's defs so callers can rotate only a subset. Returns false if orderedIds has fewer than two entries, any id is not found in the config, or any id appears more than once (duplicates would cause two ring slots to share a target def index — the rotation loop would then overwrite the same def twice with different sources and silently corrupt geometry).
◆ swapRegions()
| bool Phosphor::Screens::VirtualScreenConfig::swapRegions |
( |
const QString & |
idA, |
|
|
const QString & |
idB |
|
) |
| |
|
inline |
Swap the region fields of the two defs identified by idA and idB.
All other fields (id, physicalScreenId, displayName, index) are preserved so downstream state keyed on VS ID — windows, layouts, autotile state — remains valid and follows the new geometry. Returns false if either id is absent or both ids reference the same def.
◆ physicalScreenId
| QString Phosphor::Screens::VirtualScreenConfig::physicalScreenId |
◆ screens
The documentation for this struct was generated from the following file: