Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorScreens::IPhysicalScreenSource Class Referenceabstract

Pluggable source of the connected-output set and its lifecycle. More...

#include <PhosphorScreens/IPhysicalScreenSource.h>

Inheritance diagram for PhosphorScreens::IPhysicalScreenSource:
[legend]

Signals

void screenAdded (const PhysicalScreen &screen)
 A new output connected.
void screenRemoved (const PhysicalScreen &screen)
 An output disconnected.
void screenGeometryChanged (const PhysicalScreen &screen)
 A connected output's geometry changed (move, resize, rotate, scale).

Public Member Functions

 IPhysicalScreenSource (QObject *parent=nullptr)
 ~IPhysicalScreenSource () override=default
virtual QVector< PhysicalScreen > screens () const =0
 Every currently-connected output. Order is not significant.
virtual PhysicalScreen primaryScreen () const =0
 The primary output, or an invalid PhysicalScreen if there is none.

Detailed Description

Pluggable source of the connected-output set and its lifecycle.

ScreenManager enumerates outputs and reacts to add / remove / move / resize through this interface instead of touching QGuiApplication and QScreen directly. The production implementation (QtPhysicalScreenSource) is a thin wrapper over Qt; a test implementation (FakePhysicalScreenSource) synthesizes outputs with arbitrary geometry and fires the lifecycle signals on demand — which is what makes the geometry-recompute path regression-testable (QScreen itself cannot be constructed by test code).

Mirrors the existing IPanelSource / IConfigStore seam pattern: the concrete provider is injected via ScreenManagerConfig and owned by the consumer; it must outlive the ScreenManager that holds the pointer.

NOT to be confused with PhosphorLayer::IScreenProvider, which this was called until the two names collided in review. They are different seams at different layers and neither library links the other. This one answers "which physical outputs exist, and what just happened to them", in PhysicalScreen value snapshots, and deliberately does NOT hand out QScreen* — that is the whole point, since QScreen cannot be constructed by test code. The layer one answers "which `QScreen*` should this surface attach to" and must traffic in Qt's type because layer-shell surfaces bind to real Qt screens. Merging them would defeat one or the other.

Threading: ScreenManager calls screens() / primaryScreen() from the GUI thread; implementations must emit the signals on the GUI thread.

Constructor & Destructor Documentation

◆ IPhysicalScreenSource()

PhosphorScreens::IPhysicalScreenSource::IPhysicalScreenSource ( QObject * parent = nullptr)
inlineexplicit

◆ ~IPhysicalScreenSource()

PhosphorScreens::IPhysicalScreenSource::~IPhysicalScreenSource ( )
overridedefault

Member Function Documentation

◆ primaryScreen()

virtual PhysicalScreen PhosphorScreens::IPhysicalScreenSource::primaryScreen ( ) const
pure virtual

The primary output, or an invalid PhysicalScreen if there is none.

Implemented in PhosphorScreens::QtPhysicalScreenSource.

◆ screenAdded

void PhosphorScreens::IPhysicalScreenSource::screenAdded ( const PhysicalScreen & screen)
signal

A new output connected.

The PhysicalScreen carries its geometry at emission time — which may still be a transient origin that settles via a subsequent screenGeometryChanged.

◆ screenGeometryChanged

void PhosphorScreens::IPhysicalScreenSource::screenGeometryChanged ( const PhysicalScreen & screen)
signal

A connected output's geometry changed (move, resize, rotate, scale).

The PhysicalScreen carries the NEW geometry — consumers replace any stored snapshot with this one.

◆ screenRemoved

void PhosphorScreens::IPhysicalScreenSource::screenRemoved ( const PhysicalScreen & screen)
signal

An output disconnected.

Identified by connector name; its geometry is whatever was last known.

◆ screens()

virtual QVector< PhysicalScreen > PhosphorScreens::IPhysicalScreenSource::screens ( ) const
pure virtual

Every currently-connected output. Order is not significant.

Implemented in PhosphorScreens::QtPhysicalScreenSource.


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