Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhysicalScreen.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include "phosphorscreenscore_export.h"
7
8#include <QMetaType>
9#include <QRect>
10#include <QString>
11
12class QScreen;
13
14namespace Phosphor::Screens {
15
36struct PHOSPHORSCREENSCORE_EXPORT PhysicalScreen
37{
39 QString name;
40
44 QString identifier;
45
47 QRect geometry;
48
52 QScreen* qscreen = nullptr;
53
55 bool isValid() const
56 {
57 return !name.isEmpty();
58 }
59
61 bool operator==(const PhysicalScreen& other) const
62 {
63 return name == other.name;
64 }
65 bool operator!=(const PhysicalScreen& other) const
66 {
67 return !(*this == other);
68 }
69};
70
72inline size_t qHash(const PhysicalScreen& screen, size_t seed = 0)
73{
74 return qHash(screen.name, seed);
75}
76
77} // namespace Phosphor::Screens
78
79// PhysicalScreen travels on the ScreenManager / IScreenProvider signals —
80// register it as a metatype so queued connections and QSignalSpy can carry it.
81Q_DECLARE_METATYPE(Phosphor::Screens::PhysicalScreen)
Definition IWindowTrackingService.h:26
size_t qHash(const PhysicalScreen &screen, size_t seed=0)
Hash on the connector name so PhysicalScreen can key a QHash/QSet.
Definition PhysicalScreen.h:72
A physical output as ScreenManager sees it — decoupled from QScreen.
Definition PhysicalScreen.h:37
bool operator==(const PhysicalScreen &other) const
Identity is the connector — see the class note.
Definition PhysicalScreen.h:61
bool isValid() const
A screen with no connector name is the null/absent value.
Definition PhysicalScreen.h:55
QRect geometry
Output geometry in the global desktop coordinate space.
Definition PhysicalScreen.h:47
bool operator!=(const PhysicalScreen &other) const
Definition PhysicalScreen.h:65
QString name
Connector name (e.g. "DP-3", "HDMI-A-1") — QScreen::name().
Definition PhysicalScreen.h:39
QString identifier
Stable EDID-aware identifier from ScreenIdentity (e.g.
Definition PhysicalScreen.h:44