Warning, file /plasma/libkscreen/src/libdpms/dpms.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // SPDX-FileCopyrightText: 2022 Aleix Pol Gonzalez <aleixpol@kde.org 0002 // 0003 // SPDX-License-Identifier: LGPL-2.1-or-later 0004 0005 #include "dpms.h" 0006 #include "kscreendpms_debug.h" 0007 #include "waylanddpmshelper_p.h" 0008 #include "xcbdpmshelper_p.h" 0009 0010 #include <QGuiApplication> 0011 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) 0012 #include <private/qtx11extras_p.h> 0013 #else 0014 #include <QX11Info> 0015 #endif 0016 0017 KScreen::Dpms::Dpms(QObject *parent) 0018 : QObject(parent) 0019 { 0020 if (QX11Info::isPlatformX11()) { 0021 m_helper.reset(new XcbDpmsHelper); 0022 } else if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { 0023 m_helper.reset(new WaylandDpmsHelper); 0024 } else { 0025 qCWarning(KSCREEN_DPMS) << "dpms unsupported on this system"; 0026 return; 0027 } 0028 0029 connect(m_helper.data(), &AbstractDpmsHelper::supportedChanged, this, &Dpms::supportedChanged); 0030 connect(m_helper.data(), &AbstractDpmsHelper::modeChanged, this, &Dpms::modeChanged); 0031 connect(m_helper.data(), &AbstractDpmsHelper::hasPendingChangesChanged, this, &Dpms::hasPendingChangesChanged); 0032 } 0033 0034 KScreen::Dpms::~Dpms() 0035 { 0036 } 0037 0038 void KScreen::Dpms::switchMode(KScreen::Dpms::Mode mode, const QList<QScreen *> &screens) 0039 { 0040 m_helper->trigger(mode, screens.isEmpty() ? qGuiApp->screens() : screens); 0041 } 0042 0043 bool KScreen::Dpms::isSupported() const 0044 { 0045 return m_helper->isSupported(); 0046 } 0047 0048 bool KScreen::Dpms::hasPendingChanges() const 0049 { 0050 return m_helper->hasPendingChanges(); 0051 }