Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/hwcomposer/hwcomposer_backend.cpp
Show All 21 Lines | |||||
22 | #include "logging.h" | 22 | #include "logging.h" | ||
23 | #include "screens_hwcomposer.h" | 23 | #include "screens_hwcomposer.h" | ||
24 | #include "composite.h" | 24 | #include "composite.h" | ||
25 | #include "input.h" | 25 | #include "input.h" | ||
26 | #include "main.h" | 26 | #include "main.h" | ||
27 | #include "wayland_server.h" | 27 | #include "wayland_server.h" | ||
28 | // KWayland | 28 | // KWayland | ||
29 | #include <KWayland/Server/output_interface.h> | 29 | #include <KWayland/Server/output_interface.h> | ||
30 | // KDE | ||||
31 | #include <KConfigGroup> | ||||
30 | // Qt | 32 | // Qt | ||
31 | #include <QKeyEvent> | 33 | #include <QKeyEvent> | ||
32 | #include <QDBusConnection> | 34 | #include <QDBusConnection> | ||
33 | // hybris/android | 35 | // hybris/android | ||
34 | #include <hardware/hardware.h> | 36 | #include <hardware/hardware.h> | ||
35 | #include <hardware/lights.h> | 37 | #include <hardware/lights.h> | ||
36 | // linux | 38 | // linux | ||
37 | #include <linux/input.h> | 39 | #include <linux/input.h> | ||
▲ Show 20 Lines • Show All 210 Lines • ▼ Show 20 Line(s) | 239 | connect(m_output.data(), &HwcomposerOutput::dpmsModeRequested, this, | |||
248 | } | 250 | } | ||
249 | ); | 251 | ); | ||
250 | } | 252 | } | ||
251 | 253 | | |||
252 | emit screensQueried(); | 254 | emit screensQueried(); | ||
253 | setReady(true); | 255 | setReady(true); | ||
254 | } | 256 | } | ||
255 | 257 | | |||
256 | QSize HwcomposerBackend::screenSize() const | 258 | QSize HwcomposerBackend::size() const | ||
257 | { | 259 | { | ||
258 | if (m_output) { | 260 | if (m_output) { | ||
259 | return m_output->pixelSize(); | 261 | return m_output->pixelSize(); | ||
260 | } | 262 | } | ||
261 | return QSize(); | 263 | return QSize(); | ||
262 | } | 264 | } | ||
263 | 265 | | |||
266 | QSize HwcomposerBackend::screenSize() const | ||||
267 | { | ||||
268 | if (m_output) { | ||||
269 | return m_output->pixelSize() / m_output->scale(); | ||||
270 | } | ||||
271 | return QSize(); | ||||
272 | } | ||||
273 | | ||||
274 | int HwcomposerBackend::scale() const | ||||
275 | { | ||||
276 | if (m_output) { | ||||
277 | return m_output->scale(); | ||||
278 | } | ||||
279 | return 1; | ||||
280 | } | ||||
281 | | ||||
264 | void HwcomposerBackend::initLights() | 282 | void HwcomposerBackend::initLights() | ||
265 | { | 283 | { | ||
266 | hw_module_t *lightsModule = nullptr; | 284 | hw_module_t *lightsModule = nullptr; | ||
267 | if (hw_get_module(LIGHTS_HARDWARE_MODULE_ID, (const hw_module_t **)&lightsModule) != 0) { | 285 | if (hw_get_module(LIGHTS_HARDWARE_MODULE_ID, (const hw_module_t **)&lightsModule) != 0) { | ||
268 | qCWarning(KWIN_HWCOMPOSER) << "Failed to get lights module"; | 286 | qCWarning(KWIN_HWCOMPOSER) << "Failed to get lights module"; | ||
269 | return; | 287 | return; | ||
270 | } | 288 | } | ||
271 | light_device_t *lightsDevice = nullptr; | 289 | light_device_t *lightsDevice = nullptr; | ||
▲ Show 20 Lines • Show All 233 Lines • ▼ Show 20 Line(s) | 487 | { | |||
505 | mode.size = pixel; | 523 | mode.size = pixel; | ||
506 | mode.flags = OutputDeviceInterface::ModeFlag::Current | OutputDeviceInterface::ModeFlag::Preferred; | 524 | mode.flags = OutputDeviceInterface::ModeFlag::Current | OutputDeviceInterface::ModeFlag::Preferred; | ||
507 | mode.refreshRate = (attr_values[4] == 0) ? 60000 : 10E11/attr_values[4]; | 525 | mode.refreshRate = (attr_values[4] == 0) ? 60000 : 10E11/attr_values[4]; | ||
508 | 526 | | |||
509 | initWaylandOutputDevice(QString(), QString(), QByteArray(), {mode}); | 527 | initWaylandOutputDevice(QString(), QString(), QByteArray(), {mode}); | ||
510 | setInternal(true); | 528 | setInternal(true); | ||
511 | setEnabled(true); | 529 | setEnabled(true); | ||
512 | setDpmsSupported(true); | 530 | setDpmsSupported(true); | ||
531 | | ||||
532 | const auto outputGroup = kwinApp()->config()->group("HWComposerOutputs").group("0"); | ||||
zzag: Please make it const. | |||||
We have for the Wayland and X11 nested backends a --scale option to define the scaling value when kwin gets started. Please use this instead of new env var. romangg: We have for the Wayland and X11 nested backends a `--scale` option to define the scaling value… | |||||
533 | setScale(outputGroup.readEntry("Scale", 1)); | ||||
513 | setWaylandMode(m_pixelSize, mode.refreshRate); | 534 | setWaylandMode(m_pixelSize, mode.refreshRate); | ||
zzag: Should it be setScale(scale)? | |||||
514 | } | 535 | } | ||
515 | 536 | | |||
516 | HwcomposerOutput::~HwcomposerOutput() | 537 | HwcomposerOutput::~HwcomposerOutput() | ||
517 | { | 538 | { | ||
518 | hwc_close_1(m_device); | 539 | hwc_close_1(m_device); | ||
519 | } | 540 | } | ||
520 | 541 | | |||
521 | QSize HwcomposerOutput::pixelSize() const | 542 | QSize HwcomposerOutput::pixelSize() const | ||
Show All 15 Lines |
Please make it const.