Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
Phosphor::Screens::VirtualScreenDef Struct Reference

Definition of a single virtual screen within a physical screen. More...

#include <phosphor-screens/include/PhosphorScreens/VirtualScreen.h>

Classes

struct  PhysicalEdges
 Check which edges of this virtual screen are at the physical screen boundary (vs internal edges shared with another virtual screen). More...
 

Public Member Functions

QRect absoluteGeometry (const QRect &physicalGeometry) const
 Compute absolute geometry from the physical screen's geometry.
 
bool operator== (const VirtualScreenDef &) const =default
 Exact bitwise equality across every field.
 
bool approxEqual (const VirtualScreenDef &other) const
 Tolerance-aware comparison for change-detection paths that round through JSON.
 
bool isValid () const
 Check if the definition is valid: non-empty id, non-empty physicalScreenId, non-negative origin, non-zero size, region within [0,1] bounds.
 
PhysicalEdges physicalEdges () const
 

Public Attributes

QString id
 Full ID: "physicalId/vs:N".
 
QString physicalScreenId
 Owning physical screen's stable EDID ID.
 
QString displayName
 User-facing name, e.g. "Left", "Right".
 
QRectF region
 Relative geometry within physical screen (0-1)
 
int index = 0
 Index within the physical screen's subdivision.
 

Static Public Attributes

static constexpr qreal Tolerance = 1e-3
 Shared tolerance for floating-point region comparisons.
 

Detailed Description

Definition of a single virtual screen within a physical screen.

A virtual screen represents a rectangular sub-region of a physical monitor. Each virtual screen gets its own screen ID, layout assignments, autotile state, overlay windows, and all other per-screen functionality.

Member Function Documentation

◆ absoluteGeometry()

QRect Phosphor::Screens::VirtualScreenDef::absoluteGeometry ( const QRect &  physicalGeometry) const
inline

Compute absolute geometry from the physical screen's geometry.

Uses edge-consistent rounding to avoid 1px gaps/overlaps between adjacent screens.

◆ approxEqual()

bool Phosphor::Screens::VirtualScreenDef::approxEqual ( const VirtualScreenDef other) const
inline

Tolerance-aware comparison for change-detection paths that round through JSON.

Non-transitive by construction — do NOT use as a hashed-container equality predicate; use operator== there.

◆ isValid()

bool Phosphor::Screens::VirtualScreenDef::isValid ( ) const
inline

Check if the definition is valid: non-empty id, non-empty physicalScreenId, non-negative origin, non-zero size, region within [0,1] bounds.

Uses Tolerance to handle float serialization precision loss. Note: slightly negative coordinates (within -Tolerance) are accepted and clamped to zero by absoluteGeometry(). Always use absoluteGeometry() to obtain pixel coordinates rather than consuming region directly.

◆ operator==()

bool Phosphor::Screens::VirtualScreenDef::operator== ( const VirtualScreenDef ) const
default

Exact bitwise equality across every field.

Safe for hashed containers (transitive) and for tests that need deterministic round-trip asserts. Change-detection sites that want to swallow JSON-serialisation precision noise should use approxEqual explicitly — making the default operator fuzzy used to hide a non-transitivity trap from every consumer (a==b ∧ b==c did not imply a==c once region deltas chained across the tolerance window).

◆ physicalEdges()

PhysicalEdges Phosphor::Screens::VirtualScreenDef::physicalEdges ( ) const
inline

Member Data Documentation

◆ displayName

QString Phosphor::Screens::VirtualScreenDef::displayName

User-facing name, e.g. "Left", "Right".

◆ id

QString Phosphor::Screens::VirtualScreenDef::id

Full ID: "physicalId/vs:N".

◆ index

int Phosphor::Screens::VirtualScreenDef::index = 0

Index within the physical screen's subdivision.

◆ physicalScreenId

QString Phosphor::Screens::VirtualScreenDef::physicalScreenId

Owning physical screen's stable EDID ID.

◆ region

QRectF Phosphor::Screens::VirtualScreenDef::region

Relative geometry within physical screen (0-1)

◆ Tolerance

constexpr qreal Phosphor::Screens::VirtualScreenDef::Tolerance = 1e-3
staticconstexpr

Shared tolerance for floating-point region comparisons.

Used by isValid() and physicalEdges() to handle serialization precision loss.


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