8#include "phosphorscreensruntime_export.h"
128 return m_cfg.maxVirtualScreensPerPhysical;
248 QString
virtualScreenAt(
const QPoint& globalPos,
const QString& physicalScreenId)
const;
359 std::optional<QSize>
pixelSize(
const QString& screenId)
const;
508 void syncTrackedScreens();
519 void destroyGeometrySensor(
const QString& screenName);
520 void onSensorGeometryChanged(
const QString& screenName);
526 void onPanelOffsetsChanged(QScreen* screen);
527 void onPanelRequeryCompleted();
529 void onConfigStoreChanged();
538 bool m_running =
false;
539 bool m_panelGeometryReadyEmitted =
false;
541 QVector<PhysicalScreen> m_trackedScreens;
545 QHash<QString, QPointer<QWindow>> m_geometrySensors;
558 mutable QHash<QString, QRect> m_availableGeometryCache;
566 QHash<QString, QRect> m_compositorAvailableGeometry;
569 QHash<QString, VirtualScreenConfig> m_virtualConfigs;
571 mutable QStringList m_cachedEffectiveScreenIds;
572 mutable bool m_effectiveScreenIdsDirty =
true;
574 mutable QHash<QString, QRect> m_virtualGeometryCache;
582 mutable QSet<QString> m_warnedVirtualGeometryMisses;
584 void invalidateVirtualGeometryCache(
const QString& physicalScreenId = {})
const;
585 void rebuildVirtualGeometryCache(
const QString& physicalScreenId)
const;
587 QString virtualScreenAtWithScreen(
const QPoint& globalPos,
const QString& physicalScreenId,
595 void propagateIdentifierDrift(
const QHash<QString, QString>& oldIds);
600 std::optional<QSize> resolvePixelSize(
const QString& screenId,
bool* reported)
const;
606 QHash<QString, QSize> m_compositorPixelSizes;
611 QHash<QString, QSize> m_seededPixelSizes;
617 QHash<QString, QSize> m_acceptedPixelSizes;
622 QSet<QString> m_mappedScaleSensors;
Pluggable persistence for virtual-screen configurations.
Definition IConfigStore.h:37
Pluggable producer of panel-reservation offsets per screen.
Definition IPanelSource.h:33
Pluggable source of the connected-output set and its lifecycle.
Definition IPhysicalScreenSource.h:43
void scheduleDelayedPanelRequery(int delayMs)
Schedule a one-shot panel re-query after delayMs.
void refreshVirtualConfigs(const QHash< QString, VirtualScreenConfig > &configs)
Diff configs against the current cache and apply the delta.
bool isPixelSizeReported(const QString &screenId) const
True only when pixelSize answers screenId from an accepted compositor report rather than from a seed ...
void virtualScreenRegionsChanged(const QString &physicalScreenId)
VS regions changed but the VS ID set is unchanged (swap, rotate, boundary resize).
ScreenManagerConfig Config
Definition Manager.h:89
void setCompositorAvailableGeometry(const QString &screenName, const QRect &available)
Record the authoritative per-screen available geometry as reported by the compositor.
QRect screenGeometry(const QString &screenId) const
QRect actualAvailableGeometry(const PhysicalScreen &screen) const
Per-screen panel-aware available geometry.
QRect screenAvailableGeometry(const QString &screenId) const
void screenRemoved(const PhysicalScreen &screen)
QStringList effectiveScreenIds() const
bool isLogicalScaleSensorMapped(const PhysicalScreen &screen) const
Whether screen's geometry sensor has mapped, so logicalScale answers the compositor's own scale for i...
bool hasVirtualScreens(const QString &physicalScreenId) const
void screenIdentifierChanged(const QString &oldId, const QString &newId)
Emitted when a connected screen's identifier flips — e.g.
void screenAdded(const PhysicalScreen &screen)
QStringList virtualScreenIdsFor(const QString &physicalScreenId) const
QString effectiveScreenAt(const QPoint &globalPos) const
void stop()
Tear down everything start() set up. Idempotent.
bool isPanelGeometryReady() const
Has the panel source produced its first reading?
bool setVirtualScreenConfig(const QString &physicalScreenId, const VirtualScreenConfig &config)
Apply a single VS subdivision config.
PhysicalScreen primaryScreen() const
void acceptedPixelSizeChanged(const QString &connectorName)
What pixelSize answers for connectorName's screen changed: an accept moved the accepted report (accep...
PhysicalScreen physicalScreenFor(const QString &screenId) const
The physical output a (physical or virtual) screen ID resolves to.
void availableGeometryChanged(const PhysicalScreen &screen, const QRect &availableGeometry)
void panelGeometryReady()
Fired once when isPanelGeometryReady transitions to true.
std::optional< QSize > pendingPixelSize(const QString &connectorName) const
The report pending for connectorName (setCompositorPixelSize), for a host deciding whether to accept ...
void delayedPanelRequeryCompleted()
Fired when a delayed panel re-query (scheduleDelayedPanelRequery) has settled.
QString virtualScreenAt(const QPoint &globalPos, const QString &physicalScreenId) const
qreal logicalScale(QScreen *screen) const
Bridge overload for consumers holding a live QScreen*.
void logicalScaleSensorMapped(const PhysicalScreen &screen)
screen's geometry sensor mapped (isLogicalScaleSensorMapped): from now on logicalScale answers the co...
ScreenManager(ScreenManagerConfig cfg=ScreenManagerConfig{}, QObject *parent=nullptr)
VirtualScreenDef::PhysicalEdges physicalEdgesFor(const QString &screenId) const
~ScreenManager() override
VirtualScreenConfig virtualScreenConfig(const QString &physicalScreenId) const
void virtualScreensChanged(const QString &physicalScreenId)
VS topology changed (added, removed, renamed).
int maxVirtualScreensPerPhysical() const
Maximum number of virtual screens per physical monitor this manager will admit.
Definition Manager.h:126
void acceptCompositorPixelSize(const QString &connectorName)
Promote connectorName's pending report to the accepted one.
void setCompositorPixelSize(const QString &connectorName, const QSize &pixelSize)
Record an output's exact size in device pixels as reported by the compositor, PENDING until the host ...
void compositorPixelSizeChanged(const QString &connectorName)
The report pending for connectorName was recorded, changed or cleared (setCompositorPixelSize),...
void seedPixelSize(const QString &physicalScreenId, const QSize &pixelSize)
Seed a monitor's size in device pixels from the host's own record, for use until a compositor report ...
QVector< PhysicalScreen > screens() const
bool hasLogicalScaleSensor(const PhysicalScreen &screen) const
Whether screen has a geometry sensor, so logicalScale answers the compositor's fractional scale,...
PhysicalScreen screenByName(const QString &name) const
bool eventFilter(QObject *watched, QEvent *event) override
Watches the geometry sensors for QEvent::DevicePixelRatioChange, which is the only notice Qt gives th...
std::optional< QSize > pixelSize(const QString &screenId) const
A screen's size in device pixels, the one answer every reader uses.
qreal logicalScale(const PhysicalScreen &screen) const
The compositor's LOGICAL scale for screen (1.15, 1.5, 2.0…).
QRect actualAvailableGeometry(QScreen *screen) const
Bridge overload for consumers that still hold a live QScreen*.
void screenGeometryChanged(const PhysicalScreen &screen)
void start()
Begin tracking screens.
void logicalScaleChanged(const PhysicalScreen &screen)
logicalScale has a different answer for screen than it did.
Definition IWindowTrackingService.h:28
A physical output as ScreenManager sees it — decoupled from QScreen.
Definition PhysicalScreen.h:37
Construction-time wiring for ScreenManager.
Definition Manager.h:54
int maxVirtualScreensPerPhysical
Definition Manager.h:59
IConfigStore * configStore
Definition Manager.h:57
IPanelSource * panelSource
Definition Manager.h:56
bool useGeometrySensors
Definition Manager.h:58
IPhysicalScreenSource * physicalScreenSource
Definition Manager.h:55
Configuration for how a physical screen is subdivided into virtual screens.
Definition VirtualScreen.h:124
Check which edges of this virtual screen are at the physical screen boundary (vs internal edges share...
Definition VirtualScreen.h:103