Changeset View
Changeset View
Standalone View
Standalone View
abstract_output.cpp
Show All 16 Lines | |||||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "abstract_output.h" | 20 | #include "abstract_output.h" | ||
21 | #include "wayland_server.h" | 21 | #include "wayland_server.h" | ||
22 | 22 | | |||
23 | // KWayland | 23 | // KWayland | ||
24 | #include <KWayland/Server/display.h> | 24 | #include <KWayland/Server/display.h> | ||
25 | #include <KWayland/Server/output_interface.h> | | |||
26 | #include <KWayland/Server/outputchangeset.h> | 25 | #include <KWayland/Server/outputchangeset.h> | ||
27 | #include <KWayland/Server/xdgoutput_interface.h> | 26 | #include <KWayland/Server/xdgoutput_interface.h> | ||
28 | // KF5 | 27 | // KF5 | ||
29 | #include <KLocalizedString> | 28 | #include <KLocalizedString> | ||
30 | 29 | | |||
31 | #include <cmath> | 30 | #include <cmath> | ||
32 | 31 | | |||
33 | namespace KWin | 32 | namespace KWin | ||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Line(s) | 161 | { | |||
164 | 163 | | |||
165 | if (!m_waylandOutput.isNull()) { | 164 | if (!m_waylandOutput.isNull()) { | ||
166 | delete m_waylandOutput.data(); | 165 | delete m_waylandOutput.data(); | ||
167 | m_waylandOutput.clear(); | 166 | m_waylandOutput.clear(); | ||
168 | } | 167 | } | ||
169 | m_waylandOutput = waylandServer()->display()->createOutput(); | 168 | m_waylandOutput = waylandServer()->display()->createOutput(); | ||
170 | createXdgOutput(); | 169 | createXdgOutput(); | ||
171 | 170 | | |||
171 | /* | ||||
172 | * add base wayland output data | ||||
173 | */ | ||||
172 | m_waylandOutput->setManufacturer(m_waylandOutputDevice->manufacturer()); | 174 | m_waylandOutput->setManufacturer(m_waylandOutputDevice->manufacturer()); | ||
173 | m_waylandOutput->setModel(m_waylandOutputDevice->model()); | 175 | m_waylandOutput->setModel(m_waylandOutputDevice->model()); | ||
174 | m_waylandOutput->setPhysicalSize(rawPhysicalSize()); | 176 | m_waylandOutput->setPhysicalSize(rawPhysicalSize()); | ||
175 | 177 | | |||
178 | /* | ||||
179 | * add modes | ||||
180 | */ | ||||
176 | for(const auto &mode: m_waylandOutputDevice->modes()) { | 181 | for(const auto &mode: m_waylandOutputDevice->modes()) { | ||
177 | KWayland::Server::OutputInterface::ModeFlags flags; | 182 | KWayland::Server::OutputInterface::ModeFlags flags; | ||
178 | if (mode.flags & KWayland::Server::OutputDeviceInterface::ModeFlag::Current) { | 183 | if (mode.flags & KWayland::Server::OutputDeviceInterface::ModeFlag::Current) { | ||
179 | flags |= KWayland::Server::OutputInterface::ModeFlag::Current; | 184 | flags |= KWayland::Server::OutputInterface::ModeFlag::Current; | ||
180 | } | 185 | } | ||
181 | if (mode.flags & KWayland::Server::OutputDeviceInterface::ModeFlag::Preferred) { | 186 | if (mode.flags & KWayland::Server::OutputDeviceInterface::ModeFlag::Preferred) { | ||
182 | flags |= KWayland::Server::OutputInterface::ModeFlag::Preferred; | 187 | flags |= KWayland::Server::OutputInterface::ModeFlag::Preferred; | ||
183 | } | 188 | } | ||
184 | m_waylandOutput->addMode(mode.size, flags, mode.refreshRate); | 189 | m_waylandOutput->addMode(mode.size, flags, mode.refreshRate); | ||
185 | } | 190 | } | ||
186 | m_waylandOutput->create(); | 191 | m_waylandOutput->create(); | ||
192 | | ||||
193 | /* | ||||
194 | * set dpms | ||||
195 | */ | ||||
196 | m_waylandOutput->setDpmsSupported(m_supportsDpms); | ||||
davidedmundson: This should be a virtual into the platform. | |||||
romangg: Good catch! I opted for a simple variable for now. | |||||
That isn't going to work, at some point you move initWaylandOutput into being done AbstractOutput::setEnabled. Also the patch seems messed up you set the mode twice? davidedmundson: That isn't going to work, at some point you move initWaylandOutput into being done… | |||||
romangg: Hmm, true.
Where do I set the mode a second time? | |||||
davidedmundson: You don't, ignore that last bit | |||||
197 | // set to last known mode | ||||
198 | m_waylandOutput->setDpmsMode(m_dpms); | ||||
199 | connect(m_waylandOutput.data(), &KWayland::Server::OutputInterface::dpmsModeRequested, this, | ||||
200 | [this] (KWayland::Server::OutputInterface::DpmsMode mode) { | ||||
201 | updateDpms(mode); | ||||
202 | }, Qt::QueuedConnection | ||||
203 | ); | ||||
187 | } | 204 | } | ||
188 | 205 | | |||
189 | } | 206 | } |
This should be a virtual into the platform.