Changeset View
Changeset View
Standalone View
Standalone View
backends/kwayland/plugins/kwayland/kwayland_output.h
- This file was added.
1 | /************************************************************************* | ||||
---|---|---|---|---|---|
2 | Copyright © 2014-2015 Sebastian Kügler <sebas@kde.org> | ||||
3 | Copyright © 2019-2020 Roman Gilg <subdiff@gmail.com> | ||||
4 | | ||||
5 | This library is free software; you can redistribute it and/or | ||||
6 | modify it under the terms of the GNU Lesser General Public | ||||
7 | License as published by the Free Software Foundation; either | ||||
8 | version 2.1 of the License, or (at your option) any later version. | ||||
9 | | ||||
10 | This library is distributed in the hope that it will be useful, | ||||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
13 | Lesser General Public License for more details. | ||||
14 | | ||||
15 | You should have received a copy of the GNU Lesser General Public | ||||
16 | License along with this library; if not, write to the Free Software | ||||
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||||
18 | **************************************************************************/ | ||||
19 | #pragma once | ||||
20 | | ||||
21 | #include "waylandoutput.h" | ||||
22 | | ||||
23 | #include "output.h" | ||||
24 | | ||||
25 | #include <KWayland/Client/outputdevice.h> | ||||
26 | #include <KWayland/Client/registry.h> | ||||
27 | | ||||
28 | #include <QLoggingCategory> | ||||
29 | #include <QScreen> | ||||
30 | #include <QSize> | ||||
31 | | ||||
32 | namespace KWayland | ||||
33 | { | ||||
34 | namespace Client | ||||
35 | { | ||||
36 | class OutputConfiguration; | ||||
37 | } | ||||
38 | } | ||||
39 | | ||||
40 | namespace KScreen | ||||
41 | { | ||||
42 | | ||||
43 | class KWaylandOutput : public WaylandOutput | ||||
44 | { | ||||
45 | Q_OBJECT | ||||
46 | | ||||
47 | public: | ||||
48 | explicit KWaylandOutput(quint32 id, QObject *parent = nullptr); | ||||
49 | ~KWaylandOutput() override = default; | ||||
50 | | ||||
51 | void updateKScreenOutput(KScreen::OutputPtr &output) override; | ||||
52 | | ||||
53 | QString name() const; | ||||
54 | QByteArray edid() const override; | ||||
55 | bool enabled() const override; | ||||
56 | QRectF geometry() const override; | ||||
57 | | ||||
58 | KWayland::Client::OutputDevice* outputDevice() const; | ||||
59 | void createOutputDevice(KWayland::Client::Registry *registry, quint32 name, quint32 version); | ||||
60 | | ||||
61 | bool setWlConfig(KWayland::Client::OutputConfiguration *wlConfig, | ||||
62 | const KScreen::OutputPtr &output); | ||||
63 | | ||||
64 | private: | ||||
65 | void showOutput(); | ||||
66 | QString modeName(const KWayland::Client::OutputDevice::Mode &m) const; | ||||
67 | | ||||
68 | KWayland::Client::OutputDevice *m_device; | ||||
69 | KWayland::Client::Registry *m_registry; | ||||
70 | | ||||
71 | // left-hand-side: KScreen::Mode, right-hand-side: KWayland's mode.id | ||||
72 | QMap<QString, int> m_modeIdMap; | ||||
73 | }; | ||||
74 | | ||||
75 | } |