Changeset View
Changeset View
Standalone View
Standalone View
backends/kwayland/waylandoutput.h
Show All 31 Lines | |||||
32 | namespace KScreen | 32 | namespace KScreen | ||
33 | { | 33 | { | ||
34 | 34 | | |||
35 | class WaylandOutput : public QObject | 35 | class WaylandOutput : public QObject | ||
36 | { | 36 | { | ||
37 | Q_OBJECT | 37 | Q_OBJECT | ||
38 | 38 | | |||
39 | public: | 39 | public: | ||
40 | explicit WaylandOutput(quint32 id, WaylandConfig *parent = nullptr); | ||||
40 | ~WaylandOutput() override = default; | 41 | ~WaylandOutput() override = default; | ||
41 | 42 | | |||
42 | KScreen::OutputPtr toKScreenOutput(); | 43 | KScreen::OutputPtr toKScreenOutput(); | ||
43 | void updateKScreenOutput(KScreen::OutputPtr &output); | 44 | void updateKScreenOutput(KScreen::OutputPtr &output); | ||
44 | 45 | | |||
45 | quint32 id() const; | 46 | quint32 id() const; | ||
46 | QString name() const; | 47 | QString name() const; | ||
47 | bool enabled() const; | 48 | bool enabled() const; | ||
48 | 49 | | |||
49 | KWayland::Client::OutputDevice* outputDevice() const; | 50 | KWayland::Client::OutputDevice* outputDevice() const; | ||
51 | void createOutputDevice(KWayland::Client::Registry *registry, quint32 name, quint32 version); | ||||
50 | 52 | | |||
51 | // translation methods | 53 | // translation methods | ||
52 | KScreen::Output::Rotation toKScreenRotation( | 54 | KScreen::Output::Rotation toKScreenRotation( | ||
53 | const KWayland::Client::OutputDevice::Transform transform) const; | 55 | const KWayland::Client::OutputDevice::Transform transform) const; | ||
54 | KWayland::Client::OutputDevice::Transform toKWaylandTransform( | 56 | KWayland::Client::OutputDevice::Transform toKWaylandTransform( | ||
55 | const KScreen::Output::Rotation rotation) const; | 57 | const KScreen::Output::Rotation rotation) const; | ||
56 | 58 | | |||
57 | QString toKScreenModeId(int kwaylandmodeid) const; | 59 | QString toKScreenModeId(int kwaylandmodeid) const; | ||
58 | int toKWaylandModeId(const QString &kscreenmodeid) const; | 60 | int toKWaylandModeId(const QString &kscreenmodeid) const; | ||
59 | 61 | | |||
60 | Q_SIGNALS: | 62 | Q_SIGNALS: | ||
61 | void complete(); | | |||
62 | void deviceRemoved(); | 63 | void deviceRemoved(); | ||
63 | 64 | | |||
64 | // only emitted after complete() | 65 | void complete(); | ||
66 | // only emitted after complete signal | ||||
65 | void changed(); | 67 | void changed(); | ||
66 | 68 | | |||
67 | private: | 69 | private: | ||
68 | friend WaylandConfig; | | |||
69 | explicit WaylandOutput(quint32 id, WaylandConfig *parent = nullptr); | | |||
70 | | ||||
71 | void createOutputDevice(KWayland::Client::Registry *registry, quint32 name, quint32 version); | | |||
72 | void showOutput(); | 70 | void showOutput(); | ||
73 | QString modeName(const KWayland::Client::OutputDevice::Mode &m) const; | 71 | QString modeName(const KWayland::Client::OutputDevice::Mode &m) const; | ||
74 | 72 | | |||
75 | quint32 m_id; | 73 | quint32 m_id; | ||
76 | KWayland::Client::OutputDevice *m_output; | 74 | KWayland::Client::OutputDevice *m_output; | ||
77 | KWayland::Client::Registry *m_registry; | 75 | KWayland::Client::Registry *m_registry; | ||
78 | 76 | | |||
79 | // left-hand-side: KScreen::Mode, right-hand-side: KWayland's mode.id | 77 | // left-hand-side: KScreen::Mode, right-hand-side: KWayland's mode.id | ||
80 | QMap<QString, int> m_modeIdMap; | 78 | QMap<QString, int> m_modeIdMap; | ||
81 | }; | 79 | }; | ||
82 | 80 | | |||
83 | } | 81 | } | ||
84 | 82 | | |||
85 | KSCREEN_EXPORT QDebug operator<<(QDebug dbg, const KScreen::WaylandOutput *output); | 83 | KSCREEN_EXPORT QDebug operator<<(QDebug dbg, const KScreen::WaylandOutput *output); |