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

Source-of-truth interface for the available QScreen set. More...

#include <PhosphorLayer/IScreenProvider.h>

Inheritance diagram for PhosphorLayer::IScreenProvider:
[legend]

Public Member Functions

 IScreenProvider ()=default
virtual ~IScreenProvider ()=default
virtual QList< QScreen * > screens () const =0
 Full list of screens the surfaces should be aware of.
virtual QScreen * primary () const =0
 Canonical "primary" screen.
virtual QScreen * focused () const =0
 Screen currently containing the focus / cursor.
virtual ScreenProviderNotifier * notifier () const =0
 Notifier for signal-driven updates.

Detailed Description

Source-of-truth interface for the available QScreen set.

Abstracted so Phosphor can inject a virtual-screen-aware provider (where one physical QScreen may host several logical "screens") while a standalone consumer uses the default QGuiApplication-backed one.

Constructor & Destructor Documentation

◆ IScreenProvider()

PhosphorLayer::IScreenProvider::IScreenProvider ( )
default

◆ ~IScreenProvider()

virtual PhosphorLayer::IScreenProvider::~IScreenProvider ( )
virtualdefault

Member Function Documentation

◆ focused()

virtual QScreen * PhosphorLayer::IScreenProvider::focused ( ) const
pure virtual

Screen currently containing the focus / cursor.

Implementations that don't track focus return primary(). Consumers pick between primary() and focused() themselves when constructing a SurfaceConfig; the library does not carry an affinity enum.

Implemented in PhosphorLayer::DefaultScreenProvider.

◆ notifier()

virtual ScreenProviderNotifier * PhosphorLayer::IScreenProvider::notifier ( ) const
pure virtual

Notifier for signal-driven updates.

Pointer is owned by the provider; consumers must not delete it. Lifetime >= the provider's.

MAY RETURN NULLPTR, and every consumer must handle it. A provider that cannot observe screen changes at all ships null here rather than an inert notifier that never emits, so the inability is visible to the consumer instead of looking like a topology that simply never changes. DefaultScreenProvider always returns non-null; the null case is covered by test_topology's nullNotifierFromProviderDoesNotCrash.

This stays nullable even if every in-tree provider comes to return non-null — the test above is the reason, and it does not depend on who else implements this. The header is also installed and the class exported, so the implementations this repo can see need not be the whole set, and a provider that cannot observe screens is precisely the case null is here for. Do not tighten the contract, or delete a consumer's null branch, on the strength of an in-tree sweep.

A consumer that gets null degrades to a one-shot snapshot taken at construction: it still answers queries, it just never refreshes. It must NOT pass the null on to connect() — a null sender is not a crash, but it silently drops the connection and prints one QObject::connect warning per attempt, which reads as a Qt bug rather than an unsupported provider. Resolve the pointer ONCE into a local and branch on it; the interface does not promise a stable pointer across repeated calls.

Implemented in PhosphorLayer::DefaultScreenProvider.

◆ primary()

virtual QScreen * PhosphorLayer::IScreenProvider::primary ( ) const
pure virtual

Canonical "primary" screen.

SurfaceFactory falls back here when a SurfaceConfig doesn't pin a specific QScreen*. Also used as the recovery target when a bound screen is hot-unplugged.

Implemented in PhosphorLayer::DefaultScreenProvider.

◆ screens()

virtual QList< QScreen * > PhosphorLayer::IScreenProvider::screens ( ) const
pure virtual

Full list of screens the surfaces should be aware of.

Implemented in PhosphorLayer::DefaultScreenProvider.


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