Debian

Available patches from Ubuntu

To see Ubuntu differences wrt. to Debian, write down a grep-dctrl query identifying the packages you're interested in:
grep-dctrl -n -sPackage Sources.Debian
(e.g. -FPackage linux-ntfs or linux-ntfs)

Modified packages are listed below:

Debian ( Changelog | PTS | Bugs ) Ubuntu ( Changelog | txt | LP | Bugs ) | Diff from Ubuntu

Source: libkscreen

libkscreen (4:5.20.90-0ubuntu1) hirsute; urgency=medium * New upstream (beta) release (5.20.90) * Disable Make-kwayland-optional.patch which is not for Ubuntu architectures. -- Rik Mills <rikmills@kde.org> Thu, 21 Jan 2021 23:45:12 +0000 libkscreen (4:5.20.5-1ubuntu1) hirsute; urgency=medium * Merge from debian unstable. Remaining changes: - Kubuntu Vcs fields. - Disable tests. - libkf5screen-bin: Breaks/Replaces libkf5screen7 (<< 4:5.20.4-2~) -- Rik Mills <rikmills@kde.org> Thu, 14 Jan 2021 18:11:16 +0000

Modifications :
  1. Download patch backends/fake/fake.cpp

    --- 4:5.20.5-1/backends/fake/fake.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/fake/fake.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -28,9 +28,9 @@ #include <QFile> #include <QTimer> +#include <QJsonArray> #include <QJsonDocument> #include <QJsonObject> -#include <QJsonArray> #include <QDBusConnection> @@ -45,7 +45,6 @@ Fake::Fake() { QLoggingCategory::setFilterRules(QStringLiteral("kscreen.fake.debug = true")); - if (qgetenv("KSCREEN_BACKEND_INPROCESS") != QByteArray("1")) { QTimer::singleShot(0, this, &Fake::delayedInit); } @@ -59,7 +58,6 @@ void Fake::init(const QVariantMap &argum mConfigFile = arguments[QStringLiteral("TEST_DATA")].toString(); qCDebug(KSCREEN_FAKE) << "Fake profile file:" << mConfigFile; - } void Fake::delayedInit() @@ -113,7 +111,7 @@ QByteArray Fake::edid(int outputId) cons const QJsonObject json = jsonDoc.object(); const QJsonArray outputs = json[QStringLiteral("outputs")].toArray(); - Q_FOREACH(const QJsonValue &value, outputs) { + Q_FOREACH (const QJsonValue &value, outputs) { const QVariantMap output = value.toObject().toVariantMap(); if (output[QStringLiteral("id")].toInt() != outputId) { continue;
  2. Download patch src/configoperation_p.h

    --- 4:5.20.5-1/src/configoperation_p.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/configoperation_p.h 2021-01-21 12:52:36.000000000 +0000 @@ -17,15 +17,17 @@ * */ +#ifndef CONFIGOPERATIONPRIVATE_H +#define CONFIGOPERATIONPRIVATE_H + #include <QObject> -#include "configoperation.h" #include "abstractbackend.h" #include "backendinterface.h" +#include "configoperation.h" namespace KScreen { - class ConfigOperationPrivate : public QObject { Q_OBJECT @@ -39,7 +41,7 @@ public: virtual void backendReady(org::kde::kscreen::Backend *backend); // For in-process - KScreen::AbstractBackend* loadBackend(); + KScreen::AbstractBackend *loadBackend(); public Q_SLOTS: void doEmitResult(); @@ -49,9 +51,9 @@ private: bool isExec; protected: - ConfigOperation * const q_ptr; + ConfigOperation *const q_ptr; Q_DECLARE_PUBLIC(ConfigOperation) - }; } +#endif
  3. Download patch src/configoperation.cpp

    --- 4:5.20.5-1/src/configoperation.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/configoperation.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -19,14 +19,14 @@ */ #include "configoperation.h" -#include "configoperation_p.h" #include "backendmanager_p.h" +#include "configoperation_p.h" #include "kscreen_debug.h" using namespace KScreen; -ConfigOperationPrivate::ConfigOperationPrivate(ConfigOperation* qq) +ConfigOperationPrivate::ConfigOperationPrivate(ConfigOperation *qq) : QObject() , isExec(false) , q_ptr(qq) @@ -40,8 +40,7 @@ ConfigOperationPrivate::~ConfigOperation void ConfigOperationPrivate::requestBackend() { Q_ASSERT(BackendManager::instance()->method() == BackendManager::OutOfProcess); - connect(BackendManager::instance(), &BackendManager::backendReady, - this, &ConfigOperationPrivate::backendReady); + connect(BackendManager::instance(), &BackendManager::backendReady, this, &ConfigOperationPrivate::backendReady); BackendManager::instance()->requestBackend(); } @@ -50,8 +49,7 @@ void ConfigOperationPrivate::backendRead Q_ASSERT(BackendManager::instance()->method() == BackendManager::OutOfProcess); Q_UNUSED(backend); - disconnect(BackendManager::instance(), &BackendManager::backendReady, - this, &ConfigOperationPrivate::backendReady); + disconnect(BackendManager::instance(), &BackendManager::backendReady, this, &ConfigOperationPrivate::backendReady); } void ConfigOperationPrivate::doEmitResult() @@ -71,7 +69,7 @@ void ConfigOperationPrivate::doEmitResul } } -ConfigOperation::ConfigOperation(ConfigOperationPrivate* dd, QObject* parent) +ConfigOperation::ConfigOperation(ConfigOperationPrivate *dd, QObject *parent) : QObject(parent) , d_ptr(dd) { @@ -97,7 +95,7 @@ QString ConfigOperation::errorString() c return d->error; } -void ConfigOperation::setError(const QString& error) +void ConfigOperation::setError(const QString &error) { Q_D(ConfigOperation); d->error = error; @@ -116,11 +114,10 @@ bool ConfigOperation::exec() Q_D(ConfigOperation); QEventLoop loop; - connect(this, &ConfigOperation::finished, this, - [&](ConfigOperation *op) { - Q_UNUSED(op); - loop.quit(); - }); + connect(this, &ConfigOperation::finished, this, [&](ConfigOperation *op) { + Q_UNUSED(op); + loop.quit(); + }); d->isExec = true; loop.exec(QEventLoop::ExcludeUserInputEvents); @@ -130,7 +127,7 @@ bool ConfigOperation::exec() return !hasError(); } -KScreen::AbstractBackend* ConfigOperationPrivate::loadBackend() +KScreen::AbstractBackend *ConfigOperationPrivate::loadBackend() { Q_ASSERT(BackendManager::instance()->method() == BackendManager::InProcess); Q_Q(ConfigOperation);
  4. Download patch src/output.cpp
  5. Download patch tests/kwayland/waylandtestserver.cpp

    --- 4:5.20.5-1/tests/kwayland/waylandtestserver.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/tests/kwayland/waylandtestserver.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -20,10 +20,10 @@ #include "waylandconfigreader.h" +#include <QFile> #include <QJsonArray> #include <QJsonDocument> #include <QJsonObject> -#include <QFile> #include <QLoggingCategory> #include <QStandardPaths> @@ -73,7 +73,7 @@ void WaylandTestServer::start() KScreen::WaylandConfigReader::outputsFromConfig(m_configFile, m_display, m_outputs); qCDebug(KSCREEN_WAYLAND_TESTSERVER) << QStringLiteral("export WAYLAND_DISPLAY=") + m_display->socketName(); qCDebug(KSCREEN_WAYLAND_TESTSERVER) << QStringLiteral("You can specify the WAYLAND_DISPLAY for this server by exporting it in the environment"); - //showOutputs(); + // showOutputs(); } void WaylandTestServer::stop() @@ -87,12 +87,12 @@ void WaylandTestServer::stop() m_display = nullptr; } -KWayland::Server::Display* WaylandTestServer::display() +KWayland::Server::Display *WaylandTestServer::display() { return m_display; } -void WaylandTestServer::setConfig(const QString& configfile) +void WaylandTestServer::setConfig(const QString &configfile) { qCDebug(KSCREEN_WAYLAND_TESTSERVER) << "Creating Wayland server from " << configfile; m_configFile = configfile; @@ -102,7 +102,7 @@ int WaylandTestServer::outputCount() con { return m_outputs.count(); } -QList<KWayland::Server::OutputDeviceInterface*> WaylandTestServer::outputs() const +QList<KWayland::Server::OutputDeviceInterface *> WaylandTestServer::outputs() const { return m_outputs; } @@ -120,7 +120,7 @@ void WaylandTestServer::suspendChanges(b } } -void WaylandTestServer::configurationChangeRequested(KWayland::Server::OutputConfigurationInterface* configurationInterface) +void WaylandTestServer::configurationChangeRequested(KWayland::Server::OutputConfigurationInterface *configurationInterface) { qCDebug(KSCREEN_WAYLAND_TESTSERVER) << "Server received change request, changes:" << configurationInterface->changes().count(); Q_EMIT configReceived(); @@ -158,7 +158,7 @@ void WaylandTestServer::configurationCha } configurationInterface->setApplied(); - //showOutputs(); + // showOutputs(); Q_EMIT configChanged(); } @@ -174,12 +174,11 @@ void WaylandTestServer::showOutputs() qCDebug(KSCREEN_WAYLAND_TESTSERVER) << " Pos: " << o->globalPosition(); qCDebug(KSCREEN_WAYLAND_TESTSERVER) << " Edid: " << o->edid(); // << o->currentMode().size(); - } qCDebug(KSCREEN_WAYLAND_TESTSERVER) << "******************************************************"; } -QString WaylandTestServer::modeString(KWayland::Server::OutputDeviceInterface* outputdevice, int mid) +QString WaylandTestServer::modeString(KWayland::Server::OutputDeviceInterface *outputdevice, int mid) { QString s; QString ids; @@ -192,10 +191,8 @@ QString WaylandTestServer::modeString(KW ids.append(QLatin1Char('.')); } if (_m.id == mid) { - s = QStringLiteral("%1x%2 @%3").arg(QString::number(_m.size.width()), \ - QString::number(_m.size.height()), QString::number(_m.refreshRate)); + s = QStringLiteral("%1x%2 @%3").arg(QString::number(_m.size.width()), QString::number(_m.size.height()), QString::number(_m.refreshRate)); } } return QStringLiteral("[%1] %2 (%4 modes: %3)").arg(QString::number(mid), s, ids, QString::number(outputdevice->modes().count())); - }
  6. Download patch backends/xrandr/xrandrcrtc.h

    --- 4:5.20.5-1/backends/xrandr/xrandrcrtc.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/xrandr/xrandrcrtc.h 2021-01-21 12:52:36.000000000 +0000 @@ -34,8 +34,7 @@ class XRandRCrtc : public QObject Q_OBJECT public: - typedef QMap<xcb_randr_crtc_t, XRandRCrtc*> Map; - + typedef QMap<xcb_randr_crtc_t, XRandRCrtc *> Map; XRandRCrtc(xcb_randr_crtc_t crtc, XRandRConfig *config);
  7. Download patch backends/utils.cpp

    --- 4:5.20.5-1/backends/utils.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/utils.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -22,11 +22,7 @@ KScreen::Output::Type Utils::guessOutputType(const QString &type, const QString &name) { - static const auto embedded = { QLatin1String("LVDS"), - QLatin1String("IDP"), - QLatin1String("EDP"), - QLatin1String("LCD"), - QLatin1String("DSI") }; + static const auto embedded = {QLatin1String("LVDS"), QLatin1String("IDP"), QLatin1String("EDP"), QLatin1String("LCD"), QLatin1String("DSI")}; for (const QLatin1String &pre : embedded) { if (name.startsWith(pre, Qt::CaseInsensitive)) { @@ -68,4 +64,3 @@ KScreen::Output::Type Utils::guessOutput return KScreen::Output::Unknown; } } -
  8. Download patch backends/kwayland/waylandconfig.cpp
  9. Download patch src/backendmanager_p.h

    --- 4:5.20.5-1/src/backendmanager_p.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/backendmanager_p.h 2021-01-21 12:52:36.000000000 +0000 @@ -27,22 +27,22 @@ #ifndef KSCREEN_BACKENDMANAGER_H #define KSCREEN_BACKENDMANAGER_H +#include <QDBusServiceWatcher> +#include <QEventLoop> +#include <QFileInfoList> #include <QObject> #include <QPluginLoader> #include <QProcess> -#include <QDBusServiceWatcher> -#include <QFileInfoList> #include <QTimer> -#include <QEventLoop> -#include "types.h" #include "kscreen_export.h" +#include "types.h" class QDBusPendingCallWatcher; class OrgKdeKscreenBackendInterface; -namespace KScreen { - +namespace KScreen +{ class AbstractBackend; class KSCREEN_EXPORT BackendManager : public QObject @@ -52,7 +52,7 @@ class KSCREEN_EXPORT BackendManager : pu public: enum Method { InProcess, - OutOfProcess + OutOfProcess, }; static BackendManager *instance(); @@ -93,9 +93,7 @@ public: * @return a pointer to the backend loaded from the plugin * @since 5.6 */ - static KScreen::AbstractBackend *loadBackendPlugin(QPluginLoader *loader, - const QString &name, - const QVariantMap &arguments); + static KScreen::AbstractBackend *loadBackendPlugin(QPluginLoader *loader, const QString &name, const QVariantMap &arguments); KScreen::AbstractBackend *loadBackendInProcess(const QString &name); @@ -112,8 +110,7 @@ Q_SIGNALS: private Q_SLOTS: void emitBackendReady(); - void startBackend(const QString &backend = QString(), - const QVariantMap &arguments = QVariantMap()); + void startBackend(const QString &backend = QString(), const QVariantMap &arguments = QVariantMap()); void onBackendRequestDone(QDBusPendingCallWatcher *watcher); void backendServiceUnregistered(const QString &serviceName); @@ -147,7 +144,7 @@ private: // For in-process operation QPluginLoader *mLoader; - QPair<KScreen::AbstractBackend*, QVariantMap> m_inProcessBackend; + QPair<KScreen::AbstractBackend *, QVariantMap> m_inProcessBackend; Method mMethod; };
  10. Download patch src/backendmanager.cpp
  11. Download patch debian/tests/control

    --- 4:5.20.5-1/debian/tests/control 2020-03-23 02:22:07.000000000 +0000 +++ 4:5.20.90-0ubuntu1/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -Tests: acc -Depends: @, dh-acc, exuberant-ctags -Restrictions: allow-stderr
  12. Download patch backends/utils.h

    --- 4:5.20.5-1/backends/utils.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/utils.h 2021-01-21 12:52:36.000000000 +0000 @@ -21,8 +21,8 @@ #include "output.h" -namespace Utils { - +namespace Utils +{ KScreen::Output::Type guessOutputType(const QString &type, const QString &name); }
  13. Download patch backends/xcbeventlistener.cpp

    --- 4:5.20.5-1/backends/xcbeventlistener.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/xcbeventlistener.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -18,21 +18,21 @@ #include "xcbeventlistener.h" -#include <QX11Info> #include <QGuiApplication> +#include <QX11Info> #include <QRect> Q_LOGGING_CATEGORY(KSCREEN_XCB_HELPER, "kscreen.xcb.helper") -XCBEventListener::XCBEventListener(): - m_isRandrPresent(false), - m_randrBase(0), - m_randrErrorBase(0), - m_majorOpcode(0), - m_versionMajor(0), - m_versionMinor(0), - m_window(0) +XCBEventListener::XCBEventListener() + : m_isRandrPresent(false) + , m_randrBase(0) + , m_randrErrorBase(0) + , m_majorOpcode(0) + , m_versionMajor(0) + , m_versionMinor(0) + , m_window(0) { xcb_connection_t *c = QX11Info::connection(); xcb_prefetch_extension_data(c, &xcb_randr_id); @@ -64,21 +64,16 @@ XCBEventListener::XCBEventListener(): qCDebug(KSCREEN_XCB_HELPER).nospace() << "Detected XRandR " << m_versionMajor << "." << m_versionMinor; qCDebug(KSCREEN_XCB_HELPER) << "Event Base: " << m_randrBase; - qCDebug(KSCREEN_XCB_HELPER) << "Event Error: "<< m_randrErrorBase; + qCDebug(KSCREEN_XCB_HELPER) << "Event Error: " << m_randrErrorBase; uint32_t rWindow = QX11Info::appRootWindow(); m_window = xcb_generate_id(c); - xcb_create_window(c, XCB_COPY_FROM_PARENT, m_window, - rWindow, - 0, 0, 1, 1, 0, XCB_COPY_FROM_PARENT, - XCB_COPY_FROM_PARENT, 0, nullptr); - - xcb_randr_select_input(c, m_window, - XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE | - XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE | - XCB_RANDR_NOTIFY_MASK_CRTC_CHANGE | - XCB_RANDR_NOTIFY_MASK_OUTPUT_PROPERTY - ); + xcb_create_window(c, XCB_COPY_FROM_PARENT, m_window, rWindow, 0, 0, 1, 1, 0, XCB_COPY_FROM_PARENT, XCB_COPY_FROM_PARENT, 0, nullptr); + + xcb_randr_select_input(c, + m_window, + XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE | XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE | XCB_RANDR_NOTIFY_MASK_CRTC_CHANGE + | XCB_RANDR_NOTIFY_MASK_OUTPUT_PROPERTY); qApp->installNativeEventFilter(this); } @@ -124,7 +119,7 @@ QString XCBEventListener::connectionToSt return QStringLiteral("invalid value (%1)").arg(connection); } -bool XCBEventListener::nativeEventFilter(const QByteArray& eventType, void* message, long int* result) +bool XCBEventListener::nativeEventFilter(const QByteArray &eventType, void *message, long int *result) { Q_UNUSED(result); @@ -135,7 +130,7 @@ bool XCBEventListener::nativeEventFilter auto *e = static_cast<xcb_generic_event_t *>(message); const uint8_t xEventType = e->response_type & ~0x80; - //If this event is not xcb_randr_notify, we don't want it + // If this event is not xcb_randr_notify, we don't want it if (xEventType == m_randrBase + XCB_RANDR_SCREEN_CHANGE_NOTIFY) { handleScreenChange(e); } @@ -146,9 +141,9 @@ bool XCBEventListener::nativeEventFilter return false; } -void XCBEventListener::handleScreenChange(xcb_generic_event_t* e) +void XCBEventListener::handleScreenChange(xcb_generic_event_t *e) { - auto *e2 = reinterpret_cast<xcb_randr_screen_change_notify_event_t*>(e); + auto *e2 = reinterpret_cast<xcb_randr_screen_change_notify_event_t *>(e); // Only accept notifications for our window if (e2->request_window != m_window) { @@ -158,46 +153,44 @@ void XCBEventListener::handleScreenChang qCDebug(KSCREEN_XCB_HELPER) << "RRScreenChangeNotify"; qCDebug(KSCREEN_XCB_HELPER) << "\tWindow:" << e2->request_window; qCDebug(KSCREEN_XCB_HELPER) << "\tRoot:" << e2->root; - qCDebug(KSCREEN_XCB_HELPER) << "\tRotation: " << rotationToString((xcb_randr_rotation_t) e2->rotation); + qCDebug(KSCREEN_XCB_HELPER) << "\tRotation: " << rotationToString((xcb_randr_rotation_t)e2->rotation); qCDebug(KSCREEN_XCB_HELPER) << "\tSize ID:" << e2->sizeID; qCDebug(KSCREEN_XCB_HELPER) << "\tSize: " << e2->width << e2->height; qCDebug(KSCREEN_XCB_HELPER) << "\tSizeMM: " << e2->mwidth << e2->mheight; - Q_EMIT screenChanged((xcb_randr_rotation_t) e2->rotation, QSize(e2->width, e2->height), QSize(e2->mwidth, e2->mheight)); + Q_EMIT screenChanged((xcb_randr_rotation_t)e2->rotation, QSize(e2->width, e2->height), QSize(e2->mwidth, e2->mheight)); Q_EMIT outputsChanged(); } -void XCBEventListener::handleXRandRNotify(xcb_generic_event_t* e) +void XCBEventListener::handleXRandRNotify(xcb_generic_event_t *e) { - auto *randrEvent = reinterpret_cast<xcb_randr_notify_event_t*>(e); + auto *randrEvent = reinterpret_cast<xcb_randr_notify_event_t *>(e); if (randrEvent->subCode == XCB_RANDR_NOTIFY_CRTC_CHANGE) { xcb_randr_crtc_change_t crtc = randrEvent->u.cc; qCDebug(KSCREEN_XCB_HELPER) << "RRNotify_CrtcChange"; qCDebug(KSCREEN_XCB_HELPER) << "\tCRTC: " << crtc.crtc; qCDebug(KSCREEN_XCB_HELPER) << "\tMode: " << crtc.mode; - qCDebug(KSCREEN_XCB_HELPER) << "\tRotation: " << rotationToString((xcb_randr_rotation_t) crtc.rotation); + qCDebug(KSCREEN_XCB_HELPER) << "\tRotation: " << rotationToString((xcb_randr_rotation_t)crtc.rotation); qCDebug(KSCREEN_XCB_HELPER) << "\tGeometry: " << crtc.x << crtc.y << crtc.width << crtc.height; - Q_EMIT crtcChanged(crtc.crtc, crtc.mode, (xcb_randr_rotation_t) crtc.rotation, - QRect(crtc.x, crtc.y, crtc.width, crtc.height)); + Q_EMIT crtcChanged(crtc.crtc, crtc.mode, (xcb_randr_rotation_t)crtc.rotation, QRect(crtc.x, crtc.y, crtc.width, crtc.height)); - } else if(randrEvent->subCode == XCB_RANDR_NOTIFY_OUTPUT_CHANGE) { + } else if (randrEvent->subCode == XCB_RANDR_NOTIFY_OUTPUT_CHANGE) { xcb_randr_output_change_t output = randrEvent->u.oc; qCDebug(KSCREEN_XCB_HELPER) << "RRNotify_OutputChange"; qCDebug(KSCREEN_XCB_HELPER) << "\tOutput: " << output.output; qCDebug(KSCREEN_XCB_HELPER) << "\tCRTC: " << output.crtc; qCDebug(KSCREEN_XCB_HELPER) << "\tMode: " << output.mode; - qCDebug(KSCREEN_XCB_HELPER) << "\tRotation: " << rotationToString((xcb_randr_rotation_t) output.rotation); - qCDebug(KSCREEN_XCB_HELPER) << "\tConnection: " << connectionToString((xcb_randr_connection_t) output.connection); + qCDebug(KSCREEN_XCB_HELPER) << "\tRotation: " << rotationToString((xcb_randr_rotation_t)output.rotation); + qCDebug(KSCREEN_XCB_HELPER) << "\tConnection: " << connectionToString((xcb_randr_connection_t)output.connection); qCDebug(KSCREEN_XCB_HELPER) << "\tSubpixel Order: " << output.subpixel_order; - Q_EMIT outputChanged(output.output, output.crtc, output.mode, - (xcb_randr_connection_t) output.connection); + Q_EMIT outputChanged(output.output, output.crtc, output.mode, (xcb_randr_connection_t)output.connection); - } else if(randrEvent->subCode == XCB_RANDR_NOTIFY_OUTPUT_PROPERTY) { + } else if (randrEvent->subCode == XCB_RANDR_NOTIFY_OUTPUT_PROPERTY) { xcb_randr_output_property_t property = randrEvent->u.op; - XCB::ScopedPointer<xcb_get_atom_name_reply_t> reply(xcb_get_atom_name_reply(QX11Info::connection(), - xcb_get_atom_name(QX11Info::connection(), property.atom), nullptr)); + XCB::ScopedPointer<xcb_get_atom_name_reply_t> reply( + xcb_get_atom_name_reply(QX11Info::connection(), xcb_get_atom_name(QX11Info::connection(), property.atom), nullptr)); qCDebug(KSCREEN_XCB_HELPER) << "RRNotify_OutputProperty (ignored)"; qCDebug(KSCREEN_XCB_HELPER) << "\tOutput: " << property.output;
  14. Download patch backends/fake/parser.h

    --- 4:5.20.5-1/backends/fake/parser.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/fake/parser.h 2021-01-21 12:52:36.000000000 +0000 @@ -20,30 +20,30 @@ #define PARSER_H #include <QByteArray> +#include <QPoint> +#include <QRect> +#include <QSize> #include <QString> #include <QVariant> -#include <QSize> -#include <QRect> -#include <QPoint> #include "types.h" class Parser { - public: - static KScreen::ConfigPtr fromJson(const QByteArray &data); - static KScreen::ConfigPtr fromJson(const QString &path); - static bool validate(const QByteArray &data); - static bool validate(const QString &data); +public: + static KScreen::ConfigPtr fromJson(const QByteArray &data); + static KScreen::ConfigPtr fromJson(const QString &path); + static bool validate(const QByteArray &data); + static bool validate(const QString &data); - private: - static void qvariant2qobject(const QVariantMap& variant, QObject* object); - static KScreen::ScreenPtr screenFromJson(const QMap<QString, QVariant>& data); - static KScreen::OutputPtr outputFromJson(QMap<QString, QVariant> data /* sic */); - static KScreen::ModePtr modeFromJson(const QVariant& data); - static QSize sizeFromJson(const QVariant& data); - static QRect rectFromJson(const QVariant& data); - static QPoint pointFromJson(const QVariant& data); +private: + static void qvariant2qobject(const QVariantMap &variant, QObject *object); + static KScreen::ScreenPtr screenFromJson(const QMap<QString, QVariant> &data); + static KScreen::OutputPtr outputFromJson(QMap<QString, QVariant> data /* sic */); + static KScreen::ModePtr modeFromJson(const QVariant &data); + static QSize sizeFromJson(const QVariant &data); + static QRect rectFromJson(const QVariant &data); + static QPoint pointFromJson(const QVariant &data); }; -#endif //PARSER_H +#endif // PARSER_H
  15. Download patch autotests/testinprocess.cpp

    --- 4:5.20.5-1/autotests/testinprocess.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/autotests/testinprocess.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -17,19 +17,19 @@ *************************************************************************************/ #include <QCoreApplication> -#include <QtTest> +#include <QDBusConnectionInterface> #include <QObject> #include <QSignalSpy> -#include <QDBusConnectionInterface> +#include <QtTest> #include "../src/backendmanager_p.h" -#include "../src/getconfigoperation.h" -#include "../src/setconfigoperation.h" #include "../src/config.h" #include "../src/configmonitor.h" -#include "../src/output.h" -#include "../src/mode.h" #include "../src/edid.h" +#include "../src/getconfigoperation.h" +#include "../src/mode.h" +#include "../src/output.h" +#include "../src/setconfigoperation.h" Q_LOGGING_CATEGORY(KSCREEN, "kscreen") @@ -58,10 +58,8 @@ private Q_SLOTS: void testConfigMonitor(); private: - ConfigPtr m_config; bool m_backendServiceInstalled = false; - }; TestInProcess::TestInProcess(QObject *parent) @@ -196,7 +194,7 @@ void TestInProcess::testBackendCaching() QVERIFY(cc->outputs().count()); } { - //KScreen::BackendManager::instance()->shutdownBackend(); + // KScreen::BackendManager::instance()->shutdownBackend(); QCOMPARE(BackendManager::instance()->method(), BackendManager::InProcess); t.start(); auto cp = new GetConfigOperation(); @@ -220,7 +218,7 @@ void TestInProcess::testBackendCaching() KScreen::BackendManager::instance()->shutdownBackend(); if (m_backendServiceInstalled) { - //qputenv("KSCREEN_BACKEND", "QScreen"); + // qputenv("KSCREEN_BACKEND", "QScreen"); qputenv("KSCREEN_BACKEND_INPROCESS", "0"); BackendManager::instance()->setMethod(BackendManager::OutOfProcess); QCOMPARE(BackendManager::instance()->method(), BackendManager::OutOfProcess); @@ -262,7 +260,7 @@ void TestInProcess::testCreateJob() { BackendManager::instance()->setMethod(BackendManager::InProcess); auto op = new GetConfigOperation(); - auto _op = qobject_cast<GetConfigOperation*>(op); + auto _op = qobject_cast<GetConfigOperation *>(op); QVERIFY(_op != nullptr); QCOMPARE(BackendManager::instance()->method(), BackendManager::InProcess); QVERIFY(op->exec()); @@ -273,7 +271,7 @@ void TestInProcess::testCreateJob() if (m_backendServiceInstalled) { BackendManager::instance()->setMethod(BackendManager::OutOfProcess); auto op = new GetConfigOperation(); - auto _op = qobject_cast<GetConfigOperation*>(op); + auto _op = qobject_cast<GetConfigOperation *>(op); QVERIFY(_op != nullptr); QCOMPARE(BackendManager::instance()->method(), BackendManager::OutOfProcess); QVERIFY(op->exec()); @@ -293,12 +291,12 @@ void TestInProcess::testConfigApply() auto op = new GetConfigOperation(); op->exec(); auto config = op->config(); -// qDebug() << "op:" << config->outputs().count(); + // qDebug() << "op:" << config->outputs().count(); auto output = config->outputs().first(); -// qDebug() << "res:" << output->geometry(); -// qDebug() << "modes:" << output->modes(); + // qDebug() << "res:" << output->geometry(); + // qDebug() << "modes:" << output->modes(); auto m0 = output->modes().first(); - //qDebug() << "m0:" << m0->id() << m0; + // qDebug() << "m0:" << m0->id() << m0; output->setCurrentModeId(m0->id()); QVERIFY(Config::canBeApplied(config)); @@ -324,7 +322,7 @@ void TestInProcess::testConfigMonitor() // qDebug() << "res:" << output->geometry(); // qDebug() << "modes:" << output->modes(); auto m0 = output->modes().first(); - //qDebug() << "m0:" << m0->id() << m0; + // qDebug() << "m0:" << m0->id() << m0; output->setCurrentModeId(m0->id()); QVERIFY(Config::canBeApplied(config)); @@ -338,7 +336,6 @@ void TestInProcess::testConfigMonitor() QVERIFY(monitorSpy.wait(500)); } - QTEST_GUILESS_MAIN(TestInProcess) #include "testinprocess.moc"
  16. Download patch src/config.h

    --- 4:5.20.5-1/src/config.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/config.h 2021-01-21 12:52:36.000000000 +0000 @@ -20,17 +20,16 @@ #ifndef KSCREEN_CONFIG_H #define KSCREEN_CONFIG_H +#include "kscreen_export.h" #include "screen.h" #include "types.h" -#include "kscreen_export.h" #include <QHash> -#include <QObject> #include <QMetaType> +#include <QObject> - -namespace KScreen { - +namespace KScreen +{ /** * Represents a (or the) screen configuration. * @@ -49,10 +48,10 @@ class KSCREEN_EXPORT Config : public QOb Q_PROPERTY(ScreenPtr screen READ screen) Q_PROPERTY(OutputList outputs READ outputs) - public: +public: enum class ValidityFlag { None = 0x0, - RequireAtLeastOneEnabledScreen = 0x1 + RequireAtLeastOneEnabledScreen = 0x1, }; Q_DECLARE_FLAGS(ValidityFlags, ValidityFlag) @@ -203,24 +202,22 @@ class KSCREEN_EXPORT Config : public QOb */ void setTabletModeEngaged(bool engaged); - Q_SIGNALS: - void outputAdded(const KScreen::OutputPtr &output); - void outputRemoved(int outputId); - void primaryOutputChanged(const KScreen::OutputPtr &output); +Q_SIGNALS: + void outputAdded(const KScreen::OutputPtr &output); + void outputRemoved(int outputId); + void primaryOutputChanged(const KScreen::OutputPtr &output); - private: +private: Q_DISABLE_COPY(Config) class Private; - Private * const d; + Private *const d; }; -} //KScreen namespace +} // KScreen namespace Q_DECLARE_OPERATORS_FOR_FLAGS(KScreen::Config::Features) KSCREEN_EXPORT QDebug operator<<(QDebug dbg, const KScreen::ConfigPtr &config); - - -#endif //KSCREEN_CONFIG_H +#endif // KSCREEN_CONFIG_H
  17. Download patch backends/qscreen/qscreenoutput.cpp

    --- 4:5.20.5-1/backends/qscreen/qscreenoutput.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/qscreen/qscreenoutput.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -19,8 +19,8 @@ #include "qscreenoutput.h" #include "qscreenbackend.h" -#include <mode.h> #include <edid.h> +#include <mode.h> #include <QGuiApplication> #include <QScreen> @@ -100,8 +100,8 @@ void QScreenOutput::updateKScreenOutput( mode->setRefreshRate(m_qscreen->refreshRate()); mode->setSize(m_qscreen->size()); - const QString modename = QString::number(m_qscreen->size().width()) + QLatin1String("x") + QString::number(m_qscreen->size().height()) \ - + QLatin1String("@") + QString::number(m_qscreen->refreshRate()); + const QString modename = QString::number(m_qscreen->size().width()) + QLatin1String("x") + QString::number(m_qscreen->size().height()) + QLatin1String("@") + + QString::number(m_qscreen->refreshRate()); mode->setName(modename); ModeList modes;
  18. Download patch src/getconfigoperation.cpp

    --- 4:5.20.5-1/src/getconfigoperation.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/getconfigoperation.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -18,19 +18,18 @@ */ #include "getconfigoperation.h" -#include "configoperation_p.h" -#include "config.h" -#include "output.h" -#include "log.h" +#include "backendinterface.h" #include "backendmanager_p.h" +#include "config.h" +#include "configoperation_p.h" #include "configserializer_p.h" -#include "backendinterface.h" +#include "log.h" +#include "output.h" using namespace KScreen; namespace KScreen { - class GetConfigOperationPrivate : public ConfigOperationPrivate { Q_OBJECT @@ -38,7 +37,7 @@ class GetConfigOperationPrivate : public public: GetConfigOperationPrivate(GetConfigOperation::Options options, GetConfigOperation *qq); - void backendReady(org::kde::kscreen::Backend* backend) override; + void backendReady(org::kde::kscreen::Backend *backend) override; void onConfigReceived(QDBusPendingCallWatcher *watcher); void onEDIDReceived(QDBusPendingCallWatcher *watcher); @@ -46,7 +45,7 @@ public: GetConfigOperation::Options options; ConfigPtr config; // For in-process - void loadEdid(KScreen::AbstractBackend* backend); + void loadEdid(KScreen::AbstractBackend *backend); // For out-of-process int pendingEDIDs; @@ -58,7 +57,7 @@ private: } -GetConfigOperationPrivate::GetConfigOperationPrivate(GetConfigOperation::Options options, GetConfigOperation* qq) +GetConfigOperationPrivate::GetConfigOperationPrivate(GetConfigOperation::Options options, GetConfigOperation *qq) : ConfigOperationPrivate(qq) , options(options) { @@ -79,8 +78,7 @@ void GetConfigOperationPrivate::backendR mBackend = backend; QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(mBackend->getConfig(), this); - connect(watcher, &QDBusPendingCallWatcher::finished, - this, &GetConfigOperationPrivate::onConfigReceived); + connect(watcher, &QDBusPendingCallWatcher::finished, this, &GetConfigOperationPrivate::onConfigReceived); } void GetConfigOperationPrivate::onConfigReceived(QDBusPendingCallWatcher *watcher) @@ -121,13 +119,12 @@ void GetConfigOperationPrivate::onConfig QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(mBackend->getEdid(output->id()), this); watcher->setProperty("outputId", output->id()); - connect(watcher, &QDBusPendingCallWatcher::finished, - this, &GetConfigOperationPrivate::onEDIDReceived); + connect(watcher, &QDBusPendingCallWatcher::finished, this, &GetConfigOperationPrivate::onEDIDReceived); ++pendingEDIDs; } } -void GetConfigOperationPrivate::onEDIDReceived(QDBusPendingCallWatcher* watcher) +void GetConfigOperationPrivate::onEDIDReceived(QDBusPendingCallWatcher *watcher) { Q_ASSERT(BackendManager::instance()->method() == BackendManager::OutOfProcess); Q_Q(GetConfigOperation); @@ -149,9 +146,7 @@ void GetConfigOperationPrivate::onEDIDRe } } - - -GetConfigOperation::GetConfigOperation(Options options, QObject* parent) +GetConfigOperation::GetConfigOperation(Options options, QObject *parent) : ConfigOperation(new GetConfigOperationPrivate(options, this), parent) { } @@ -182,7 +177,7 @@ void GetConfigOperation::start() } } -void GetConfigOperationPrivate::loadEdid(KScreen::AbstractBackend* backend) +void GetConfigOperationPrivate::loadEdid(KScreen::AbstractBackend *backend) { Q_ASSERT(BackendManager::instance()->method() == BackendManager::InProcess); if (options & KScreen::ConfigOperation::NoEDID) { @@ -199,5 +194,4 @@ void GetConfigOperationPrivate::loadEdid } } - #include "getconfigoperation.moc"
  19. Download patch backends/xrandr/xrandroutput.cpp
  20. Download patch src/backendlauncher/backendloader.cpp

    --- 4:5.20.5-1/src/backendlauncher/backendloader.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/backendlauncher/backendloader.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -18,8 +18,8 @@ */ #include "backendloader.h" -#include "backendloaderadaptor.h" #include "backenddbuswrapper.h" +#include "backendloaderadaptor.h" #include "kscreen_backendLauncher_debug.h" #include "src/abstractbackend.h" #include "src/backendmanager_p.h" @@ -112,11 +112,10 @@ bool BackendLoader::requestBackend(const return true; } -KScreen::AbstractBackend *BackendLoader::loadBackend(const QString &name, - const QVariantMap &arguments) +KScreen::AbstractBackend *BackendLoader::loadBackend(const QString &name, const QVariantMap &arguments) { if (mLoader == nullptr) { - std::unique_ptr<QPluginLoader, void(*)(QPluginLoader *)> loader(new QPluginLoader(), pluginDeleter); + std::unique_ptr<QPluginLoader, void (*)(QPluginLoader *)> loader(new QPluginLoader(), pluginDeleter); mLoader = loader.release(); } return KScreen::BackendManager::loadBackendPlugin(mLoader, name, arguments);
  21. Download patch src/config.cpp

    --- 4:5.20.5-1/src/config.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/config.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -18,15 +18,15 @@ *************************************************************************************/ #include "config.h" -#include "output.h" -#include "backendmanager_p.h" #include "abstractbackend.h" +#include "backendmanager_p.h" #include "kscreen_debug.h" +#include "output.h" +#include <QCryptographicHash> #include <QDebug> #include <QRect> #include <QStringList> -#include <QCryptographicHash> using namespace KScreen; @@ -41,20 +41,20 @@ public: , tabletModeAvailable(false) , tabletModeEngaged(false) , q(parent) - { } + { + } KScreen::OutputPtr findPrimaryOutput() const { - auto iter = std::find_if(outputs.constBegin(), outputs.constEnd(), - [](const KScreen::OutputPtr &output) -> bool { - return output->isPrimary(); - }); + auto iter = std::find_if(outputs.constBegin(), outputs.constEnd(), [](const KScreen::OutputPtr &output) -> bool { + return output->isPrimary(); + }); return iter == outputs.constEnd() ? KScreen::OutputPtr() : iter.value(); } void onPrimaryOutputChanged() { - const KScreen::OutputPtr output(qobject_cast<KScreen::Output*>(sender()), [](void *) {}); + const KScreen::OutputPtr output(qobject_cast<KScreen::Output *>(sender()), [](void *) {}); Q_ASSERT(output); if (output->isPrimary()) { q->setPrimaryOutput(output); @@ -120,7 +120,7 @@ bool Config::canBeApplied(const ConfigPt OutputPtr currentOutput; const OutputList outputs = config->outputs(); int enabledOutputsCount = 0; - Q_FOREACH(const OutputPtr &output, outputs) { + Q_FOREACH (const OutputPtr &output, outputs) { if (!output->isEnabled()) { continue; } @@ -128,22 +128,22 @@ bool Config::canBeApplied(const ConfigPt ++enabledOutputsCount; currentOutput = currentConfig->output(output->id()); - //If there is no such output + // If there is no such output if (!currentOutput) { qCDebug(KSCREEN) << "canBeApplied: The output:" << output->id() << "does not exists"; return false; } - //If the output is not connected + // If the output is not connected if (!currentOutput->isConnected()) { qCDebug(KSCREEN) << "canBeApplied: The output:" << output->id() << "is not connected"; return false; } - //if there is no currentMode + // if there is no currentMode if (output->currentModeId().isEmpty()) { qCDebug(KSCREEN) << "canBeApplied: The output:" << output->id() << "has no currentModeId"; return false; } - //If the mode is not found in the current output + // If the mode is not found in the current output if (!currentOutput->mode(output->currentModeId())) { qCDebug(KSCREEN) << "canBeApplied: The output:" << output->id() << "has no mode:" << output->currentModeId(); return false; @@ -163,11 +163,9 @@ bool Config::canBeApplied(const ConfigPt QPoint bottomRight; if (output->isHorizontal()) { - bottomRight = QPoint(output->pos().x() + outputSize.width(), - output->pos().y() + outputSize.height()); + bottomRight = QPoint(output->pos().x() + outputSize.width(), output->pos().y() + outputSize.height()); } else { - bottomRight = QPoint(output->pos().x() + outputSize.height(), - output->pos().y() + outputSize.width()); + bottomRight = QPoint(output->pos().x() + outputSize.height(), output->pos().y() + outputSize.width()); } if (bottomRight.x() > rect.width()) { @@ -203,8 +201,8 @@ bool Config::canBeApplied(const ConfigPt } Config::Config() - : QObject(nullptr) - , d(new Private(this)) + : QObject(nullptr) + , d(new Private(this)) { } @@ -232,12 +230,12 @@ QString Config::connectedOutputsHash() c QStringList hashedOutputs; const auto outputs = connectedOutputs(); + hashedOutputs.reserve(outputs.count()); for (const OutputPtr &output : outputs) { hashedOutputs << output->hash(); } std::sort(hashedOutputs.begin(), hashedOutputs.end()); - const auto hash = QCryptographicHash::hash(hashedOutputs.join(QString()).toLatin1(), - QCryptographicHash::Md5); + const auto hash = QCryptographicHash::hash(hashedOutputs.join(QString()).toLatin1(), QCryptographicHash::Md5); return QString::fromLatin1(hash.toHex()); } @@ -294,7 +292,7 @@ OutputList Config::outputs() const OutputList Config::connectedOutputs() const { OutputList outputs; - Q_FOREACH(const OutputPtr &output, d->outputs) { + Q_FOREACH (const OutputPtr &output, d->outputs) { if (!output->isConnected()) { continue; } @@ -322,16 +320,14 @@ void Config::setPrimaryOutput(const Outp return; } -// qCDebug(KSCREEN) << "Primary output changed from" << primaryOutput() -// << "(" << (primaryOutput().isNull() ? "none" : primaryOutput()->name()) << ") to" -// << newPrimary << "(" << (newPrimary.isNull() ? "none" : newPrimary->name()) << ")"; + // qCDebug(KSCREEN) << "Primary output changed from" << primaryOutput() + // << "(" << (primaryOutput().isNull() ? "none" : primaryOutput()->name()) << ") to" + // << newPrimary << "(" << (newPrimary.isNull() ? "none" : newPrimary->name()) << ")"; for (OutputPtr &output : d->outputs) { - disconnect(output.data(), &KScreen::Output::isPrimaryChanged, - d, &KScreen::Config::Private::onPrimaryOutputChanged); + disconnect(output.data(), &KScreen::Output::isPrimaryChanged, d, &KScreen::Config::Private::onPrimaryOutputChanged); output->setPrimary(output == newPrimary); - connect(output.data(), &KScreen::Output::isPrimaryChanged, - d, &KScreen::Config::Private::onPrimaryOutputChanged); + connect(output.data(), &KScreen::Output::isPrimaryChanged, d, &KScreen::Config::Private::onPrimaryOutputChanged); } d->primaryOutput = newPrimary; @@ -341,8 +337,7 @@ void Config::setPrimaryOutput(const Outp void Config::addOutput(const OutputPtr &output) { d->outputs.insert(output->id(), output); - connect(output.data(), &KScreen::Output::isPrimaryChanged, - d, &KScreen::Config::Private::onPrimaryOutputChanged); + connect(output.data(), &KScreen::Output::isPrimaryChanged, d, &KScreen::Config::Private::onPrimaryOutputChanged); Q_EMIT outputAdded(output); @@ -358,7 +353,7 @@ void Config::removeOutput(int outputId) void Config::setOutputs(const OutputList &outputs) { - for (auto iter = d->outputs.begin(), end = d->outputs.end(); iter != end; ) { + for (auto iter = d->outputs.begin(), end = d->outputs.end(); iter != end;) { iter = d->removeOutput(iter); end = d->outputs.end(); } @@ -378,7 +373,7 @@ void Config::setValid(bool valid) d->valid = valid; } -void Config::apply(const ConfigPtr& other) +void Config::apply(const ConfigPtr &other) { d->screen->apply(other->screen()); @@ -403,7 +398,6 @@ void Config::apply(const ConfigPtr& othe setValid(other->isValid()); } - QDebug operator<<(QDebug dbg, const KScreen::ConfigPtr &config) { if (config) { @@ -421,5 +415,4 @@ QDebug operator<<(QDebug dbg, const KScr return dbg; } - #include "config.moc"
  22. Download patch src/abstractbackend.cpp

    --- 4:5.20.5-1/src/abstractbackend.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/abstractbackend.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -16,7 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *************************************************************************************/ - #include "abstractbackend.h" void KScreen::AbstractBackend::init(const QVariantMap &arguments)
  23. Download patch src/backendlauncher/backendloader.h

    --- 4:5.20.5-1/src/backendlauncher/backendloader.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/backendlauncher/backendloader.h 2021-01-21 12:52:36.000000000 +0000 @@ -20,8 +20,8 @@ #ifndef BACKENDLAUNCHER_H #define BACKENDLAUNCHER_H -#include <QObject> #include <QDBusContext> +#include <QObject> namespace KScreen { @@ -31,8 +31,7 @@ class AbstractBackend; class QPluginLoader; class BackendDBusWrapper; -class BackendLoader : public QObject - , protected QDBusContext +class BackendLoader : public QObject, protected QDBusContext { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.kde.KScreen")
  24. Download patch backends/fake/parser.cpp

    --- 4:5.20.5-1/backends/fake/parser.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/fake/parser.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -23,16 +23,16 @@ #include "output.h" #include <QFile> -#include <QMetaObject> -#include <QMetaProperty> -#include <QLoggingCategory> -#include <QJsonDocument> #include <QJsonArray> +#include <QJsonDocument> #include <QJsonObject> +#include <QLoggingCategory> +#include <QMetaObject> +#include <QMetaProperty> using namespace KScreen; -ConfigPtr Parser::fromJson(const QByteArray& data) +ConfigPtr Parser::fromJson(const QByteArray &data) { ConfigPtr config(new Config); @@ -47,7 +47,7 @@ ConfigPtr Parser::fromJson(const QByteAr } OutputList outputList; - Q_FOREACH(const QVariant &value, outputs) { + Q_FOREACH (const QVariant &value, outputs) { const OutputPtr output = Parser::outputFromJson(value.toMap()); outputList.insert(output->id(), output); } @@ -56,7 +56,7 @@ ConfigPtr Parser::fromJson(const QByteAr return config; } -ConfigPtr Parser::fromJson(const QString& path) +ConfigPtr Parser::fromJson(const QString &path) { QFile file(path); if (!file.open(QIODevice::ReadOnly)) { @@ -86,12 +86,12 @@ void Parser::qvariant2qobject(const QVar for (QVariantMap::const_iterator iter = variant.begin(); iter != variant.end(); ++iter) { const int propertyIndex = metaObject->indexOfProperty(qPrintable(iter.key())); if (propertyIndex == -1) { - //qWarning() << "Skipping non-existent property" << iter.key(); + // qWarning() << "Skipping non-existent property" << iter.key(); continue; } const QMetaProperty metaProperty = metaObject->property(propertyIndex); if (!metaProperty.isWritable()) { - //qWarning() << "Skipping read-only property" << iter.key(); + // qWarning() << "Skipping read-only property" << iter.key(); continue; } @@ -109,14 +109,14 @@ void Parser::qvariant2qobject(const QVar } } -OutputPtr Parser::outputFromJson(QMap< QString, QVariant > map) +OutputPtr Parser::outputFromJson(QMap<QString, QVariant> map) { OutputPtr output(new Output); output->setId(map[QStringLiteral("id")].toInt()); QStringList preferredModes; const QVariantList prefModes = map[QStringLiteral("preferredModes")].toList(); - Q_FOREACH(const QVariant &mode, prefModes) { + Q_FOREACH (const QVariant &mode, prefModes) { preferredModes.append(mode.toString()); } output->setPreferredModes(preferredModes); @@ -124,16 +124,16 @@ OutputPtr Parser::outputFromJson(QMap< Q ModeList modelist; const QVariantList modes = map[QStringLiteral("modes")].toList(); - Q_FOREACH(const QVariant &modeValue, modes) { + Q_FOREACH (const QVariant &modeValue, modes) { const ModePtr mode = Parser::modeFromJson(modeValue); modelist.insert(mode->id(), mode); } output->setModes(modelist); map.remove(QStringLiteral("modes")); - if(map.contains(QStringLiteral("clones"))) { + if (map.contains(QStringLiteral("clones"))) { QList<int> clones; - Q_FOREACH(const QVariant &id, map[QStringLiteral("clones")].toList()) { + Q_FOREACH (const QVariant &id, map[QStringLiteral("clones")].toList()) { clones.append(id.toInt()); } @@ -196,14 +196,14 @@ OutputPtr Parser::outputFromJson(QMap< Q map.remove(scale); } - //Remove some extra properties that we do not want or need special treatment + // Remove some extra properties that we do not want or need special treatment map.remove(QStringLiteral("edid")); Parser::qvariant2qobject(map, output.data()); return output; } -ModePtr Parser::modeFromJson(const QVariant& data) +ModePtr Parser::modeFromJson(const QVariant &data) { const QVariantMap map = data.toMap(); ModePtr mode(new Mode); @@ -214,7 +214,7 @@ ModePtr Parser::modeFromJson(const QVari return mode; } -QSize Parser::sizeFromJson(const QVariant& data) +QSize Parser::sizeFromJson(const QVariant &data) { const QVariantMap map = data.toMap(); @@ -225,7 +225,7 @@ QSize Parser::sizeFromJson(const QVarian return size; } -QPoint Parser::pointFromJson(const QVariant& data) +QPoint Parser::pointFromJson(const QVariant &data) { const QVariantMap map = data.toMap(); @@ -236,7 +236,7 @@ QPoint Parser::pointFromJson(const QVari return point; } -QRect Parser::rectFromJson(const QVariant& data) +QRect Parser::rectFromJson(const QVariant &data) { QRect rect; rect.setSize(Parser::sizeFromJson(data)); @@ -245,13 +245,13 @@ QRect Parser::rectFromJson(const QVarian return rect; } -bool Parser::validate(const QByteArray& data) +bool Parser::validate(const QByteArray &data) { Q_UNUSED(data); return true; } -bool Parser::validate(const QString& data) +bool Parser::validate(const QString &data) { Q_UNUSED(data); return true;
  25. Download patch src/doctor/doctor.h

    --- 4:5.20.5-1/src/doctor/doctor.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/doctor/doctor.h 2021-01-21 12:52:36.000000000 +0000 @@ -19,9 +19,9 @@ #ifndef KSCREEN_DOCTOR_H #define KSCREEN_DOCTOR_H +#include "../config.h" #include <QCommandLineParser> #include <QObject> -#include "../config.h" #include "output.h" @@ -62,12 +62,11 @@ Q_SIGNALS: void configChanged(); private: - //static QString modeString(KWayland::Server::OutputDeviceInterface* outputdevice, int mid); + // static QString modeString(KWayland::Server::OutputDeviceInterface* outputdevice, int mid); void applyConfig(); void parsePositionalArgs(); - int parseInt(const QString &str, bool &ok) const; KScreen::ConfigPtr m_config; - QCommandLineParser* m_parser; + QCommandLineParser *m_parser; bool m_changed; QStringList m_positionalArgs; DpmsClient *m_dpmsClient;
  26. Download patch debian/control

    --- 4:5.20.5-1/debian/control 2020-12-26 21:09:42.000000000 +0000 +++ 4:5.20.90-0ubuntu1/debian/control 2021-01-21 23:45:12.000000000 +0000 @@ -20,14 +20,16 @@ Build-Depends: cmake (>= 3.0~), qtbase5-dev (>= 5.15~), Standards-Version: 4.5.1 Homepage: https://invent.kde.org/plasma/libkscreen -Vcs-Browser: https://salsa.debian.org/qt-kde-team/kde/libkscreen -Vcs-Git: https://salsa.debian.org/qt-kde-team/kde/libkscreen.git +Vcs-Browser: https://code.launchpad.net/~kubuntu-packagers/kubuntu-packaging/+git/libkscreen +Vcs-Git: https://git.launchpad.net/~kubuntu-packagers/kubuntu-packaging/+git/libkscreen Rules-Requires-Root: no Package: libkf5screen-bin Architecture: any Multi-Arch: foreign Depends: ${misc:Depends}, ${shlibs:Depends} +Breaks: libkf5screen7 (<< 4:5.20.4-2~) +Replaces: libkf5screen7 (<< 4:5.20.4-2~) Description: library for screen management - helpers The KDE multiple monitor support is trying be as smart as possible adapting the behavior of it to each use case making the configuration
  27. Download patch backends/xcbwrapper.h
  28. Download patch backends/xcbeventlistener.h

    --- 4:5.20.5-1/backends/xcbeventlistener.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/xcbeventlistener.h 2021-01-21 12:52:36.000000000 +0000 @@ -19,58 +19,49 @@ #ifndef XRANDRX11HELPER_H #define XRANDRX11HELPER_H -#include <QObject> -#include <QLoggingCategory> #include <QAbstractNativeEventFilter> +#include <QLoggingCategory> +#include <QObject> #include <QRect> #include "xcbwrapper.h" -class XCBEventListener : public QObject, - public QAbstractNativeEventFilter +class XCBEventListener : public QObject, public QAbstractNativeEventFilter { Q_OBJECT - public: - XCBEventListener(); - ~XCBEventListener() override; - - bool nativeEventFilter(const QByteArray& eventType, void* message, long int* result) override; - - Q_SIGNALS: - /* Emitted when only XRandR 1.1 or older is available */ - void screenChanged(xcb_randr_rotation_t rotation, - const QSize &sizePx, - const QSize &sizeMm); - void outputsChanged(); - - /* Emitted only when XRandR 1.2 or newer is available */ - void crtcChanged(xcb_randr_crtc_t crtc, - xcb_randr_mode_t mode, - xcb_randr_rotation_t rotation, - const QRect &geom); - void outputChanged(xcb_randr_output_t output, - xcb_randr_crtc_t crtc, - xcb_randr_mode_t mode, - xcb_randr_connection_t connection); - void outputPropertyChanged(xcb_randr_output_t output); - - private: - QString rotationToString(xcb_randr_rotation_t rotation); - QString connectionToString(xcb_randr_connection_t connection); - void handleScreenChange(xcb_generic_event_t *e); - void handleXRandRNotify(xcb_generic_event_t *e); - - protected: - bool m_isRandrPresent; - bool m_event11; - uint8_t m_randrBase; - uint8_t m_randrErrorBase; - uint8_t m_majorOpcode; - uint32_t m_versionMajor; - uint32_t m_versionMinor; +public: + XCBEventListener(); + ~XCBEventListener() override; + + bool nativeEventFilter(const QByteArray &eventType, void *message, long int *result) override; + +Q_SIGNALS: + /* Emitted when only XRandR 1.1 or older is available */ + void screenChanged(xcb_randr_rotation_t rotation, const QSize &sizePx, const QSize &sizeMm); + void outputsChanged(); + + /* Emitted only when XRandR 1.2 or newer is available */ + void crtcChanged(xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_randr_rotation_t rotation, const QRect &geom); + void outputChanged(xcb_randr_output_t output, xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_randr_connection_t connection); + void outputPropertyChanged(xcb_randr_output_t output); + +private: + QString rotationToString(xcb_randr_rotation_t rotation); + QString connectionToString(xcb_randr_connection_t connection); + void handleScreenChange(xcb_generic_event_t *e); + void handleXRandRNotify(xcb_generic_event_t *e); + +protected: + bool m_isRandrPresent; + bool m_event11; + uint8_t m_randrBase; + uint8_t m_randrErrorBase; + uint8_t m_majorOpcode; + uint32_t m_versionMajor; + uint32_t m_versionMinor; - uint32_t m_window; + uint32_t m_window; }; Q_DECLARE_LOGGING_CATEGORY(KSCREEN_XCB_HELPER)
  29. Download patch backends/xrandr/xrandrmode.cpp

    --- 4:5.20.5-1/backends/xrandr/xrandrmode.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/xrandr/xrandrmode.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -26,10 +26,9 @@ XRandRMode::XRandRMode(const xcb_randr_m { m_id = modeInfo.id; // FIXME XCB - //m_name = QString::fromUtf8(modeInfo->name); + // m_name = QString::fromUtf8(modeInfo->name); m_size = QSize(modeInfo.width, modeInfo.height); - m_refreshRate = (float) modeInfo.dot_clock - / ((float) modeInfo.htotal * (float) modeInfo.vtotal); + m_refreshRate = (float)modeInfo.dot_clock / ((float)modeInfo.htotal * (float)modeInfo.vtotal); } XRandRMode::~XRandRMode()
  30. Download patch backends/kwayland/waylandscreen.cpp

    --- 4:5.20.5-1/backends/kwayland/waylandscreen.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/kwayland/waylandscreen.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -39,7 +39,7 @@ ScreenPtr WaylandScreen::toKScreenScreen return kscreenScreen; } -void WaylandScreen::setOutputs(const QList<WaylandOutput*> &outputs) +void WaylandScreen::setOutputs(const QList<WaylandOutput *> &outputs) { m_outputCount = outputs.count(); @@ -47,7 +47,7 @@ void WaylandScreen::setOutputs(const QLi for (const auto *out : outputs) { if (out->enabled()) { const auto *dev = out->outputDevice(); - r |= QRect(dev->globalPosition(), dev->pixelSize() / dev->scale()); + r |= QRect(dev->globalPosition(), dev->pixelSize() / dev->scaleF()); } } m_size = r.size(); @@ -63,4 +63,3 @@ void WaylandScreen::updateKScreenScreen( screen->setCurrentSize(m_size); screen->setMaxActiveOutputsCount(m_outputCount); } -
  31. Download patch src/screen.h

    --- 4:5.20.5-1/src/screen.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/screen.h 2021-01-21 12:52:36.000000000 +0000 @@ -19,90 +19,90 @@ #ifndef SCREEN_CONFIG_H #define SCREEN_CONFIG_H -#include "types.h" #include "kscreen_export.h" +#include "types.h" -#include <QSize> #include <QObject> +#include <QSize> -namespace KScreen { - +namespace KScreen +{ class KSCREEN_EXPORT Screen : public QObject { Q_OBJECT - public: - Q_PROPERTY(int id READ id CONSTANT) - Q_PROPERTY(QSize currentSize READ currentSize WRITE setCurrentSize NOTIFY currentSizeChanged) - Q_PROPERTY(QSize minSize READ minSize CONSTANT) - Q_PROPERTY(QSize maxSize READ maxSize CONSTANT) - Q_PROPERTY(int maxActiveOutputsCount READ maxActiveOutputsCount CONSTANT) - - explicit Screen(); - ~Screen() override; - - ScreenPtr clone() const; - - /** - * The id of this screen. - * @return id of this screen - */ - int id() const; - /** - * The identifier of this screen. - * @param id id of the screen - */ - void setId(int id); - - /** - * The current screen size in pixels. - * @return Screen size in pixels - */ - QSize currentSize() const; - /** - * Set the current screen size in pixels. - * @param currentSize Screen size in pixels - */ - void setCurrentSize(const QSize& currentSize); - - /** - * The minimum screen size in pixels. - * @return Minimum screen size in pixels - */ - QSize minSize() const; - /** - * Set the minimum screen size in pixels. - * @param minSize Minimum screen size in pixels - */ - void setMinSize(const QSize& minSize); - - /** - * The maximum screen size in pixels. - * @return Maximum screen size in pixels - */ - QSize maxSize() const; - /** - * Set the maximum screen size in pixels. - * @param maxSize Maximum screen size in pixels - */ - void setMaxSize(const QSize& maxSize); - - int maxActiveOutputsCount() const; - void setMaxActiveOutputsCount(int maxActiveOutputsCount); - - void apply(const ScreenPtr &other); - - Q_SIGNALS: - void currentSizeChanged(); +public: + Q_PROPERTY(int id READ id CONSTANT) + Q_PROPERTY(QSize currentSize READ currentSize WRITE setCurrentSize NOTIFY currentSizeChanged) + Q_PROPERTY(QSize minSize READ minSize CONSTANT) + Q_PROPERTY(QSize maxSize READ maxSize CONSTANT) + Q_PROPERTY(int maxActiveOutputsCount READ maxActiveOutputsCount CONSTANT) + + explicit Screen(); + ~Screen() override; + + ScreenPtr clone() const; + + /** + * The id of this screen. + * @return id of this screen + */ + int id() const; + /** + * The identifier of this screen. + * @param id id of the screen + */ + void setId(int id); + + /** + * The current screen size in pixels. + * @return Screen size in pixels + */ + QSize currentSize() const; + /** + * Set the current screen size in pixels. + * @param currentSize Screen size in pixels + */ + void setCurrentSize(const QSize &currentSize); + + /** + * The minimum screen size in pixels. + * @return Minimum screen size in pixels + */ + QSize minSize() const; + /** + * Set the minimum screen size in pixels. + * @param minSize Minimum screen size in pixels + */ + void setMinSize(const QSize &minSize); + + /** + * The maximum screen size in pixels. + * @return Maximum screen size in pixels + */ + QSize maxSize() const; + /** + * Set the maximum screen size in pixels. + * @param maxSize Maximum screen size in pixels + */ + void setMaxSize(const QSize &maxSize); + + int maxActiveOutputsCount() const; + void setMaxActiveOutputsCount(int maxActiveOutputsCount); + + void apply(const ScreenPtr &other); + +Q_SIGNALS: + void currentSizeChanged(); - private: - Q_DISABLE_COPY(Screen) +private: + Q_DISABLE_COPY(Screen) - class Private; - Private * const d; + class Private; + Private *const d; - Screen(Private *dd); + Screen(Private *dd); }; -} //KScreen namespace -#endif //SCREEN_H +} // KScreen namespace +#endif // SCREEN_H
  32. Download patch autotests/testkwaylandconfig.cpp

    --- 4:5.20.5-1/autotests/testkwaylandconfig.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/autotests/testkwaylandconfig.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -17,18 +17,18 @@ *************************************************************************************/ #include <QCoreApplication> -#include <QtTest> #include <QObject> #include <QSignalSpy> +#include <QtTest> #include "backendmanager_p.h" -#include "getconfigoperation.h" -#include "setconfigoperation.h" #include "config.h" #include "configmonitor.h" -#include "output.h" -#include "mode.h" #include "edid.h" +#include "getconfigoperation.h" +#include "mode.h" +#include "output.h" +#include "setconfigoperation.h" #include "waylandtestserver.h" @@ -56,9 +56,7 @@ private Q_SLOTS: void testApplyOnPending(); private: - WaylandTestServer *m_server; - }; TestKWaylandConfig::TestKWaylandConfig(QObject *parent) @@ -100,7 +98,6 @@ void TestKWaylandConfig::changeConfig() monitor->addConfig(config); QSignalSpy configSpy(monitor, &KScreen::ConfigMonitor::configurationChanged); - // The first output is currently disabled, let's try to enable it auto output = config->outputs().first(); QVERIFY(output->isEnabled() == false); @@ -196,7 +193,6 @@ void TestKWaylandConfig::testRotationCha auto newoutput = newconfig->outputs().first(); QCOMPARE(newoutput->rotation(), rotation); - } void TestKWaylandConfig::testScaleChange() @@ -320,7 +316,6 @@ void TestKWaylandConfig::testApplyOnPend QCOMPARE(output2->scale(), 3.0); } - QTEST_GUILESS_MAIN(TestKWaylandConfig) #include "testkwaylandconfig.moc"
  33. Download patch backends/xrandr/xrandrmode.h

    --- 4:5.20.5-1/backends/xrandr/xrandrmode.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/xrandr/xrandrmode.h 2021-01-21 12:52:36.000000000 +0000 @@ -17,13 +17,13 @@ *************************************************************************************/ #pragma once -#include <QObject> #include <QMap> -#include <QVariant> +#include <QObject> #include <QSize> +#include <QVariant> -#include "types.h" #include "../xcbwrapper.h" +#include "types.h" class XRandROutput; namespace KScreen @@ -37,7 +37,7 @@ class XRandRMode : public QObject Q_OBJECT public: - typedef QMap<xcb_randr_mode_t, XRandRMode*> Map; + typedef QMap<xcb_randr_mode_t, XRandRMode *> Map; explicit XRandRMode(const xcb_randr_mode_info_t &modeInfo, XRandROutput *output); ~XRandRMode() override;
  34. Download patch src/backendlauncher/backenddbuswrapper.cpp

    --- 4:5.20.5-1/src/backendlauncher/backenddbuswrapper.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/backendlauncher/backenddbuswrapper.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -18,29 +18,27 @@ */ #include "backenddbuswrapper.h" -#include "backendloader.h" #include "backendadaptor.h" +#include "backendloader.h" #include "kscreen_backendLauncher_debug.h" -#include "src/configserializer_p.h" -#include "src/config.h" #include "src/abstractbackend.h" +#include "src/config.h" +#include "src/configserializer_p.h" #include <QDBusConnection> #include <QDBusError> -BackendDBusWrapper::BackendDBusWrapper(KScreen::AbstractBackend* backend) +BackendDBusWrapper::BackendDBusWrapper(KScreen::AbstractBackend *backend) : QObject() , mBackend(backend) { - connect(mBackend, &KScreen::AbstractBackend::configChanged, - this, &BackendDBusWrapper::backendConfigChanged); + connect(mBackend, &KScreen::AbstractBackend::configChanged, this, &BackendDBusWrapper::backendConfigChanged); mChangeCollector.setSingleShot(true); mChangeCollector.setInterval(200); // wait for 200 msecs without any change // before actually emitting configChanged - connect(&mChangeCollector, &QTimer::timeout, - this, &BackendDBusWrapper::doEmitConfigChanged); + connect(&mChangeCollector, &QTimer::timeout, this, &BackendDBusWrapper::doEmitConfigChanged); } BackendDBusWrapper::~BackendDBusWrapper() @@ -95,7 +93,7 @@ QVariantMap BackendDBusWrapper::setConfi QByteArray BackendDBusWrapper::getEdid(int output) const { - const QByteArray edidData = mBackend->edid(output); + const QByteArray edidData = mBackend->edid(output); if (edidData.isEmpty()) { return QByteArray(); } @@ -128,4 +126,3 @@ void BackendDBusWrapper::doEmitConfigCha mCurrentConfig.clear(); mChangeCollector.stop(); } -
  35. Download patch .git-blame-ignore-revs

    --- 4:5.20.5-1/.git-blame-ignore-revs 1970-01-01 00:00:00.000000000 +0000 +++ 4:5.20.90-0ubuntu1/.git-blame-ignore-revs 2021-01-21 12:52:36.000000000 +0000 @@ -0,0 +1,2 @@ +# clang-format +0ae03aa6e4b2afd6f1348ff16502a6257f3580e4
  36. Download patch CMakeLists.txt

    --- 4:5.20.5-1/CMakeLists.txt 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/CMakeLists.txt 2021-01-21 12:52:36.000000000 +0000 @@ -1,10 +1,10 @@ cmake_minimum_required(VERSION 3.0) project(libkscreen) -set(PROJECT_VERSION "5.20.5") +set(PROJECT_VERSION "5.20.90") set(QT_MIN_VERSION "5.15.0") -set(KF5_MIN_VERSION "5.74") +set(KF5_MIN_VERSION "5.78") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON)
  37. Download patch autotests/testconfigserializer.cpp

    --- 4:5.20.5-1/autotests/testconfigserializer.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/autotests/testconfigserializer.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -20,11 +20,11 @@ #include <QObject> #include <QtTest> -#include "../src/types.h" #include "../src/configserializer_p.h" -#include "../src/screen.h" #include "../src/mode.h" #include "../src/output.h" +#include "../src/screen.h" +#include "../src/types.h" class TestConfigSerializer : public QObject { @@ -35,7 +35,6 @@ public: { } - private Q_SLOTS: void testSerializePoint() { @@ -62,10 +61,7 @@ private Q_SLOTS: void testSerializeList() { QStringList stringList; - stringList << QStringLiteral("Item 1") - << QStringLiteral("Item 2") - << QStringLiteral("Item 3") - << QStringLiteral("Item 4"); + stringList << QStringLiteral("Item 1") << QStringLiteral("Item 2") << QStringLiteral("Item 3") << QStringLiteral("Item 4"); QJsonArray arr = KScreen::ConfigSerializer::serializeList<QString>(stringList); QCOMPARE(arr.size(), stringList.size()); @@ -74,8 +70,6 @@ private Q_SLOTS: QCOMPARE(arr.at(i).toString(), stringList.at(i)); } - - QList<int> intList; intList << 4 << 3 << 2 << 1; @@ -125,7 +119,7 @@ private Q_SLOTS: QCOMPARE(obj[QLatin1String("id")].toString(), mode->id()); QCOMPARE(obj[QLatin1String("name")].toString(), mode->name()); - QCOMPARE((float) obj[QLatin1String("refreshRate")].toDouble(), mode->refreshRate()); + QCOMPARE((float)obj[QLatin1String("refreshRate")].toDouble(), mode->refreshRate()); const QJsonObject size = obj[QLatin1String("size")].toObject(); QCOMPARE(size[QLatin1String("width")].toInt(), mode->size().width()); QCOMPARE(size[QLatin1String("height")].toInt(), mode->size().height());
  38. Download patch autotests/testedid.cpp

    --- 4:5.20.5-1/autotests/testedid.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/autotests/testedid.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -17,8 +17,8 @@ *************************************************************************************/ #include <QCoreApplication> -#include <QtTest> #include <QObject> +#include <QtTest> #include "../src/edid.h" @@ -69,7 +69,7 @@ void TestEdid::testEdidParser_data() QTest::addColumn<QQuaternion>("green"); QTest::addColumn<QQuaternion>("blue"); QTest::addColumn<QQuaternion>("white"); - + // clang-format off QTest::addRow("cor") << QByteArray::fromBase64("AP///////wAN8iw0AAAAABwVAQOAHRB4CoPVlFdSjCccUFQAAAABAQEBAQEBAQEBAQEBAQEBEhtWWlAAGTAwIDYAJaQQAAAYEhtWWlAAGTAwIDYAJaQQAAAYAAAA/gBBVU8KICAgICAgICAgAAAA/gBCMTMzWFcwMyBWNCAKAIc=") << QStringLiteral("xrandr-unknown") @@ -128,6 +128,7 @@ void TestEdid::testEdidParser_data() << QQuaternion(1, QVector3D(0.299805, 0.599609, 0)) << QQuaternion(1, QVector3D(0.149414, 0.0595703, 0)) << QQuaternion(1, QVector3D(0.3125, 0.328125, 0)); + // clang-format on } void TestEdid::testEdidParser() @@ -156,7 +157,7 @@ void TestEdid::testEdidParser() QCOMPARE(e->name(), name); QCOMPARE(e->pnpId(), pnpId); // FIXME: needs to return at least the short ID -// QVERIFY2(vendor.contains(e->vendor()), qPrintable(QString::fromLatin1("%1 not in list").arg(e->vendor()))); + // QVERIFY2(vendor.contains(e->vendor()), qPrintable(QString::fromLatin1("%1 not in list").arg(e->vendor()))); QCOMPARE(e->serial(), serial); QCOMPARE(e->eisaId(), eisaId); QCOMPARE(e->hash(), hash);
  39. Download patch src/backendlauncher/main.cpp

    --- 4:5.20.5-1/src/backendlauncher/main.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/backendlauncher/main.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -17,26 +17,20 @@ * */ -#include <QGuiApplication> #include <QDBusConnection> -#include <QSessionManager> +#include <QGuiApplication> -#include "kscreen_backendLauncher_debug.h" #include "backendloader.h" +#include "kscreen_backendLauncher_debug.h" #include "log.h" int main(int argc, char **argv) { KScreen::Log::instance(); QGuiApplication::setDesktopSettingsAware(false); + QCoreApplication::setAttribute(Qt::AA_DisableSessionManager); QGuiApplication app(argc, argv); - auto disableSessionManagement = [](QSessionManager &sm) { - sm.setRestartHint(QSessionManager::RestartNever); - }; - QObject::connect(&app, &QGuiApplication::commitDataRequest, disableSessionManagement); - QObject::connect(&app, &QGuiApplication::saveStateRequest, disableSessionManagement); - if (!QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.KScreen"))) { qCWarning(KSCREEN_BACKEND_LAUNCHER) << "Cannot register org.kde.KScreen service. Another launcher already running?"; return -1;
  40. Download patch src/doctor/dpmsclient.cpp

    --- 4:5.20.5-1/src/doctor/dpmsclient.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/doctor/dpmsclient.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -26,10 +26,10 @@ #include <KWayland/Client/connection_thread.h> #include <KWayland/Client/dpms.h> -#include <KWayland/Client/registry.h> #include <KWayland/Client/output.h> +#include <KWayland/Client/registry.h> -//static const QString s_socketName = QStringLiteral("libkscreen-test-wayland-backend-0"); +// static const QString s_socketName = QStringLiteral("libkscreen-test-wayland-backend-0"); static const QString s_socketName = QStringLiteral("wayland-0"); Q_LOGGING_CATEGORY(KSCREEN_DPMS, "kscreen.dpms") @@ -41,19 +41,18 @@ using namespace KWayland::Client; DpmsClient::DpmsClient(QObject *parent) : QObject(parent) , m_thread(nullptr) - , m_connection(nullptr) - , m_dpmsManager(nullptr) + , m_registry(new KWayland::Client::Registry) { - } DpmsClient::~DpmsClient() { + delete m_registry; + m_thread->exit(); m_thread->wait(); delete m_thread; delete m_connection; - } void DpmsClient::connect() @@ -78,38 +77,33 @@ void DpmsClient::connect() void DpmsClient::connected() { qDebug() << "Connected!"; - m_registry.create(m_connection); - QObject::connect(&m_registry, &Registry::interfacesAnnounced, this, - [this] { - const bool hasDpms = m_registry.hasInterface(Registry::Interface::Dpms); - // QLabel *hasDpmsLabel = new QLabel(&window); - if (hasDpms) { - qDebug() << QStringLiteral("Compositor provides a DpmsManager"); - } else { - qDebug() << QStringLiteral("Compositor does not provid a DpmsManager"); - } - - if (hasDpms) { - const auto dpmsData = m_registry.interface(Registry::Interface::Dpms); - m_dpmsManager = m_registry.createDpmsManager(dpmsData.name, dpmsData.version); - } - - - emit this->ready(); - }); - m_registry.setup(); + m_registry->create(m_connection); + QObject::connect(m_registry, &Registry::interfacesAnnounced, this, [this] { + const bool hasDpms = m_registry->hasInterface(Registry::Interface::Dpms); + // QLabel *hasDpmsLabel = new QLabel(&window); + if (hasDpms) { + qDebug() << QStringLiteral("Compositor provides a DpmsManager"); + } else { + qDebug() << QStringLiteral("Compositor does not provid a DpmsManager"); + } + + if (hasDpms) { + const auto dpmsData = m_registry->interface(Registry::Interface::Dpms); + m_dpmsManager = m_registry->createDpmsManager(dpmsData.name, dpmsData.version); + } - //QVERIFY(dpmsSpy.wait(100)); + emit this->ready(); + }); + m_registry->setup(); + // QVERIFY(dpmsSpy.wait(100)); } void KScreen::DpmsClient::changeMode(KWayland::Client::Dpms::Mode mode) { - const auto outputs = m_registry.interfaces(Registry::Interface::Output); + const auto outputs = m_registry->interfaces(Registry::Interface::Output); for (auto outputInterface : outputs) { - - KWayland::Client::Output *output = m_registry.createOutput(outputInterface.name, outputInterface.version, &m_registry); - qDebug() << "OUTPUT!" << output->model() << output->manufacturer() << output->geometry(); + KWayland::Client::Output *output = m_registry->createOutput(outputInterface.name, outputInterface.version, m_registry); Dpms *dpms = nullptr; if (m_dpmsManager) { @@ -117,21 +111,25 @@ void KScreen::DpmsClient::changeMode(KWa } if (dpms) { - QObject::connect(dpms, &Dpms::supportedChanged, this, - [dpms, mode, this] { + QObject::connect( + dpms, + &Dpms::supportedChanged, + this, + [dpms, mode, output, this] { + if (m_excludedOutputNames.contains(output->model())) { + qDebug() << "Skipping" << output->model() << output->manufacturer(); + return; + } + if (dpms->isSupported()) { - QObject::connect(dpms, &Dpms::modeChanged, this, - &DpmsClient::modeChanged, Qt::QueuedConnection); - qDebug() << "Switching " << (mode == Dpms::Mode::On ? "on" : "off"); + QObject::connect(dpms, &Dpms::modeChanged, this, &DpmsClient::modeChanged, Qt::QueuedConnection); + qDebug() << "Switching" << output->model() << output->manufacturer() << (mode == Dpms::Mode::On ? "on" : "off"); m_modeChanges++; dpms->requestMode(mode); } - - }, Qt::QueuedConnection - ); + }, + Qt::QueuedConnection); } - - qDebug() << "dpms->isSupported()" << dpms->isSupported(); } } @@ -147,11 +145,11 @@ void DpmsClient::modeChanged() void DpmsClient::on() { changeMode(Dpms::Mode::On); - //emit finished(); + // emit finished(); } void KScreen::DpmsClient::off() { changeMode(Dpms::Mode::Off); - //emit finished(); + // emit finished(); }
  41. Download patch autotests/testconfigmonitor.cpp

    --- 4:5.20.5-1/autotests/testconfigmonitor.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/autotests/testconfigmonitor.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -18,17 +18,16 @@ */ #include <QObject> -#include <QtTest> #include <QSignalSpy> +#include <QtTest> #include "../src/backendmanager_p.h" #include "../src/config.h" -#include "../src/output.h" #include "../src/configmonitor.h" #include "../src/configoperation.h" #include "../src/getconfigoperation.h" +#include "../src/output.h" #include "../src/setconfigoperation.h" -#include "../src/backendmanager_p.h" #include <QSignalSpy> #include "fakebackendinterface.h" @@ -72,7 +71,7 @@ private Q_SLOTS: qputenv("KSCREEN_BACKEND_INPROCESS", "1"); KScreen::BackendManager::instance()->shutdownBackend(); KScreen::BackendManager::instance()->setMethod(KScreen::BackendManager::InProcess); - //json file for the fake backend + // json file for the fake backend qputenv("KSCREEN_BACKEND_ARGS", "TEST_DATA=" TEST_DATA "singleoutput.json"); // Prepare monitor @@ -103,7 +102,6 @@ private Q_SLOTS: QTRY_VERIFY(!spy.isEmpty()); QCOMPARE(spy.size(), 2); } - }; QTEST_MAIN(TestConfigMonitor)
  42. Download patch .gitignore

    --- 4:5.20.5-1/.gitignore 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/.gitignore 2021-01-21 12:52:36.000000000 +0000 @@ -3,3 +3,5 @@ build build-overlay .clang-format +cmake-build-debug* +.idea
  43. Download patch src/screen.cpp

    --- 4:5.20.5-1/src/screen.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/screen.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -23,18 +23,19 @@ using namespace KScreen; class Q_DECL_HIDDEN Screen::Private { - public: - Private(): - id(0), - maxActiveOutputsCount(0) - { } - - Private(const Private &other): - id(other.id), - maxActiveOutputsCount(other.maxActiveOutputsCount), - currentSize(other.currentSize), - minSize(other.minSize), - maxSize(other.maxSize) +public: + Private() + : id(0) + , maxActiveOutputsCount(0) + { + } + + Private(const Private &other) + : id(other.id) + , maxActiveOutputsCount(other.maxActiveOutputsCount) + , currentSize(other.currentSize) + , minSize(other.minSize) + , maxSize(other.maxSize) { } @@ -46,18 +47,17 @@ class Q_DECL_HIDDEN Screen::Private }; Screen::Screen() - : QObject(nullptr) - , d(new Private()) + : QObject(nullptr) + , d(new Private()) { } Screen::Screen(Screen::Private *dd) - : QObject() - , d(dd) + : QObject() + , d(dd) { } - Screen::~Screen() { delete d; @@ -68,7 +68,6 @@ ScreenPtr Screen::clone() const return ScreenPtr(new Screen(new Private(*d))); } - int Screen::id() const { return d->id; @@ -84,7 +83,7 @@ QSize Screen::currentSize() const return d->currentSize; } -void Screen::setCurrentSize(const QSize& currentSize) +void Screen::setCurrentSize(const QSize &currentSize) { if (d->currentSize == currentSize) { return; @@ -100,7 +99,7 @@ QSize Screen::maxSize() const return d->maxSize; } -void Screen::setMaxSize(const QSize& maxSize) +void Screen::setMaxSize(const QSize &maxSize) { d->maxSize = maxSize; } @@ -110,7 +109,7 @@ QSize Screen::minSize() const return d->minSize; } -void Screen::setMinSize(const QSize& minSize) +void Screen::setMinSize(const QSize &minSize) { d->minSize = minSize; }
  44. Download patch src/output.h
  45. Download patch src/configserializer_p.h

    --- 4:5.20.5-1/src/configserializer_p.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/configserializer_p.h 2021-01-21 12:52:36.000000000 +0000 @@ -20,24 +20,21 @@ #ifndef CONFIGSERIALIZER_H #define CONFIGSERIALIZER_H -#include <QJsonObject> +#include <QDBusArgument> #include <QJsonArray> +#include <QJsonObject> #include <QVariant> -#include <QDBusArgument> -#include "types.h" #include "kscreen_export.h" +#include "types.h" namespace KScreen { - namespace ConfigSerializer { - KSCREEN_EXPORT QJsonObject serializePoint(const QPoint &point); KSCREEN_EXPORT QJsonObject serializeSize(const QSize &size); -template<typename T> -KSCREEN_EXPORT QJsonArray serializeList(const QList<T> &list) +template<typename T> KSCREEN_EXPORT QJsonArray serializeList(const QList<T> &list) { QJsonArray arr; Q_FOREACH (const T &t, list) { @@ -53,8 +50,7 @@ KSCREEN_EXPORT QJsonObject serializeScre KSCREEN_EXPORT QPoint deserializePoint(const QDBusArgument &map); KSCREEN_EXPORT QSize deserializeSize(const QDBusArgument &map); -template<typename T> -KSCREEN_EXPORT QList<T> deserializeList(const QDBusArgument &arg) +template<typename T> KSCREEN_EXPORT QList<T> deserializeList(const QDBusArgument &arg) { QList<T> list; arg.beginArray();
  46. Download patch src/configserializer.cpp

    --- 4:5.20.5-1/src/configserializer.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/configserializer.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -20,15 +20,15 @@ #include "configserializer_p.h" #include "config.h" +#include "edid.h" +#include "kscreen_debug.h" #include "mode.h" #include "output.h" #include "screen.h" -#include "edid.h" -#include "kscreen_debug.h" #include <QDBusArgument> -#include <QJsonDocument> #include <QFile> +#include <QJsonDocument> #include <QRect> using namespace KScreen; @@ -93,7 +93,7 @@ QJsonObject ConfigSerializer::serializeO obj[QLatin1String("enabled")] = output->isEnabled(); obj[QLatin1String("primary")] = output->isPrimary(); obj[QLatin1String("clones")] = serializeList(output->clones()); - //obj[QLatin1String("edid")] = output->edid()->raw(); + // obj[QLatin1String("edid")] = output->edid()->raw(); obj[QLatin1String("sizeMM")] = serializeSize(output->sizeMm()); obj[QLatin1String("replicationSource")] = output->replicationSource();
  47. Download patch autotests/testkwaylanddpms.cpp

    --- 4:5.20.5-1/autotests/testkwaylanddpms.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/autotests/testkwaylanddpms.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -17,9 +17,9 @@ *************************************************************************************/ #include <QCoreApplication> -#include <QtTest> #include <QObject> #include <QSignalSpy> +#include <QtTest> #include <KWayland/Client/connection_thread.h> #include <KWayland/Client/dpms.h> @@ -27,7 +27,6 @@ #include "waylandtestserver.h" - static const QString s_socketName = QStringLiteral("libkscreen-test-wayland-backend-0"); // static const QString s_socketName = QStringLiteral("wayland-0"); @@ -45,7 +44,6 @@ public: Q_SIGNALS: void dpmsAnnounced(); - private Q_SLOTS: void initTestCase(); @@ -91,16 +89,15 @@ void TestDpmsClient::initTestCase() m_registry = new KWayland::Client::Registry; m_registry->create(m_connection); - QObject::connect(m_registry, &Registry::interfacesAnnounced, this, - [this] { - const bool hasDpms = m_registry->hasInterface(Registry::Interface::Dpms); - if (hasDpms) { - qDebug() << QStringLiteral("Compositor provides a DpmsManager"); - } else { - qDebug() << QStringLiteral("Compositor does not provid a DpmsManager"); - } - emit this->dpmsAnnounced(); - }); + QObject::connect(m_registry, &Registry::interfacesAnnounced, this, [this] { + const bool hasDpms = m_registry->hasInterface(Registry::Interface::Dpms); + if (hasDpms) { + qDebug() << QStringLiteral("Compositor provides a DpmsManager"); + } else { + qDebug() << QStringLiteral("Compositor does not provid a DpmsManager"); + } + emit this->dpmsAnnounced(); + }); m_registry->setup(); QVERIFY(dpmsSpy.wait(100)); @@ -120,7 +117,6 @@ void TestDpmsClient::testDpmsConnect() QVERIFY(m_registry->isValid()); } - QTEST_GUILESS_MAIN(TestDpmsClient) #include "testkwaylanddpms.moc"
  48. Download patch tests/kwayland/waylandconfigreader.cpp
  49. Download patch src/mode.h

    --- 4:5.20.5-1/src/mode.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/mode.h 2021-01-21 12:52:36.000000000 +0000 @@ -23,13 +23,13 @@ #include "kscreen_export.h" #include "types.h" +#include <QDebug> +#include <QMetaType> #include <QObject> #include <QSize> -#include <QMetaType> -#include <QDebug> - -namespace KScreen { +namespace KScreen +{ class KSCREEN_EXPORT Mode : public QObject { Q_OBJECT @@ -38,40 +38,40 @@ class KSCREEN_EXPORT Mode : public QObje Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY modeChanged) Q_PROPERTY(float refreshRate READ refreshRate WRITE setRefreshRate NOTIFY modeChanged) - public: - explicit Mode(); - ~Mode() override; +public: + explicit Mode(); + ~Mode() override; - ModePtr clone() const; + ModePtr clone() const; - const QString id() const; - void setId(const QString &id); + const QString id() const; + void setId(const QString &id); - QString name() const; - void setName(const QString& name); + QString name() const; + void setName(const QString &name); - QSize size() const; - void setSize(const QSize& size); + QSize size() const; + void setSize(const QSize &size); - float refreshRate() const; - void setRefreshRate(float refresh); + float refreshRate() const; + void setRefreshRate(float refresh); - Q_SIGNALS: - void modeChanged(); +Q_SIGNALS: + void modeChanged(); - private: - Q_DISABLE_COPY(Mode) +private: + Q_DISABLE_COPY(Mode) - class Private; - Private * const d; + class Private; + Private *const d; - Mode(Private *dd); + Mode(Private *dd); }; -} //KSCreen namespace +} // KSCreen namespace KSCREEN_EXPORT QDebug operator<<(QDebug dbg, const KScreen::ModePtr &mode); Q_DECLARE_METATYPE(KScreen::ModeList) -#endif //MODE_H +#endif // MODE_H
  50. Download patch autotests/testscreenconfig.cpp

    --- 4:5.20.5-1/autotests/testscreenconfig.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/autotests/testscreenconfig.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -16,16 +16,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *************************************************************************************/ -#include <QtTest> #include <QObject> +#include <QtTest> -#include "../src/screen.h" +#include "../src/backendmanager_p.h" #include "../src/config.h" -#include "../src/output.h" -#include "../src/mode.h" #include "../src/getconfigoperation.h" +#include "../src/mode.h" +#include "../src/output.h" +#include "../src/screen.h" #include "../src/setconfigoperation.h" -#include "../src/backendmanager_p.h" using namespace KScreen; @@ -64,7 +64,6 @@ ConfigPtr testScreenConfig::getConfig() return op->config(); } - void testScreenConfig::initTestCase() { qputenv("KSCREEN_LOGGING", "false"); @@ -78,14 +77,12 @@ void testScreenConfig::cleanupTestCase() void testScreenConfig::singleOutput() { - //json file for the fake backend + // json file for the fake backend qputenv("KSCREEN_BACKEND_ARGS", "TEST_DATA=" TEST_DATA "singleoutput.json"); -// QVERIFY2(kscreen, KScreen::errorString().toLatin1()); - -// QVERIFY2(!kscreen->backend().isEmpty(), "No backend loaded"); - + // QVERIFY2(kscreen, KScreen::errorString().toLatin1()); + // QVERIFY2(!kscreen->backend().isEmpty(), "No backend loaded"); const ConfigPtr config = getConfig(); QVERIFY(!config.isNull()); @@ -105,7 +102,7 @@ void testScreenConfig::singleOutput() QCOMPARE(output->type(), Output::Panel); QCOMPARE(output->modes().count(), 3); QCOMPARE(output->pos(), QPoint(0, 0)); - QCOMPARE(output->geometry(), QRect(0,0, 1280, 800)); + QCOMPARE(output->geometry(), QRect(0, 0, 1280, 800)); QCOMPARE(output->currentModeId(), QLatin1String("3")); QCOMPARE(output->preferredModeId(), QLatin1String("3")); QCOMPARE(output->rotation(), Output::None); @@ -113,7 +110,7 @@ void testScreenConfig::singleOutput() QCOMPARE(output->isConnected(), true); QCOMPARE(output->isEnabled(), true); QCOMPARE(output->isPrimary(), true); - //QCOMPARE(output->isEmbedded(), true); + // QCOMPARE(output->isEmbedded(), true); QVERIFY2(output->clones().isEmpty(), "In singleOutput is impossible to have clones"); const ModePtr mode = output->currentMode(); @@ -221,7 +218,6 @@ void testScreenConfig::configCanBeApplie qDebug() << "brokenConfig.modes" << primaryBroken->mode(QStringLiteral("3")); QVERIFY(Config::canBeApplied(brokenConfig)); - qputenv("KSCREEN_BACKEND_ARGS", "TEST_DATA=" TEST_DATA "tooManyOutputs.json"); const ConfigPtr brokenConfig2 = getConfig(); QVERIFY(!brokenConfig2.isNull()); @@ -320,7 +316,6 @@ void testScreenConfig::testOutputPositio QCOMPARE(right->pos(), QPoint()); } - QTEST_MAIN(testScreenConfig) #include "testscreenconfig.moc"
  51. Download patch src/setconfigoperation.cpp

    --- 4:5.20.5-1/src/setconfigoperation.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/setconfigoperation.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -21,28 +21,27 @@ #include "abstractbackend.h" #include "backendmanager_p.h" -#include "configoperation_p.h" #include "config.h" +#include "configoperation_p.h" #include "configserializer_p.h" #include "kscreen_debug.h" #include "output.h" -#include <QDBusPendingCallWatcher> #include <QDBusPendingCall> +#include <QDBusPendingCallWatcher> using namespace KScreen; namespace KScreen { - class SetConfigOperationPrivate : public ConfigOperationPrivate { Q_OBJECT public: - explicit SetConfigOperationPrivate(const KScreen::ConfigPtr &config, ConfigOperation* qq); + explicit SetConfigOperationPrivate(const KScreen::ConfigPtr &config, ConfigOperation *qq); - void backendReady(org::kde::kscreen::Backend* backend) override; + void backendReady(org::kde::kscreen::Backend *backend) override; void onConfigSet(QDBusPendingCallWatcher *watcher); void normalizeOutputPositions(); @@ -54,13 +53,13 @@ private: } -SetConfigOperationPrivate::SetConfigOperationPrivate(const ConfigPtr &config, ConfigOperation* qq) +SetConfigOperationPrivate::SetConfigOperationPrivate(const ConfigPtr &config, ConfigOperation *qq) : ConfigOperationPrivate(qq) , config(config) { } -void SetConfigOperationPrivate::backendReady(org::kde::kscreen::Backend* backend) +void SetConfigOperationPrivate::backendReady(org::kde::kscreen::Backend *backend) { ConfigOperationPrivate::backendReady(backend); @@ -80,8 +79,7 @@ void SetConfigOperationPrivate::backendR } QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(backend->setConfig(map), this); - connect(watcher, &QDBusPendingCallWatcher::finished, - this, &SetConfigOperationPrivate::onConfigSet); + connect(watcher, &QDBusPendingCallWatcher::finished, this, &SetConfigOperationPrivate::onConfigSet); } void SetConfigOperationPrivate::onConfigSet(QDBusPendingCallWatcher *watcher) @@ -105,7 +103,7 @@ void SetConfigOperationPrivate::onConfig q->emitResult(); } -SetConfigOperation::SetConfigOperation(const ConfigPtr &config, QObject* parent) +SetConfigOperation::SetConfigOperation(const ConfigPtr &config, QObject *parent) : ConfigOperation(new SetConfigOperationPrivate(config, this), parent) { }
  52. Download patch src/edid.cpp
  53. Download patch backends/qscreen/qscreenbackend.cpp

    --- 4:5.20.5-1/backends/qscreen/qscreenbackend.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/qscreen/qscreenbackend.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -34,8 +34,7 @@ QScreenBackend::QScreenBackend() { if (s_internalConfig == nullptr) { s_internalConfig = new QScreenConfig(); - connect(s_internalConfig, &QScreenConfig::configChanged, - this, &QScreenBackend::configChanged); + connect(s_internalConfig, &QScreenConfig::configChanged, this, &QScreenBackend::configChanged); } } @@ -53,7 +52,6 @@ QString QScreenBackend::serviceName() co return QStringLiteral("org.kde.KScreen.Backend.QScreen"); } - ConfigPtr QScreenBackend::config() const { return s_internalConfig->toKScreenConfig();
  54. Download patch src/doctor/doctor.cpp

    --- 4:5.20.5-1/src/doctor/doctor.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/doctor/doctor.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -19,14 +19,14 @@ #include "doctor.h" #include "dpmsclient.h" -#include <QCoreApplication> #include <QCommandLineParser> +#include <QCoreApplication> #include <QDateTime> +#include <QFile> #include <QGuiApplication> #include <QJsonArray> #include <QJsonDocument> #include <QJsonObject> -#include <QFile> #include <QLoggingCategory> #include <QRect> #include <QStandardPaths> @@ -34,15 +34,14 @@ #include "../backendmanager_p.h" #include "../config.h" #include "../configoperation.h" -#include "../getconfigoperation.h" -#include "../setconfigoperation.h" #include "../edid.h" +#include "../getconfigoperation.h" #include "../log.h" #include "../output.h" +#include "../setconfigoperation.h" Q_LOGGING_CATEGORY(KSCREEN_DOCTOR, "kscreen.doctor") - static QTextStream cout(stdout); static QTextStream cerr(stderr); @@ -83,12 +82,10 @@ void Doctor::start(QCommandLineParser *p showBackends(); } if (parser->isSet(QStringLiteral("json")) || parser->isSet(QStringLiteral("outputs")) || !m_positionalArgs.isEmpty()) { - KScreen::GetConfigOperation *op = new KScreen::GetConfigOperation(); - connect(op, &KScreen::GetConfigOperation::finished, this, - [this](KScreen::ConfigOperation *op) { - configReceived(op); - }); + connect(op, &KScreen::GetConfigOperation::finished, this, [this](KScreen::ConfigOperation *op) { + configReceived(op); + }); return; } if (m_parser->isSet(QStringLiteral("dpms"))) { @@ -97,9 +94,14 @@ void Doctor::start(QCommandLineParser *p // We need to kick the event loop, otherwise .quit() hangs QTimer::singleShot(0, qApp->quit); return; - } + m_dpmsClient = new DpmsClient(this); + if (m_parser->isSet(QStringLiteral("dpms-excluded"))) { + const auto excludedConnectors = m_parser->values(QStringLiteral("dpms-excluded")); + m_dpmsClient->setExcludedOutputNames(excludedConnectors); + } + connect(m_dpmsClient, &DpmsClient::finished, qApp, &QCoreApplication::quit); const QString dpmsArg = m_parser->value(QStringLiteral("dpms")); @@ -112,7 +114,6 @@ void Doctor::start(QCommandLineParser *p } if (m_parser->isSet(QStringLiteral("log"))) { - const QString logmsg = m_parser->value(QStringLiteral("log")); if (!Log::instance()->enabled()) { qCWarning(KSCREEN_DOCTOR) << "Logging is disabled, unset KSCREEN_LOGGING in your environment."; @@ -124,7 +125,7 @@ void Doctor::start(QCommandLineParser *p QTimer::singleShot(0, qApp->quit); } -void KScreen::Doctor::setDpms(const QString& dpmsArg) +void KScreen::Doctor::setDpms(const QString &dpmsArg) { qDebug() << "SetDpms: " << dpmsArg; connect(m_dpmsClient, &DpmsClient::ready, this, [this, dpmsArg]() { @@ -141,7 +142,6 @@ void KScreen::Doctor::setDpms(const QStr m_dpmsClient->connect(); } - void Doctor::showDpms() { m_dpmsClient = new DpmsClient(this); @@ -158,7 +158,8 @@ void Doctor::showBackends() const cout << "Environment: " << endl; auto env_kscreen_backend = (qgetenv("KSCREEN_BACKEND").isEmpty()) ? QStringLiteral("[not set]") : QString::fromUtf8(qgetenv("KSCREEN_BACKEND")); cout << " * KSCREEN_BACKEND : " << env_kscreen_backend << endl; - auto env_kscreen_backend_inprocess = (qgetenv("KSCREEN_BACKEND_INPROCESS").isEmpty()) ? QStringLiteral("[not set]") : QString::fromUtf8(qgetenv("KSCREEN_BACKEND_INPROCESS")); + auto env_kscreen_backend_inprocess = + (qgetenv("KSCREEN_BACKEND_INPROCESS").isEmpty()) ? QStringLiteral("[not set]") : QString::fromUtf8(qgetenv("KSCREEN_BACKEND_INPROCESS")); cout << " * KSCREEN_BACKEND_INPROCESS : " << env_kscreen_backend_inprocess << endl; auto env_kscreen_logging = (qgetenv("KSCREEN_LOGGING").isEmpty()) ? QStringLiteral("[not set]") : QString::fromUtf8(qgetenv("KSCREEN_LOGGING")); cout << " * KSCREEN_LOGGING : " << env_kscreen_logging << endl; @@ -168,7 +169,7 @@ void Doctor::showBackends() const auto preferred = BackendManager::instance()->preferredBackend(); cout << "Preferred KScreen backend : " << green << preferred.fileName() << cr << endl; cout << "Available KScreen backends:" << endl; - Q_FOREACH(const QFileInfo f, backends) { + Q_FOREACH (const QFileInfo f, backends) { auto c = blue; if (preferred == f) { c = green; @@ -185,8 +186,8 @@ void Doctor::setOptionList(const QString void Doctor::parsePositionalArgs() { - //qCDebug(KSCREEN_DOCTOR) << "POSARGS" << m_positionalArgs; - Q_FOREACH(const QString &op, m_positionalArgs) { + // qCDebug(KSCREEN_DOCTOR) << "POSARGS" << m_positionalArgs; + Q_FOREACH (const QString &op, m_positionalArgs) { auto ops = op.split(QLatin1Char('.')); if (ops.count() > 2) { bool ok; @@ -261,13 +262,11 @@ void Doctor::parsePositionalArgs() } else if ((ops.count() == 4) && (ops[2] == QLatin1String("orientation") || ops[2] == QStringLiteral("rotation"))) { const QString _rotation = ops[3].toLower(); bool ok = false; - const QHash<QString, KScreen::Output::Rotation> rotationMap({ - {QStringLiteral("none"), KScreen::Output::None}, - {QStringLiteral("normal"), KScreen::Output::None}, - {QStringLiteral("left"), KScreen::Output::Left}, - {QStringLiteral("right"), KScreen::Output::Right}, - {QStringLiteral("inverted"), KScreen::Output::Inverted} - }); + const QHash<QString, KScreen::Output::Rotation> rotationMap({{QStringLiteral("none"), KScreen::Output::None}, + {QStringLiteral("normal"), KScreen::Output::None}, + {QStringLiteral("left"), KScreen::Output::Left}, + {QStringLiteral("right"), KScreen::Output::Right}, + {QStringLiteral("inverted"), KScreen::Output::Inverted}}); KScreen::Output::Rotation rot = KScreen::Output::None; // set orientation if (rotationMap.contains(_rotation)) { @@ -352,9 +351,8 @@ void Doctor::showOutputs() const cout << " " << yellow << (_type.isEmpty() ? QStringLiteral("UnmappedOutputType") : _type); cout << blue << " Modes: " << cr; Q_FOREACH (auto mode, output->modes()) { - auto name = QStringLiteral("%1x%2@%3").arg(QString::number(mode->size().width()), - QString::number(mode->size().height()), - QString::number(qRound(mode->refreshRate()))); + auto name = QStringLiteral("%1x%2@%3") + .arg(QString::number(mode->size().width()), QString::number(mode->size().height()), QString::number(qRound(mode->refreshRate()))); if (mode == output->currentMode()) { name = green + name + QLatin1Char('*') + cr; } @@ -430,9 +428,9 @@ bool Doctor::setMode(int id, const QStri if (output->id() == id) { // find mode Q_FOREACH (const KScreen::ModePtr mode, output->modes()) { - auto name = QStringLiteral("%1x%2@%3").arg(QString::number(mode->size().width()), - QString::number(mode->size().height()), - QString::number(qRound(mode->refreshRate()))); + auto name = + QStringLiteral("%1x%2@%3") + .arg(QString::number(mode->size().width()), QString::number(mode->size().height()), QString::number(qRound(mode->refreshRate()))); if (mode->id() == mode_id || name == mode_id) { qCDebug(KSCREEN_DOCTOR) << "Taddaaa! Found mode" << mode->id() << name; output->setCurrentModeId(mode->id());
  55. Download patch backends/qscreen/qscreenscreen.h

    --- 4:5.20.5-1/backends/qscreen/qscreenscreen.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/qscreen/qscreenscreen.h 2021-01-21 12:52:36.000000000 +0000 @@ -22,9 +22,9 @@ #include "config.h" #include "screen.h" +#include <QLoggingCategory> #include <QScreen> #include <QSize> -#include <QLoggingCategory> namespace KScreen {
  56. Download patch backends/kwayland/waylandconfig.h

    --- 4:5.20.5-1/backends/kwayland/waylandconfig.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/kwayland/waylandconfig.h 2021-01-21 12:52:36.000000000 +0000 @@ -23,8 +23,8 @@ #include <QDir> #include <QEventLoop> #include <QLoggingCategory> -#include <QSize> #include <QScreen> +#include <QSize> #include <QSocketNotifier> #include <QThread> @@ -57,7 +57,7 @@ class WaylandScreen; * received, signalled by the initialized() signal. This means that the * wayland client has received information about all interfaces, and that all * outputs are completely initialized. From then on, we properly notifyUpdate(). -*/ + */ class WaylandConfig : public QObject { Q_OBJECT @@ -67,7 +67,7 @@ public: ~WaylandConfig() override; KScreen::ConfigPtr currentConfig(); - QMap<int, WaylandOutput*> outputMap() const; + QMap<int, WaylandOutput *> outputMap() const; void applyConfig(const KScreen::ConfigPtr &newConfig); @@ -100,10 +100,10 @@ private: KWayland::Client::OutputManagement *m_outputManagement; // KWayland names as keys - QMap<int, WaylandOutput*> m_outputMap; + QMap<int, WaylandOutput *> m_outputMap; // KWayland names - QList<WaylandOutput*> m_initializingOutputs; + QList<WaylandOutput *> m_initializingOutputs; int m_lastOutputId = -1; bool m_registryInitialized;
  57. Download patch src/setconfigoperation.h

    --- 4:5.20.5-1/src/setconfigoperation.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/setconfigoperation.h 2021-01-21 12:52:36.000000000 +0000 @@ -21,18 +21,18 @@ #define KSCREEN_SETCONFIGOPERATION_H #include "configoperation.h" -#include "types.h" #include "kscreen_export.h" +#include "types.h" -namespace KScreen { - +namespace KScreen +{ class SetConfigOperationPrivate; class KSCREEN_EXPORT SetConfigOperation : public KScreen::ConfigOperation { Q_OBJECT public: - explicit SetConfigOperation(const KScreen::ConfigPtr &config, QObject* parent = nullptr); + explicit SetConfigOperation(const KScreen::ConfigPtr &config, QObject *parent = nullptr); ~SetConfigOperation() override; KScreen::ConfigPtr config() const override;
  58. Download patch src/backendlauncher/backenddbuswrapper.h

    --- 4:5.20.5-1/src/backendlauncher/backenddbuswrapper.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/backendlauncher/backenddbuswrapper.h 2021-01-21 12:52:36.000000000 +0000 @@ -45,7 +45,10 @@ public: QVariantMap setConfig(const QVariantMap &config); QByteArray getEdid(int output) const; - inline KScreen::AbstractBackend *backend() const { return mBackend; } + inline KScreen::AbstractBackend *backend() const + { + return mBackend; + } Q_SIGNALS: void configChanged(const QVariantMap &config); @@ -54,12 +57,10 @@ private Q_SLOTS: void backendConfigChanged(const KScreen::ConfigPtr &config); void doEmitConfigChanged(); - private: KScreen::AbstractBackend *mBackend = nullptr; QTimer mChangeCollector; KScreen::ConfigPtr mCurrentConfig; - }; #endif // BACKENDDBUSWRAPPER_H
  59. Download patch src/configmonitor.h

    --- 4:5.20.5-1/src/configmonitor.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/configmonitor.h 2021-01-21 12:52:36.000000000 +0000 @@ -27,7 +27,6 @@ namespace KScreen { - class AbstractBackend; class BackendManager; @@ -36,7 +35,7 @@ class KSCREEN_EXPORT ConfigMonitor : pub Q_OBJECT public: - static ConfigMonitor* instance(); + static ConfigMonitor *instance(); void addConfig(const KScreen::ConfigPtr &config); void removeConfig(const KScreen::ConfigPtr &config); @@ -54,8 +53,7 @@ private: void connectInProcessBackend(KScreen::AbstractBackend *backend); class Private; - Private * const d; - + Private *const d; }; } /* namespace KScreen */
  60. Download patch backends/kwayland/waylandoutput.cpp

    --- 4:5.20.5-1/backends/kwayland/waylandoutput.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/kwayland/waylandoutput.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -16,12 +16,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *************************************************************************************/ #include "waylandoutput.h" +#include "../utils.h" #include "waylandbackend.h" #include "waylandconfig.h" -#include "../utils.h" -#include <mode.h> #include <edid.h> +#include <mode.h> #include <KWayland/Client/outputconfiguration.h> #include <KWayland/Client/outputdevice.h> @@ -29,22 +29,19 @@ using namespace KScreen; namespace Wl = KWayland::Client; -const QMap<Wl::OutputDevice::Transform, Output::Rotation> -s_rotationMap = { - {Wl::OutputDevice::Transform::Normal, Output::None}, - {Wl::OutputDevice::Transform::Rotated90, Output::Right}, - {Wl::OutputDevice::Transform::Rotated180, Output::Inverted}, - {Wl::OutputDevice::Transform::Rotated270, Output::Left}, - {Wl::OutputDevice::Transform::Flipped, Output::None}, - {Wl::OutputDevice::Transform::Flipped90, Output::Right}, - {Wl::OutputDevice::Transform::Flipped180, Output::Inverted}, - {Wl::OutputDevice::Transform::Flipped270, Output::Left} -}; +const QMap<Wl::OutputDevice::Transform, Output::Rotation> s_rotationMap = // + {{Wl::OutputDevice::Transform::Normal, Output::None}, + {Wl::OutputDevice::Transform::Rotated90, Output::Right}, + {Wl::OutputDevice::Transform::Rotated180, Output::Inverted}, + {Wl::OutputDevice::Transform::Rotated270, Output::Left}, + {Wl::OutputDevice::Transform::Flipped, Output::None}, + {Wl::OutputDevice::Transform::Flipped90, Output::Right}, + {Wl::OutputDevice::Transform::Flipped180, Output::Inverted}, + {Wl::OutputDevice::Transform::Flipped270, Output::Left}}; Output::Rotation toKScreenRotation(const Wl::OutputDevice::Transform transform) { - auto it = s_rotationMap.constFind(transform); - return it.value(); + return s_rotationMap.value(transform); } Wl::OutputDevice::Transform toKWaylandTransform(const Output::Rotation rotation) @@ -70,7 +67,7 @@ bool WaylandOutput::enabled() const return m_device != nullptr; } -Wl::OutputDevice* WaylandOutput::outputDevice() const +Wl::OutputDevice *WaylandOutput::outputDevice() const { return m_device; } @@ -82,8 +79,8 @@ void WaylandOutput::createOutputDevice(W connect(m_device, &Wl::OutputDevice::removed, this, &WaylandOutput::deviceRemoved); connect(m_device, &Wl::OutputDevice::done, this, [this]() { - Q_EMIT complete(); - connect(m_device, &Wl::OutputDevice::changed, this, &WaylandOutput::changed); + Q_EMIT complete(); + connect(m_device, &Wl::OutputDevice::changed, this, &WaylandOutput::changed); }); } @@ -106,20 +103,23 @@ void WaylandOutput::updateKScreenOutput( output->setSizeMm(m_device->physicalSize()); output->setPos(m_device->globalPosition()); output->setRotation(s_rotationMap[m_device->transform()]); + if (!output->edid()) { + output->setEdid(m_device->edid()); + } ModeList modeList; QStringList preferredModeIds; m_modeIdMap.clear(); QString currentModeId = QStringLiteral("-1"); + QSize currentSize; for (const Wl::OutputDevice::Mode &wlMode : m_device->modes()) { ModePtr mode(new Mode()); const QString name = modeName(wlMode); QString modeId = QString::number(wlMode.id); if (modeId.isEmpty()) { - qCDebug(KSCREEN_WAYLAND) << "Could not create mode id from" - << wlMode.id << ", using" << name << "instead."; + qCDebug(KSCREEN_WAYLAND) << "Could not create mode id from" << wlMode.id << ", using" << name << "instead."; modeId = name; } @@ -134,6 +134,7 @@ void WaylandOutput::updateKScreenOutput( mode->setName(name); if (wlMode.flags.testFlag(Wl::OutputDevice::Mode::Flag::Current)) { + currentSize = wlMode.size; currentModeId = modeId; } if (wlMode.flags.testFlag(Wl::OutputDevice::Mode::Flag::Preferred)) { @@ -150,6 +151,7 @@ void WaylandOutput::updateKScreenOutput( qCWarning(KSCREEN_WAYLAND) << "Could not find the current mode id" << modeList; } + output->setSize(output->isHorizontal() ? currentSize : currentSize.transposed()); output->setCurrentModeId(currentModeId); output->setPreferredModes(preferredModeIds); output->setModes(modeList); @@ -157,17 +159,14 @@ void WaylandOutput::updateKScreenOutput( output->setType(Utils::guessOutputType(m_device->model(), m_device->model())); } -bool WaylandOutput::setWlConfig(Wl::OutputConfiguration *wlConfig, - const KScreen::OutputPtr &output) +bool WaylandOutput::setWlConfig(Wl::OutputConfiguration *wlConfig, const KScreen::OutputPtr &output) { bool changed = false; // enabled? - if ((m_device->enabled() == Wl::OutputDevice::Enablement::Enabled) - != output->isEnabled()) { + if ((m_device->enabled() == Wl::OutputDevice::Enablement::Enabled) != output->isEnabled()) { changed = true; - const auto enablement = output->isEnabled() ? Wl::OutputDevice::Enablement::Enabled : - Wl::OutputDevice::Enablement::Disabled; + const auto enablement = output->isEnabled() ? Wl::OutputDevice::Enablement::Enabled : Wl::OutputDevice::Enablement::Disabled; wlConfig->setEnabled(m_device, enablement); } @@ -197,17 +196,15 @@ bool WaylandOutput::setWlConfig(Wl::Outp wlConfig->setMode(m_device, newModeId); } } else { - qCWarning(KSCREEN_WAYLAND) << "Invalid kscreen mode id:" << output->currentModeId() - << "\n\n" << m_modeIdMap; + qCWarning(KSCREEN_WAYLAND) << "Invalid kscreen mode id:" << output->currentModeId() << "\n\n" << m_modeIdMap; } return changed; } QString WaylandOutput::modeName(const Wl::OutputDevice::Mode &m) const { - return QString::number(m.size.width()) + QLatin1Char('x') + - QString::number(m.size.height()) + QLatin1Char('@') + - QString::number(qRound(m.refreshRate/1000.0)); + return QString::number(m.size.width()) + QLatin1Char('x') + QString::number(m.size.height()) + QLatin1Char('@') + + QString::number(qRound(m.refreshRate / 1000.0)); } QString WaylandOutput::name() const @@ -218,8 +215,7 @@ QString WaylandOutput::name() const QDebug operator<<(QDebug dbg, const WaylandOutput *output) { - dbg << "WaylandOutput(Id:" << output->id() <<", Name:" << \ - QString(output->outputDevice()->manufacturer() + QLatin1Char(' ') + \ - output->outputDevice()->model()) << ")"; + dbg << "WaylandOutput(Id:" << output->id() + << ", Name:" << QString(output->outputDevice()->manufacturer() + QLatin1Char(' ') + output->outputDevice()->model()) << ")"; return dbg; }
  61. Download patch autotests/testmodelistchange.cpp

    --- 4:5.20.5-1/autotests/testmodelistchange.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/autotests/testmodelistchange.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -16,20 +16,19 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *************************************************************************************/ -#include <QtTest> #include <QObject> +#include <QtTest> +#include "../src/backendmanager_p.h" #include "../src/config.h" #include "../src/configmonitor.h" -#include "../src/output.h" -#include "../src/mode.h" #include "../src/getconfigoperation.h" +#include "../src/mode.h" +#include "../src/output.h" #include "../src/setconfigoperation.h" -#include "../src/backendmanager_p.h" using namespace KScreen; - class TestModeListChange : public QObject { Q_OBJECT @@ -70,7 +69,6 @@ ConfigPtr TestModeListChange::getConfig( KScreen::ModeList TestModeListChange::createModeList() { - KScreen::ModeList newmodes; { QString _id = QString::number(11); @@ -102,7 +100,6 @@ KScreen::ModeList TestModeListChange::cr return newmodes; } - void TestModeListChange::initTestCase() { qputenv("KSCREEN_LOGGING", "false"); @@ -116,7 +113,7 @@ void TestModeListChange::cleanupTestCase void TestModeListChange::modeListChange() { - //json file for the fake backend + // json file for the fake backend qputenv("KSCREEN_BACKEND_ARGS", "TEST_DATA=" TEST_DATA "singleoutput.json"); const ConfigPtr config = getConfig(); @@ -173,7 +170,6 @@ void TestModeListChange::modeListChange( QCOMPARE(outputChangedSpy.count(), modesChangedSpy.count()); } - QTEST_MAIN(TestModeListChange) #include "testmodelistchange.moc"
  62. Download patch debian/patches/series

    --- 4:5.20.5-1/debian/patches/series 2020-03-23 02:22:07.000000000 +0000 +++ 4:5.20.90-0ubuntu1/debian/patches/series 2021-01-21 23:45:12.000000000 +0000 @@ -1 +1 @@ -Make-kwayland-optional.patch +#Make-kwayland-optional.patch
  63. Download patch backends/qscreen/qscreenconfig.cpp

    --- 4:5.20.5-1/backends/qscreen/qscreenconfig.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/qscreen/qscreenconfig.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -17,14 +17,14 @@ *************************************************************************************/ #include "qscreenconfig.h" +#include "qscreenbackend.h" #include "qscreenoutput.h" #include "qscreenscreen.h" -#include "qscreenbackend.h" #include <mode.h> -#include <QRect> #include <QGuiApplication> +#include <QRect> #include <QScreen> using namespace KScreen; @@ -34,7 +34,7 @@ QScreenConfig::QScreenConfig(QObject *pa , m_screen(new QScreenScreen(this)) , m_blockSignals(true) { - foreach(const QScreen * qscreen, QGuiApplication::screens()) { + foreach (const QScreen *qscreen, QGuiApplication::screens()) { screenAdded(qscreen); } m_blockSignals = false; @@ -58,7 +58,7 @@ ConfigPtr QScreenConfig::toKScreenConfig int QScreenConfig::outputId(const QScreen *qscreen) { QList<int> ids; - foreach(auto output, m_outputMap) { + foreach (auto output, m_outputMap) { if (qscreen == output->qscreen()) { return output->id(); } @@ -84,7 +84,7 @@ void QScreenConfig::screenRemoved(QScree qCDebug(KSCREEN_QSCREEN) << "Screen removed" << qscreen << QGuiApplication::screens().count(); // Find output matching the QScreen object and remove it int removedOutputId = -1; - foreach(auto output, m_outputMap) { + foreach (auto output, m_outputMap) { if (output->qscreen() == qscreen) { removedOutputId = output->id(); m_outputMap.remove(removedOutputId); @@ -100,9 +100,9 @@ void QScreenConfig::updateKScreenConfig( m_screen->updateKScreenScreen(screen); config->setScreen(screen); - //Removing removed outputs + // Removing removed outputs KScreen::OutputList outputs = config->outputs(); - Q_FOREACH(const KScreen::OutputPtr &output, outputs) { + Q_FOREACH (const KScreen::OutputPtr &output, outputs) { if (!m_outputMap.contains(output->id())) { config->removeOutput(output->id()); } @@ -110,7 +110,7 @@ void QScreenConfig::updateKScreenConfig( // Add KScreen::Outputs that aren't in the list yet, handle primaryOutput KScreen::OutputList kscreenOutputs = config->outputs(); - foreach(QScreenOutput *output, m_outputMap) { + foreach (QScreenOutput *output, m_outputMap) { KScreen::OutputPtr kscreenOutput = kscreenOutputs[output->id()]; if (!kscreenOutput) { @@ -125,7 +125,7 @@ void QScreenConfig::updateKScreenConfig( config->setOutputs(kscreenOutputs); } -QMap< int, QScreenOutput * > QScreenConfig::outputMap() const +QMap<int, QScreenOutput *> QScreenConfig::outputMap() const { return m_outputMap; }
  64. Download patch autotests/testqscreenbackend.cpp

    --- 4:5.20.5-1/autotests/testqscreenbackend.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/autotests/testqscreenbackend.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -17,16 +17,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *************************************************************************************/ -#include <QtTest> -#include <QObject> #include <QElapsedTimer> +#include <QObject> +#include <QtTest> +#include "../src/backendmanager_p.h" #include "../src/config.h" -#include "../src/output.h" -#include "../src/mode.h" #include "../src/edid.h" #include "../src/getconfigoperation.h" -#include "../src/backendmanager_p.h" +#include "../src/mode.h" +#include "../src/output.h" Q_LOGGING_CATEGORY(KSCREEN_QSCREEN, "kscreen.qscreen") @@ -93,7 +93,6 @@ void testQScreenBackend::verifyScreen() QVERIFY(m_config->screen()->maxActiveOutputsCount() > 0); } - void testQScreenBackend::verifyOutputs() { bool primaryFound = false; @@ -111,9 +110,8 @@ void testQScreenBackend::verifyOutputs() const KScreen::OutputPtr primary = m_config->primaryOutput(); QVERIFY(primary->isEnabled()); QVERIFY(primary->isConnected()); - //qDebug() << "Primary geometry? " << primary->geometry(); - //qDebug() << " prim modes: " << primary->modes(); - + // qDebug() << "Primary geometry? " << primary->geometry(); + // qDebug() << " prim modes: " << primary->modes(); QList<int> ids; foreach (const KScreen::OutputPtr &output, m_config->outputs()) { @@ -127,7 +125,7 @@ void testQScreenBackend::verifyOutputs() QVERIFY(output->id() > -1); QVERIFY(output->isConnected()); QVERIFY(output->isEnabled()); - QVERIFY(output->geometry() != QRectF(1,1,1,1)); + QVERIFY(output->geometry() != QRectF(1, 1, 1, 1)); QVERIFY(output->geometry() != QRectF()); // Pass, but leave a note, when the x server doesn't report physical size @@ -166,7 +164,7 @@ void testQScreenBackend::commonUsagePatt const KScreen::OutputList outputs = op->config()->outputs(); QVariantList outputList; - Q_FOREACH(const KScreen::OutputPtr &output, outputs) { + Q_FOREACH (const KScreen::OutputPtr &output, outputs) { if (!output->isConnected()) { continue; } @@ -185,7 +183,7 @@ void testQScreenBackend::commonUsagePatt if (output->isEnabled()) { const KScreen::ModePtr mode = output->currentMode(); if (!mode) { - //qWarning() << "CurrentMode is null" << output->name(); + // qWarning() << "CurrentMode is null" << output->name(); return; } @@ -220,7 +218,6 @@ void testQScreenBackend::verifyFeatures( QVERIFY(!config->supportedFeatures().testFlag(Config::Feature::PrimaryDisplay)); } - QTEST_MAIN(testQScreenBackend) #include "testqscreenbackend.moc"
  65. Download patch autotests/testkwaylandbackend.cpp

    --- 4:5.20.5-1/autotests/testkwaylandbackend.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/autotests/testkwaylandbackend.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -18,17 +18,17 @@ #include <QCoreApplication> #include <QCryptographicHash> -#include <QtTest> #include <QObject> +#include <QtTest> #include "../src/backendmanager_p.h" -#include "../src/getconfigoperation.h" -#include "../src/setconfigoperation.h" #include "../src/config.h" #include "../src/configmonitor.h" -#include "../src/output.h" -#include "../src/mode.h" #include "../src/edid.h" +#include "../src/getconfigoperation.h" +#include "../src/mode.h" +#include "../src/output.h" +#include "../src/setconfigoperation.h" // KWayland #include <KWayland/Server/display.h> @@ -63,7 +63,6 @@ private Q_SLOTS: void removeOutput(); void testEdid(); - private: ConfigPtr m_config; WaylandTestServer *m_server; @@ -133,7 +132,7 @@ void testWaylandBackend::verifyOutputs() primaryFound = true; } } - //qCDebug(KSCREEN_WAYLAND) << "Primary found? " << primaryFound << m_config->outputs(); + // qCDebug(KSCREEN_WAYLAND) << "Primary found? " << primaryFound << m_config->outputs(); QVERIFY(primaryFound); QVERIFY(m_config->outputs().count()); QCOMPARE(m_server->outputCount(), m_config->outputs().count()); @@ -147,7 +146,7 @@ void testWaylandBackend::verifyOutputs() QVERIFY(!output->name().isEmpty()); QVERIFY(output->id() > -1); QVERIFY(output->isConnected()); - QVERIFY(output->geometry() != QRectF(1,1,1,1)); + QVERIFY(output->geometry() != QRectF(1, 1, 1, 1)); QVERIFY(output->geometry() != QRectF()); QVERIFY(output->sizeMm() != QSize()); QVERIFY(output->edid() != nullptr); @@ -242,7 +241,7 @@ void testWaylandBackend::addOutput() m_serverOutputDevice->create(); QVERIFY(configSpy.wait()); - //QTRY_VERIFY(configSpy.count()); + // QTRY_VERIFY(configSpy.count()); GetConfigOperation *op2 = new GetConfigOperation(); op2->exec(); @@ -273,7 +272,10 @@ void testWaylandBackend::testEdid() { m_server->showOutputs(); - QByteArray data = QByteArray::fromBase64("AP///////wAQrBbwTExLQQ4WAQOANCB46h7Frk80sSYOUFSlSwCBgKlA0QBxTwEBAQEBAQEBKDyAoHCwI0AwIDYABkQhAAAaAAAA/wBGNTI1TTI0NUFLTEwKAAAA/ABERUxMIFUyNDEwCiAgAAAA/QA4TB5REQAKICAgICAgAToCAynxUJAFBAMCBxYBHxITFCAVEQYjCQcHZwMMABAAOC2DAQAA4wUDAQI6gBhxOC1AWCxFAAZEIQAAHgEdgBhxHBYgWCwlAAZEIQAAngEdAHJR0B4gbihVAAZEIQAAHowK0Iog4C0QED6WAAZEIQAAGAAAAAAAAAAAAAAAAAAAPg=="); + QByteArray data = QByteArray::fromBase64( + "AP///////wAQrBbwTExLQQ4WAQOANCB46h7Frk80sSYOUFSlSwCBgKlA0QBxTwEBAQEBAQEBKDyAoHCwI0AwIDYABkQhAAAaAAAA/wBGNTI1TTI0NUFLTEwKAAAA/ABERUxMIFUyNDEwCiAgAAAA/" + "QA4TB5REQAKICAgICAgAToCAynxUJAFBAMCBxYBHxITFCAVEQYjCQcHZwMMABAAOC2DAQAA4wUDAQI6gBhxOC1AWCxFAAZEIQAAHgEdgBhxHBYgWCwlAAZEIQAAngEdAHJR0B4gbihVAAZEIQAAHow" + "K0Iog4C0QED6WAAZEIQAAGAAAAAAAAAAAAAAAAAAAPg=="); QScopedPointer<Edid> edid(new Edid(data)); QVERIFY(edid->isValid()); @@ -311,7 +313,6 @@ void testWaylandBackend::verifyFeatures( QVERIFY(!config->supportedFeatures().testFlag(Config::Feature::PrimaryDisplay)); } - QTEST_GUILESS_MAIN(testWaylandBackend) #include "testkwaylandbackend.moc"
  66. Download patch src/configoperation.h

    --- 4:5.20.5-1/src/configoperation.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/configoperation.h 2021-01-21 12:52:36.000000000 +0000 @@ -26,8 +26,8 @@ #include "kscreen_export.h" #include "types.h" -namespace KScreen { - +namespace KScreen +{ class ConfigOperationPrivate; class KSCREEN_EXPORT ConfigOperation : public QObject @@ -37,7 +37,7 @@ class KSCREEN_EXPORT ConfigOperation : p public: enum Option { NoOptions, - NoEDID + NoEDID, }; Q_DECLARE_FLAGS(Options, Option) @@ -63,7 +63,7 @@ protected Q_SLOTS: virtual void start() = 0; protected: - ConfigOperationPrivate * const d_ptr; + ConfigOperationPrivate *const d_ptr; Q_DECLARE_PRIVATE(ConfigOperation) }; }
  67. Download patch backends/xrandr/xrandrconfig.cpp
  68. Download patch backends/xrandr/xrandrconfig.h

    --- 4:5.20.5-1/backends/xrandr/xrandrconfig.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/xrandr/xrandrconfig.h 2021-01-21 12:52:36.000000000 +0000 @@ -24,7 +24,8 @@ #include "xrandroutput.h" class XRandRScreen; -namespace KScreen { +namespace KScreen +{ class Config; }
  69. Download patch autotests/testxrandr.cpp

    --- 4:5.20.5-1/autotests/testxrandr.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/autotests/testxrandr.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -18,13 +18,13 @@ #define QT_GUI_LIB -#include <QtTest> #include <QObject> +#include <QtTest> #include "../src/config.h" -#include "../src/output.h" -#include "../src/mode.h" #include "../src/getconfigoperation.h" +#include "../src/mode.h" +#include "../src/output.h" using namespace KScreen;
  70. Download patch autotests/testlog.cpp

    --- 4:5.20.5-1/autotests/testlog.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/autotests/testlog.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -16,9 +16,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *************************************************************************************/ -#include <QtTest> -#include <QObject> #include <QLoggingCategory> +#include <QObject> +#include <QtTest> #include "../src/log.h" @@ -54,7 +54,6 @@ void TestLog::init() void TestLog::initTestCase() { - qputenv(KSCREEN_LOGGING, QByteArray("true")); }
  71. Download patch backends/kwayland/waylandbackend.h

    --- 4:5.20.5-1/backends/kwayland/waylandbackend.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/kwayland/waylandbackend.h 2021-01-21 12:52:36.000000000 +0000 @@ -25,7 +25,6 @@ namespace KScreen { - class WaylandConfig; class WaylandBackend : public KScreen::AbstractBackend
  72. Download patch backends/kwayland/waylandscreen.h

    --- 4:5.20.5-1/backends/kwayland/waylandscreen.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/kwayland/waylandscreen.h 2021-01-21 12:52:36.000000000 +0000 @@ -39,10 +39,7 @@ public: KScreen::ScreenPtr toKScreenScreen(KScreen::ConfigPtr &parent) const; void updateKScreenScreen(KScreen::ScreenPtr &screen) const; - void setOutputs(const QList<WaylandOutput*> &outputs); - - void setSize(const QSize &size); - void setOutputCount(int count); + void setOutputs(const QList<WaylandOutput *> &outputs); private: QSize m_size;
  73. Download patch src/getconfigoperation.h

    --- 4:5.20.5-1/src/getconfigoperation.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/getconfigoperation.h 2021-01-21 12:52:36.000000000 +0000 @@ -21,12 +21,11 @@ #define KSCREEN_GETCONFIGOPERATION_H #include "configoperation.h" -#include "types.h" #include "kscreen_export.h" +#include "types.h" - -namespace KScreen { - +namespace KScreen +{ class GetConfigOperationPrivate; class KSCREEN_EXPORT GetConfigOperation : public KScreen::ConfigOperation @@ -34,8 +33,7 @@ class KSCREEN_EXPORT GetConfigOperation Q_OBJECT public: - - explicit GetConfigOperation(Options options = NoOptions, QObject* parent = nullptr); + explicit GetConfigOperation(Options options = NoOptions, QObject *parent = nullptr); ~GetConfigOperation() override; KScreen::ConfigPtr config() const override;
  74. Download patch backends/xcbwrapper.cpp

    --- 4:5.20.5-1/backends/xcbwrapper.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/xcbwrapper.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -23,7 +23,7 @@ along with this program. If not, see <h static xcb_connection_t *sXRandR11XCBConnection = nullptr; -xcb_connection_t* XCB::connection() +xcb_connection_t *XCB::connection() { // Use our own connection to make sure that we won't mess up Qt's connection // if something goes wrong on our side. @@ -41,11 +41,9 @@ void XCB::closeConnection() } } -xcb_screen_t* XCB::screenOfDisplay(xcb_connection_t* c, int screen) +xcb_screen_t *XCB::screenOfDisplay(xcb_connection_t *c, int screen) { - for (auto iter = xcb_setup_roots_iterator(xcb_get_setup(c)); - iter.rem; --screen, xcb_screen_next(&iter)) - { + for (auto iter = xcb_setup_roots_iterator(xcb_get_setup(c)); iter.rem; --screen, xcb_screen_next(&iter)) { if (screen == 0) { return iter.data; } @@ -54,7 +52,6 @@ xcb_screen_t* XCB::screenOfDisplay(xcb_c return nullptr; } - XCB::GrabServer::GrabServer() { xcb_grab_server(connection());
  75. Download patch src/log.cpp

    --- 4:5.20.5-1/src/log.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/log.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -24,9 +24,9 @@ #include <QFileInfo> #include <QStandardPaths> -namespace KScreen { - -Log* Log::sInstance = nullptr; +namespace KScreen +{ +Log *Log::sInstance = nullptr; QtMessageHandler sDefaultMessageHandler = nullptr; void kscreenLogOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) @@ -38,12 +38,12 @@ void kscreenLogOutput(QtMsgType type, co sDefaultMessageHandler(type, context, msg); } -void log(const QString& msg) +void log(const QString &msg) { Log::log(msg); } -Log* Log::instance() +Log *Log::instance() { if (!sInstance) { sInstance = new Log(); @@ -55,16 +55,16 @@ Log* Log::instance() using namespace KScreen; class Q_DECL_HIDDEN Log::Private { - public: - QString context; - bool enabled = false; - QString logFile; +public: + QString context; + bool enabled = false; + QString logFile; }; -Log::Log() : - d(new Private) +Log::Log() + : d(new Private) { - const char* logging_env = "KSCREEN_LOGGING"; + const char *logging_env = "KSCREEN_LOGGING"; if (qEnvironmentVariableIsSet(logging_env)) { const QString logging_env_value = QString::fromUtf8(qgetenv(logging_env)); @@ -73,7 +73,7 @@ Log::Log() : } } if (!d->enabled) { - return; + return; } d->logFile = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kscreen/kscreen.log"); @@ -88,8 +88,8 @@ Log::Log() : } } -Log::Log(Log::Private *dd) : - d(dd) +Log::Log(Log::Private *dd) + : d(dd) { } @@ -104,7 +104,7 @@ QString Log::context() const return d->context; } -void Log::setContext(const QString& context) +void Log::setContext(const QString &context) { d->context = context; }
  76. Download patch debian/tests/control.disable

    --- 4:5.20.5-1/debian/tests/control.disable 1970-01-01 00:00:00.000000000 +0000 +++ 4:5.20.90-0ubuntu1/debian/tests/control.disable 2021-01-21 23:45:12.000000000 +0000 @@ -0,0 +1,3 @@ +Tests: acc +Depends: @, dh-acc, exuberant-ctags +Restrictions: allow-stderr
  77. Download patch backends/xrandr1.1/xrandr11.h

    --- 4:5.20.5-1/backends/xrandr1.1/xrandr11.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/xrandr1.1/xrandr11.h 2021-01-21 12:52:36.000000000 +0000 @@ -19,11 +19,11 @@ #ifndef XRANDR11_BACKEND_H #define XRANDR11_BACKEND_H -#include "abstractbackend.h" #include "../xcbwrapper.h" +#include "abstractbackend.h" -#include <QObject> #include <QLoggingCategory> +#include <QObject> class XCBEventListener; @@ -47,11 +47,11 @@ private Q_SLOTS: private: bool m_valid; - XCBEventListener* m_x11Helper; + XCBEventListener *m_x11Helper; KScreen::ConfigPtr m_currentConfig; xcb_timestamp_t m_currentTimestamp; }; Q_DECLARE_LOGGING_CATEGORY(KSCREEN_XRANDR11) -#endif //FAKE_BACKEND_H +#endif // FAKE_BACKEND_H
  78. Download patch backends/xrandr/xrandr.h

    --- 4:5.20.5-1/backends/xrandr/xrandr.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/xrandr/xrandr.h 2021-01-21 12:52:36.000000000 +0000 @@ -36,49 +36,45 @@ class XRandR : public KScreen::AbstractB Q_OBJECT Q_PLUGIN_METADATA(IID "org.kf5.kscreen.backends.xrandr") - public: - explicit XRandR(); - ~XRandR() override; - - QString name() const override; - QString serviceName() const override; - KScreen::ConfigPtr config() const override; - void setConfig(const KScreen::ConfigPtr &config) override; - bool isValid() const override; - QByteArray edid(int outputId) const override; - - static QByteArray outputEdid(xcb_randr_output_t outputId); - static xcb_randr_get_screen_resources_reply_t* screenResources(); - static xcb_screen_t* screen(); - static xcb_window_t rootWindow(); - - static bool hasProperty(xcb_randr_output_t outputId, const QByteArray &name); - - private: - void outputChanged(xcb_randr_output_t output, xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, - xcb_randr_connection_t connection); - void crtcChanged(xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, - xcb_randr_rotation_t rotation, const QRect &geom); - void screenChanged(xcb_randr_rotation_t rotation, const QSize &sizePx, const QSize &sizeMm); - - static quint8* getXProperty(xcb_randr_output_t output, - xcb_atom_t atom, - size_t &len); - - static xcb_screen_t *s_screen; - static xcb_window_t s_rootWindow; - static XRandRConfig *s_internalConfig; - - static int s_randrBase; - static int s_randrError; - static bool s_monitorInitialized; - static bool s_has_1_3; - static bool s_xorgCacheInitialized; +public: + explicit XRandR(); + ~XRandR() override; + + QString name() const override; + QString serviceName() const override; + KScreen::ConfigPtr config() const override; + void setConfig(const KScreen::ConfigPtr &config) override; + bool isValid() const override; + QByteArray edid(int outputId) const override; + + static QByteArray outputEdid(xcb_randr_output_t outputId); + static xcb_randr_get_screen_resources_reply_t *screenResources(); + static xcb_screen_t *screen(); + static xcb_window_t rootWindow(); + + static bool hasProperty(xcb_randr_output_t outputId, const QByteArray &name); + +private: + void outputChanged(xcb_randr_output_t output, xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_randr_connection_t connection); + void crtcChanged(xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_randr_rotation_t rotation, const QRect &geom); + void screenChanged(xcb_randr_rotation_t rotation, const QSize &sizePx, const QSize &sizeMm); + + static quint8 *getXProperty(xcb_randr_output_t output, xcb_atom_t atom, size_t &len); + + static xcb_screen_t *s_screen; + static xcb_window_t s_rootWindow; + static XRandRConfig *s_internalConfig; + + static int s_randrBase; + static int s_randrError; + static bool s_monitorInitialized; + static bool s_has_1_3; + static bool s_xorgCacheInitialized; - XCBEventListener *m_x11Helper; - bool m_isValid; + XCBEventListener *m_x11Helper; + bool m_isValid; - QTimer *m_configChangeCompressor; + QTimer *m_configChangeCompressor; }; Q_DECLARE_LOGGING_CATEGORY(KSCREEN_XRANDR)
  79. Download patch backends/xrandr/xrandrcrtc.cpp

    --- 4:5.20.5-1/backends/xrandr/xrandrcrtc.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/xrandr/xrandrcrtc.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -70,8 +70,7 @@ bool XRandRCrtc::connectOutput(xcb_randr qCDebug(KSCREEN_XRANDR) << "Connected output" << output << "to CRTC" << m_crtc; if (!m_possibleOutputs.contains(output)) { - qCDebug(KSCREEN_XRANDR) << "Output" << output - << "is not an allowed output for CRTC" << m_crtc; + qCDebug(KSCREEN_XRANDR) << "Output" << output << "is not an allowed output for CRTC" << m_crtc; return false; } @@ -103,7 +102,7 @@ void XRandRCrtc::update() m_mode = crtcInfo->mode; m_geometry = QRect(crtcInfo->x, crtcInfo->y, crtcInfo->width, crtcInfo->height); - m_rotation = (xcb_randr_rotation_t) crtcInfo->rotation; + m_rotation = (xcb_randr_rotation_t)crtcInfo->rotation; m_possibleOutputs.clear(); m_possibleOutputs.reserve(crtcInfo->num_possible_outputs); @@ -126,4 +125,3 @@ void XRandRCrtc::update(xcb_randr_mode_t m_geometry = geom; m_rotation = rotation; } -
  80. Download patch src/mode.cpp

    --- 4:5.20.5-1/src/mode.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/mode.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -22,16 +22,17 @@ using namespace KScreen; class Q_DECL_HIDDEN Mode::Private { - public: - Private(): - rate(0) - { } - - Private(const Private &other): - id(other.id), - name(other.name), - size(other.size), - rate(other.rate) +public: + Private() + : rate(0) + { + } + + Private(const Private &other) + : id(other.id) + , name(other.name) + , size(other.size) + , rate(other.rate) { } @@ -42,15 +43,14 @@ class Q_DECL_HIDDEN Mode::Private }; Mode::Mode() - : QObject(nullptr) - , d(new Private()) + : QObject(nullptr) + , d(new Private()) { - } Mode::Mode(Mode::Private *dd) - : QObject() - , d(dd) + : QObject() + , d(dd) { } @@ -69,7 +69,7 @@ const QString Mode::id() const return d->id; } -void Mode::setId(const QString& id) +void Mode::setId(const QString &id) { if (d->id == id) { return; @@ -85,7 +85,7 @@ QString Mode::name() const return d->name; } -void Mode::setName(const QString& name) +void Mode::setName(const QString &name) { if (d->name == name) { return; @@ -96,13 +96,12 @@ void Mode::setName(const QString& name) Q_EMIT modeChanged(); } - QSize Mode::size() const { return d->size; } -void Mode::setSize(const QSize& size) +void Mode::setSize(const QSize &size) { if (d->size == size) { return; @@ -133,7 +132,7 @@ QDebug operator<<(QDebug dbg, const KScr { if (mode) { dbg << "KScreen::Mode(Id:" << mode->id() << ", Size:" << mode->size() << "@" << mode->refreshRate() << ")"; - } else { + } else { dbg << "KScreen::Mode(NULL)"; } return dbg;
  81. Download patch src/abstractbackend.h

    --- 4:5.20.5-1/src/abstractbackend.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/abstractbackend.h 2021-01-21 12:52:36.000000000 +0000 @@ -23,11 +23,12 @@ #include "kscreen_export.h" #include "types.h" -#include <QString> #include <QObject> +#include <QString> -namespace KScreen { - class Config; +namespace KScreen +{ +class Config; /** * Abstract class for backends. @@ -37,7 +38,9 @@ class KSCREEN_EXPORT AbstractBackend : p Q_OBJECT public: - ~AbstractBackend() override {} + ~AbstractBackend() override + { + } /** * This is where the backend should perform all initialization. This method @@ -106,9 +109,8 @@ Q_SIGNALS: * @param config New configuration */ void configChanged(const KScreen::ConfigPtr &config); - }; } // namespace KScreen -#endif //ABSTRACT_BACKEND_H +#endif // ABSTRACT_BACKEND_H
  82. Download patch src/edid.h

    --- 4:5.20.5-1/src/edid.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/edid.h 2021-01-21 12:52:36.000000000 +0000 @@ -17,20 +17,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *************************************************************************************/ - #ifndef KSCREEN_EDID_H #define KSCREEN_EDID_H #include "kscreen_export.h" #include <QObject> -#include <QtGlobal> #include <QQuaternion> +#include <QtGlobal> namespace KScreen { - -class KSCREEN_EXPORT Edid: public QObject +class KSCREEN_EXPORT Edid : public QObject { Q_OBJECT @@ -48,12 +46,12 @@ class KSCREEN_EXPORT Edid: public QObjec Q_PROPERTY(QQuaternion blue READ blue CONSTANT) Q_PROPERTY(QQuaternion white READ white CONSTANT) - public: +public: explicit Edid(); explicit Edid(const QByteArray &data, QObject *parent = nullptr); ~Edid() override; - Q_REQUIRED_RESULT Edid* clone() const; + Q_REQUIRED_RESULT Edid *clone() const; bool isValid() const; @@ -72,17 +70,17 @@ class KSCREEN_EXPORT Edid: public QObjec QQuaternion blue() const; QQuaternion white() const; - private: +private: Q_DISABLE_COPY(Edid) class Private; - Private * const d; + Private *const d; explicit Edid(Private *dd); }; } -Q_DECLARE_METATYPE(KScreen::Edid*) +Q_DECLARE_METATYPE(KScreen::Edid *) #endif // EDID_H
  83. Download patch backends/qscreen/qscreenbackend.h

    --- 4:5.20.5-1/backends/qscreen/qscreenbackend.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/qscreen/qscreenbackend.h 2021-01-21 12:52:36.000000000 +0000 @@ -52,4 +52,4 @@ private: Q_DECLARE_LOGGING_CATEGORY(KSCREEN_QSCREEN) -#endif //QSCREEN_BACKEND_H +#endif // QSCREEN_BACKEND_H
  84. Download patch src/log.h

    --- 4:5.20.5-1/src/log.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/log.h 2021-01-21 12:52:36.000000000 +0000 @@ -22,12 +22,12 @@ #include "kscreen_export.h" #include "types.h" -#include <QObject> #include <QLoggingCategory> +#include <QObject> -namespace KScreen { - -void log(const QString& msg); +namespace KScreen +{ +void log(const QString &msg); /** KScreen-internal file logging. * @@ -55,63 +55,62 @@ void log(const QString& msg); */ class KSCREEN_EXPORT Log { - public: - virtual ~Log(); +public: + virtual ~Log(); - static Log* instance(); + static Log *instance(); - /** Log a message to a file - * - * Call this static method to add a new line to the log. - * - * @arg msg The log message to write. - */ - static void log(const QString &msg, const QString &category = QString()); - - /** Context for the logs. - * - * The context can be used to indicate what is going on overall, it is used to be able - * to group log entries into subsequential operations. For example the context can be - * "handling resume", which is then added to the log messages. - * - * @arg msg The log message to write to the file. - * - * @see ontext() - */ - QString context() const; - - /** Set the context for the logs. - * - * @see context() - */ - void setContext(const QString &context); - - /** Logging to file is enabled by environmental var, is it? - * - * @arg msg The log message to write to the file. - * @return Whether logging is enabled. - */ - bool enabled() const; - - /** Path to the log file - * - * This is usually ~/.local/share/kscreen/kscreen.log, but can be changed by setting - * KSCREEN_LOGFILE in the environment. - * - * @return The path to the log file. - */ - QString logFile() const; - - private: - explicit Log(); - class Private; - Private * const d; + /** Log a message to a file + * + * Call this static method to add a new line to the log. + * + * @arg msg The log message to write. + */ + static void log(const QString &msg, const QString &category = QString()); + + /** Context for the logs. + * + * The context can be used to indicate what is going on overall, it is used to be able + * to group log entries into subsequential operations. For example the context can be + * "handling resume", which is then added to the log messages. + * + * @arg msg The log message to write to the file. + * + * @see ontext() + */ + QString context() const; + + /** Set the context for the logs. + * + * @see context() + */ + void setContext(const QString &context); + + /** Logging to file is enabled by environmental var, is it? + * + * @arg msg The log message to write to the file. + * @return Whether logging is enabled. + */ + bool enabled() const; + + /** Path to the log file + * + * This is usually ~/.local/share/kscreen/kscreen.log, but can be changed by setting + * KSCREEN_LOGFILE in the environment. + * + * @return The path to the log file. + */ + QString logFile() const; + +private: + explicit Log(); + class Private; + Private *const d; - static Log* sInstance; - explicit Log(Private *dd); + static Log *sInstance; + explicit Log(Private *dd); }; -} //KSCreen namespace - +} // KSCreen namespace -#endif //KSCREEN_LOG_H +#endif // KSCREEN_LOG_H
  85. Download patch src/doctor/main.cpp

    --- 4:5.20.5-1/src/doctor/main.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/doctor/main.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -18,8 +18,8 @@ #include "doctor.h" -#include <QGuiApplication> #include <QCommandLineParser> +#include <QGuiApplication> #include <QDebug> @@ -39,61 +39,67 @@ int main(int argc, char **argv) { - const QString desc = QStringLiteral("kscreen-doctor allows to change the screen setup from the command-line.\n" - "\n" - "Setting the output configuration is done in an atomic fashion, all settings\n" - "are applied in a single command.\n" - "kscreen-doctor can be used to enable and disable outputs, to position screens,\n" - "change resolution (mode setting), etc.. You should put all your options into \n" - "a single invocation of kscreen-doctor, so they can all be applied at once.\n" - "\n" - "Usage examples:\n\n" - " Show output information:\n" - " $ kscreen-doctor -o\n" - " Output: 1 eDP-1 enabled connected Panel Modes: Modes: 1:800x600@60 [...] Geometry: 0,0 1280x800\n" - " Output: 70 HDMI-2 enabled connected HDMI Modes: 1:800x600@60 [...] Geometry: 1280,0 1920x1080\n" - "\n Disable the hdmi output, enable the laptop panel and set it to a specific mode\n" - " $ kscreen-doctor output.HDMI-2.disable output.eDP-1.mode.1 output.eDP-1.enable\n" - "\n Position the hdmi monitor on the right of the laptop panel\n" - " $ kscreen-doctor output.HDMI-2.position.0,1280 output.eDP-1.position.0,0\n" - "\n Set resolution mode\n" - " $ kscreen-doctor output.HDMI-2.mode.1920x1080@60 \n" - "\n Set scale (note: fractional scaling is only supported on wayland)\n" - " $ kscreen-doctor output.HDMI-2.scale.2 \n" - "\n Set rotation (possible values: none, left, right, inverted)\n" - " $ kscreen-doctor output.HDMI-2.rotation.left \n"); -/* - "\nError codes:\n" - " 2 : general parse error\n" - " 3 : output id parse error\n" - " 4 : mode id parse error\n" - " 5 : position parse error\n" - - " 8 : invalid output id\n" - " 9 : invalid mode id\n"; -*/ - const QString syntax = QStringLiteral("Specific output settings are separated by spaces, each setting is in the form of\n" - "output.<name>.<setting>[.<value>]\n" - "For example:\n" - "$ kscreen-doctor output.HDMI-2.enable \\ \n" - " output.eDP-1.mode.4 \\ \n" - " output.eDP-1.position.1280,0\n" - "Multiple settings are passed in order to have kscreen-doctor apply these settings in one go.\n"); + const QString desc = QStringLiteral( + "kscreen-doctor allows to change the screen setup from the command-line.\n" + "\n" + "Setting the output configuration is done in an atomic fashion, all settings\n" + "are applied in a single command.\n" + "kscreen-doctor can be used to enable and disable outputs, to position screens,\n" + "change resolution (mode setting), etc.. You should put all your options into \n" + "a single invocation of kscreen-doctor, so they can all be applied at once.\n" + "\n" + "Usage examples:\n\n" + " Show output information:\n" + " $ kscreen-doctor -o\n" + " Output: 1 eDP-1 enabled connected Panel Modes: Modes: 1:800x600@60 [...] Geometry: 0,0 1280x800\n" + " Output: 70 HDMI-2 enabled connected HDMI Modes: 1:800x600@60 [...] Geometry: 1280,0 1920x1080\n" + "\n Disable the hdmi output, enable the laptop panel and set it to a specific mode\n" + " $ kscreen-doctor output.HDMI-2.disable output.eDP-1.mode.1 output.eDP-1.enable\n" + "\n Position the hdmi monitor on the right of the laptop panel\n" + " $ kscreen-doctor output.HDMI-2.position.0,1280 output.eDP-1.position.0,0\n" + "\n Set resolution mode\n" + " $ kscreen-doctor output.HDMI-2.mode.1920x1080@60 \n" + "\n Set scale (note: fractional scaling is only supported on wayland)\n" + " $ kscreen-doctor output.HDMI-2.scale.2 \n" + "\n Set rotation (possible values: none, left, right, inverted)\n" + " $ kscreen-doctor output.HDMI-2.rotation.left \n"); + /* + "\nError codes:\n" + " 2 : general parse error\n" + " 3 : output id parse error\n" + " 4 : mode id parse error\n" + " 5 : position parse error\n" + + " 8 : invalid output id\n" + " 9 : invalid mode id\n"; + */ + const QString syntax = QStringLiteral( + "Specific output settings are separated by spaces, each setting is in the form of\n" + "output.<name>.<setting>[.<value>]\n" + "For example:\n" + "$ kscreen-doctor output.HDMI-2.enable \\ \n" + " output.eDP-1.mode.4 \\ \n" + " output.eDP-1.position.1280,0\n" + "Multiple settings are passed in order to have kscreen-doctor apply these settings in one go.\n"); QGuiApplication app(argc, argv); KScreen::Doctor server; - QCommandLineOption info = QCommandLineOption(QStringList() << QStringLiteral("i") << QStringLiteral("info"), - QStringLiteral("Show runtime information: backends, logging, etc.")); - QCommandLineOption outputs = QCommandLineOption(QStringList() << QStringLiteral("o") << QStringLiteral("outputs"), - QStringLiteral("Show outputs")); - QCommandLineOption json = QCommandLineOption(QStringList() << QStringLiteral("j") << QStringLiteral("json"), - QStringLiteral("Show configuration in JSON format")); + QCommandLineOption info = + QCommandLineOption(QStringList() << QStringLiteral("i") << QStringLiteral("info"), QStringLiteral("Show runtime information: backends, logging, etc.")); + QCommandLineOption outputs = QCommandLineOption(QStringList() << QStringLiteral("o") << QStringLiteral("outputs"), QStringLiteral("Show outputs")); + QCommandLineOption json = + QCommandLineOption(QStringList() << QStringLiteral("j") << QStringLiteral("json"), QStringLiteral("Show configuration in JSON format")); QCommandLineOption dpms = QCommandLineOption(QStringList() << QStringLiteral("d") << QStringLiteral("dpms"), - QStringLiteral("Display power management (wayland only)"), QStringLiteral("off")); + QStringLiteral("Display power management (wayland only)"), + QStringLiteral("off")); + QCommandLineOption dpmsExcluded = QCommandLineOption({QStringLiteral("dpms-excluded")}, + QStringLiteral("Do not apply the dpms change to the output with said model names"), + QStringLiteral("connector")); QCommandLineOption log = QCommandLineOption(QStringList() << QStringLiteral("l") << QStringLiteral("log"), - QStringLiteral("Write a comment to the log file"), QStringLiteral("comment")); + QStringLiteral("Write a comment to the log file"), + QStringLiteral("comment")); QCommandLineParser parser; parser.setApplicationDescription(desc); @@ -104,6 +110,7 @@ int main(int argc, char **argv) parser.addOption(outputs); parser.addOption(dpms); parser.addOption(log); + parser.addOption(dpmsExcluded); parser.process(app); if (!parser.positionalArguments().isEmpty()) {
  86. Download patch backends/kwayland/waylandbackend.cpp

    --- 4:5.20.5-1/backends/kwayland/waylandbackend.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/kwayland/waylandbackend.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -32,15 +32,13 @@ using namespace KScreen; Q_LOGGING_CATEGORY(KSCREEN_WAYLAND, "kscreen.kwayland") - WaylandBackend::WaylandBackend() : KScreen::AbstractBackend() , m_internalConfig(new WaylandConfig(this)) { qCDebug(KSCREEN_WAYLAND) << "Loading Wayland backend."; - connect(m_internalConfig, &WaylandConfig::configChanged, - this, [this]() { + connect(m_internalConfig, &WaylandConfig::configChanged, this, [this]() { Q_EMIT configChanged(m_internalConfig->currentConfig()); }); }
  87. Download patch autotests/testbackendloader.cpp

    --- 4:5.20.5-1/autotests/testbackendloader.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/autotests/testbackendloader.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -17,9 +17,9 @@ *************************************************************************************/ #include <QCoreApplication> -#include <QtTest> #include <QObject> #include <QSignalSpy> +#include <QtTest> #include "../src/backendmanager_p.h" @@ -77,6 +77,7 @@ void TestBackendLoader::testEnv_data() QTest::addColumn<QString>("var"); QTest::addColumn<QString>("backend"); + // clang-format off QTest::newRow("all lower") << "kwayland" << "KSC_KWayland"; QTest::newRow("camel case") << "KWayland" << "KSC_KWayland"; QTest::newRow("all upper") << "KWAYLAND" << "KSC_KWayland"; @@ -85,6 +86,7 @@ void TestBackendLoader::testEnv_data() QTest::newRow("xrandr 1.1") << "xrandr11" << "KSC_XRandR11"; QTest::newRow("qscreen") << "qscreen" << "KSC_QScreen"; QTest::newRow("mixed") << "fake" << "KSC_Fake"; + // clang-format on } void TestBackendLoader::testEnv()
  88. Download patch backends/qscreen/qscreenscreen.cpp

    --- 4:5.20.5-1/backends/qscreen/qscreenscreen.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/qscreen/qscreenscreen.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -17,9 +17,10 @@ *************************************************************************************/ #include "qscreenbackend.h" -#include "qscreenscreen.h" #include "qscreenoutput.h" +#include "qscreenscreen.h" + #include <configmonitor.h> #include <mode.h>
  89. Download patch backends/kwayland/waylandoutput.h

    --- 4:5.20.5-1/backends/kwayland/waylandoutput.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/kwayland/waylandoutput.h 2021-01-21 12:52:36.000000000 +0000 @@ -39,7 +39,6 @@ class OutputConfiguration; namespace KScreen { - class WaylandOutput : public QObject { Q_OBJECT @@ -55,11 +54,10 @@ public: QString name() const; bool enabled() const; - KWayland::Client::OutputDevice* outputDevice() const; + KWayland::Client::OutputDevice *outputDevice() const; void createOutputDevice(KWayland::Client::Registry *registry, quint32 name, quint32 version); - bool setWlConfig(KWayland::Client::OutputConfiguration *wlConfig, - const KScreen::OutputPtr &output); + bool setWlConfig(KWayland::Client::OutputConfiguration *wlConfig, const KScreen::OutputPtr &output); Q_SIGNALS: void deviceRemoved(); @@ -69,7 +67,6 @@ Q_SIGNALS: void changed(); private: - void showOutput(); QString modeName(const KWayland::Client::OutputDevice::Mode &m) const; quint32 m_id;
  90. Download patch tests/kwayland/main.cpp

    --- 4:5.20.5-1/tests/kwayland/main.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/tests/kwayland/main.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -18,8 +18,8 @@ #include "waylandtestserver.h" -#include <QCoreApplication> #include <QCommandLineParser> +#include <QCoreApplication> int main(int argc, char **argv) { @@ -27,8 +27,8 @@ int main(int argc, char **argv) KScreen::WaylandTestServer server; - QCommandLineOption config = QCommandLineOption(QStringList() << QStringLiteral("c") << QStringLiteral("config"), - QStringLiteral("Config file"), QStringLiteral("config")); + QCommandLineOption config = + QCommandLineOption(QStringList() << QStringLiteral("c") << QStringLiteral("config"), QStringLiteral("Config file"), QStringLiteral("config")); QCommandLineParser parser; parser.addHelpOption(); parser.addOption(config);
  91. Download patch src/types.h

    --- 4:5.20.5-1/src/types.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/types.h 2021-01-21 12:52:36.000000000 +0000 @@ -19,12 +19,11 @@ #ifndef KSCREEN_TYPES_H #define KSCREEN_TYPES_H -#include <QSharedPointer> #include <QMap> +#include <QSharedPointer> namespace KScreen { - class Config; typedef QSharedPointer<KScreen::Config> ConfigPtr; class Screen;
  92. Download patch tests/kwayland/waylandconfigreader.h

    --- 4:5.20.5-1/tests/kwayland/waylandconfigreader.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/tests/kwayland/waylandconfigreader.h 2021-01-21 12:52:36.000000000 +0000 @@ -29,17 +29,16 @@ namespace KScreen { - using namespace KWayland::Server; class WaylandConfigReader { - public: - //static QList<KWayland::Server::OutputInterface*> outputsFromConfig(const QString &configfile, KWayland::Server::Display *display); - static void outputsFromConfig(const QString &configfile, KWayland::Server::Display *display, QList<KWayland::Server::OutputDeviceInterface*>& outputs); - static OutputDeviceInterface* createOutputDevice(const QVariantMap &outputConfig, KWayland::Server::Display *display); - static QList<KWayland::Server::OutputInterface*> createOutputs(KWayland::Server::Display *display, QList<KWayland::Server::OutputDeviceInterface*>& outputdevices); + // static QList<KWayland::Server::OutputInterface*> outputsFromConfig(const QString &configfile, KWayland::Server::Display *display); + static void outputsFromConfig(const QString &configfile, KWayland::Server::Display *display, QList<KWayland::Server::OutputDeviceInterface *> &outputs); + static OutputDeviceInterface *createOutputDevice(const QVariantMap &outputConfig, KWayland::Server::Display *display); + static QList<KWayland::Server::OutputInterface *> createOutputs(KWayland::Server::Display *display, + QList<KWayland::Server::OutputDeviceInterface *> &outputdevices); static QSize sizeFromJson(const QVariant &data); static QRect rectFromJson(const QVariant &data);
  93. Download patch backends/xrandr/xrandrscreen.cpp

    --- 4:5.20.5-1/backends/xrandr/xrandrscreen.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/xrandr/xrandrscreen.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -18,10 +18,10 @@ *************************************************************************************/ #include "xrandrscreen.h" +#include "../xcbwrapper.h" #include "config.h" #include "screen.h" #include "xrandrconfig.h" -#include "../xcbwrapper.h" #include <QX11Info> @@ -62,8 +62,7 @@ KScreen::ScreenPtr XRandRScreen::toKScre kscreenScreen->setMinSize(m_minSize); kscreenScreen->setCurrentSize(m_currentSize); - XCB::ScopedPointer<xcb_randr_get_screen_resources_reply_t> - screenResources(XRandR::screenResources()); + XCB::ScopedPointer<xcb_randr_get_screen_resources_reply_t> screenResources(XRandR::screenResources()); kscreenScreen->setMaxActiveOutputsCount(screenResources->num_crtcs); return kscreenScreen;
  94. Download patch backends/xrandr/xrandr.cpp
  95. Download patch backends/fake/fake.h

    --- 4:5.20.5-1/backends/fake/fake.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/fake/fake.h 2021-01-21 12:52:36.000000000 +0000 @@ -21,8 +21,8 @@ #include "abstractbackend.h" -#include <QObject> #include <QLoggingCategory> +#include <QObject> class Fake : public KScreen::AbstractBackend { @@ -53,10 +53,9 @@ public: private Q_SLOTS: void delayedInit(); - private: QString mConfigFile; mutable KScreen::ConfigPtr mConfig; }; Q_DECLARE_LOGGING_CATEGORY(KSCREEN_FAKE) -#endif //FAKE_BACKEND_H +#endif // FAKE_BACKEND_H
  96. Download patch src/doctor/dpmsclient.h

    --- 4:5.20.5-1/src/doctor/dpmsclient.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/doctor/dpmsclient.h 2021-01-21 12:52:36.000000000 +0000 @@ -19,25 +19,25 @@ #ifndef KSCREEN_DPMSCLIENT_H #define KSCREEN_DPMSCLIENT_H -#include <QCommandLineParser> -#include <QObject> #include "../config.h" +#include <QObject> +#include <QRect> -#include <KWayland/Client/registry.h> #include <KWayland/Client/dpms.h> +#include <KWayland/Client/registry.h> class QThread; namespace KWayland { - namespace Client { - class ConnectionThread; - } +namespace Client +{ +class ConnectionThread; +} } namespace KScreen { - class DpmsClient : public QObject { Q_OBJECT @@ -46,6 +46,11 @@ public: explicit DpmsClient(QObject *parent = nullptr); ~DpmsClient() override; + void setExcludedOutputNames(const QStringList &excluded) + { + m_excludedOutputNames = excluded; + } + void connect(); void off(); void on(); @@ -63,12 +68,13 @@ private: QThread *m_thread; KWayland::Client::ConnectionThread *m_connection = nullptr; KWayland::Client::DpmsManager *m_dpmsManager = nullptr; - KWayland::Client::Registry m_registry; + KWayland::Client::Registry *m_registry = nullptr; bool m_setOff = true; bool m_setOn = false; bool m_supportedOututCount = 0; int m_modeChanges = 0; + QStringList m_excludedOutputNames; }; } // namespace
  97. Download patch src/configmonitor.cpp

    --- 4:5.20.5-1/src/configmonitor.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/src/configmonitor.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -17,9 +17,9 @@ *************************************************************************************/ #include "configmonitor.h" -#include "backendmanager_p.h" -#include "backendinterface.h" #include "abstractbackend.h" +#include "backendinterface.h" +#include "backendmanager_p.h" #include "configserializer_p.h" #include "getconfigoperation.h" #include "kscreen_debug.h" @@ -29,10 +29,9 @@ using namespace KScreen; - class Q_DECL_HIDDEN ConfigMonitor::Private : public QObject { - Q_OBJECT + Q_OBJECT public: Private(ConfigMonitor *q); @@ -40,17 +39,18 @@ public: void updateConfigs(); void onBackendReady(org::kde::kscreen::Backend *backend); void backendConfigChanged(const QVariantMap &configMap); - void configDestroyed(QObject* removedConfig); + void configDestroyed(QObject *removedConfig); void getConfigFinished(ConfigOperation *op); void updateConfigs(const KScreen::ConfigPtr &newConfig); void edidReady(QDBusPendingCallWatcher *watcher); - QList<QWeakPointer<KScreen::Config>> watchedConfigs; + QList<QWeakPointer<KScreen::Config>> watchedConfigs; QPointer<org::kde::kscreen::Backend> mBackend; bool mFirstBackend; QMap<KScreen::ConfigPtr, QList<int>> mPendingEDIDRequests; + private: ConfigMonitor *q; }; @@ -70,8 +70,7 @@ void ConfigMonitor::Private::onBackendRe } if (mBackend) { - disconnect(mBackend.data(), &org::kde::kscreen::Backend::configChanged, - this, &ConfigMonitor::Private::backendConfigChanged); + disconnect(mBackend.data(), &org::kde::kscreen::Backend::configChanged, this, &ConfigMonitor::Private::backendConfigChanged); } mBackend = QPointer<org::kde::kscreen::Backend>(backend); @@ -84,17 +83,14 @@ void ConfigMonitor::Private::onBackendRe // the result will be invalid. This can happen when KScreen KDED launches and // detects changes need to be done. if (!mFirstBackend && !watchedConfigs.isEmpty()) { - connect(new GetConfigOperation(), &GetConfigOperation::finished, - this, &Private::getConfigFinished); + connect(new GetConfigOperation(), &GetConfigOperation::finished, this, &Private::getConfigFinished); } mFirstBackend = false; - connect(mBackend.data(), &org::kde::kscreen::Backend::configChanged, - this, &ConfigMonitor::Private::backendConfigChanged); - + connect(mBackend.data(), &org::kde::kscreen::Backend::configChanged, this, &ConfigMonitor::Private::backendConfigChanged); } -void ConfigMonitor::Private::getConfigFinished(ConfigOperation* op) +void ConfigMonitor::Private::getConfigFinished(ConfigOperation *op) { Q_ASSERT(BackendManager::instance()->method() == BackendManager::OutOfProcess); if (op->hasError()) { @@ -102,7 +98,7 @@ void ConfigMonitor::Private::getConfigFi return; } - const KScreen::ConfigPtr config = qobject_cast<GetConfigOperation*>(op)->config(); + const KScreen::ConfigPtr config = qobject_cast<GetConfigOperation *>(op)->config(); updateConfigs(config); } @@ -122,8 +118,7 @@ void ConfigMonitor::Private::backendConf QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply); watcher->setProperty("outputId", output->id()); watcher->setProperty("config", QVariant::fromValue(newConfig)); - connect(watcher, &QDBusPendingCallWatcher::finished, - this, &ConfigMonitor::Private::edidReady); + connect(watcher, &QDBusPendingCallWatcher::finished, this, &ConfigMonitor::Private::edidReady); } } @@ -134,7 +129,7 @@ void ConfigMonitor::Private::backendConf } } -void ConfigMonitor::Private::edidReady(QDBusPendingCallWatcher* watcher) +void ConfigMonitor::Private::edidReady(QDBusPendingCallWatcher *watcher) { Q_ASSERT(BackendManager::instance()->method() == BackendManager::OutOfProcess); @@ -164,7 +159,6 @@ void ConfigMonitor::Private::edidReady(Q } } - void ConfigMonitor::Private::updateConfigs(const KScreen::ConfigPtr &newConfig) { QMutableListIterator<QWeakPointer<Config>> iter(watchedConfigs); @@ -184,10 +178,12 @@ void ConfigMonitor::Private::updateConfi void ConfigMonitor::Private::configDestroyed(QObject *removedConfig) { - for (auto iter = watchedConfigs.begin(); iter != watchedConfigs.end(); ++iter) { + for (auto iter = watchedConfigs.begin(); iter != watchedConfigs.end();) { if (iter->toStrongRef() == removedConfig) { iter = watchedConfigs.erase(iter); // Iterate over the entire list in case there are duplicates + } else { + ++iter; } } } @@ -203,13 +199,12 @@ ConfigMonitor *ConfigMonitor::instance() return s_instance; } -ConfigMonitor::ConfigMonitor(): - QObject(), - d(new Private(this)) +ConfigMonitor::ConfigMonitor() + : QObject() + , d(new Private(this)) { if (BackendManager::instance()->method() == BackendManager::OutOfProcess) { - connect(BackendManager::instance(), &BackendManager::backendReady, - d, &ConfigMonitor::Private::onBackendReady); + connect(BackendManager::instance(), &BackendManager::backendReady, d, &ConfigMonitor::Private::onBackendReady); BackendManager::instance()->requestBackend(); } } @@ -223,8 +218,7 @@ void ConfigMonitor::addConfig(const Conf { const QWeakPointer<Config> weakConfig = config.toWeakRef(); if (!d->watchedConfigs.contains(weakConfig)) { - connect(weakConfig.toStrongRef().data(), &QObject::destroyed, - d, &Private::configDestroyed); + connect(weakConfig.toStrongRef().data(), &QObject::destroyed, d, &Private::configDestroyed); d->watchedConfigs << weakConfig; } } @@ -233,13 +227,12 @@ void ConfigMonitor::removeConfig(const C { const QWeakPointer<Config> weakConfig = config.toWeakRef(); if (d->watchedConfigs.contains(config)) { - disconnect(weakConfig.toStrongRef().data(), &QObject::destroyed, - d, &Private::configDestroyed); + disconnect(weakConfig.toStrongRef().data(), &QObject::destroyed, d, &Private::configDestroyed); d->watchedConfigs.removeAll(config); } } -void ConfigMonitor::connectInProcessBackend(KScreen::AbstractBackend* backend) +void ConfigMonitor::connectInProcessBackend(KScreen::AbstractBackend *backend) { Q_ASSERT(BackendManager::instance()->method() == BackendManager::InProcess); connect(backend, &AbstractBackend::configChanged, [=](KScreen::ConfigPtr config) { @@ -251,5 +244,4 @@ void ConfigMonitor::connectInProcessBack }); } - #include "configmonitor.moc"
  98. Download patch backends/xrandr1.1/xrandr11.cpp

    --- 4:5.20.5-1/backends/xrandr1.1/xrandr11.cpp 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/xrandr1.1/xrandr11.cpp 2021-01-21 12:52:36.000000000 +0000 @@ -23,25 +23,26 @@ #include "edid.h" #include "output.h" -#include <xcb/xcb.h> #include <xcb/randr.h> +#include <xcb/xcb.h> -#include <QString> #include <QDebug> +#include <QString> Q_LOGGING_CATEGORY(KSCREEN_XRANDR11, "kscreen.xrandr11") XRandR11::XRandR11() - : KScreen::AbstractBackend() - , m_valid(false) - , m_x11Helper(nullptr) - , m_currentConfig(new KScreen::Config) - , m_currentTimestamp(0) + : KScreen::AbstractBackend() + , m_valid(false) + , m_x11Helper(nullptr) + , m_currentConfig(new KScreen::Config) + , m_currentTimestamp(0) { xcb_generic_error_t *error = nullptr; - xcb_randr_query_version_reply_t* version; - version = xcb_randr_query_version_reply(XCB::connection(), - xcb_randr_query_version(XCB::connection(), XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION), &error); + xcb_randr_query_version_reply_t *version; + version = xcb_randr_query_version_reply(XCB::connection(), // + xcb_randr_query_version(XCB::connection(), XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION), + &error); if (!version || error) { free(error); @@ -57,8 +58,7 @@ XRandR11::XRandR11() m_x11Helper = new XCBEventListener(); - connect(m_x11Helper, &XCBEventListener::outputsChanged, - this, &XRandR11::updateConfig); + connect(m_x11Helper, &XCBEventListener::outputsChanged, this, &XRandR11::updateConfig); m_valid = true; } @@ -79,7 +79,6 @@ QString XRandR11::serviceName() const return QStringLiteral("org.kde.KScreen.Backend.XRandR11"); } - bool XRandR11::isValid() const { return m_valid; @@ -92,7 +91,7 @@ KScreen::ConfigPtr XRandR11::config() co config->setSupportedFeatures(features); const int screenId = QX11Info::appScreen(); - xcb_screen_t* xcbScreen = XCB::screenOfDisplay(XCB::connection(), screenId); + xcb_screen_t *xcbScreen = XCB::screenOfDisplay(XCB::connection(), screenId); const XCB::ScreenInfo info(xcbScreen->root); const XCB::ScreenSize size(xcbScreen->root); @@ -121,9 +120,9 @@ KScreen::ConfigPtr XRandR11::config() co output->setConnected(true); output->setEnabled(true); output->setName(QStringLiteral("Default")); - output->setPos(QPoint(0,0)); + output->setPos(QPoint(0, 0)); output->setPrimary(true); - output->setRotation((KScreen::Output::Rotation) info->rotation); + output->setRotation((KScreen::Output::Rotation)info->rotation); output->setSizeMm(QSize(xcbScreen->width_in_millimeters, xcbScreen->height_in_millimeters)); outputs.insert(1, output); @@ -133,10 +132,10 @@ KScreen::ConfigPtr XRandR11::config() co KScreen::ModeList modes; auto iter = xcb_randr_get_screen_info_rates_iterator(info); - xcb_randr_screen_size_t* sizes = xcb_randr_get_screen_info_sizes(info); + xcb_randr_screen_size_t *sizes = xcb_randr_get_screen_info_sizes(info); for (int x = 0; x < info->nSizes; x++) { const xcb_randr_screen_size_t size = sizes[x]; - const uint16_t* rates = xcb_randr_refresh_rates_rates(iter.data); + const uint16_t *rates = xcb_randr_refresh_rates_rates(iter.data); const int nrates = xcb_randr_refresh_rates_rates_length(iter.data); for (int j = 0; j < nrates; j++) { @@ -167,16 +166,19 @@ void XRandR11::setConfig(const KScreen:: const KScreen::ModePtr mode = output->currentMode(); const int screenId = QX11Info::appScreen(); - xcb_screen_t* xcbScreen = XCB::screenOfDisplay(XCB::connection(), screenId); + xcb_screen_t *xcbScreen = XCB::screenOfDisplay(XCB::connection(), screenId); const XCB::ScreenInfo info(xcbScreen->root); xcb_generic_error_t *err; const int sizeId = mode->id().split(QLatin1Char('-')).first().toInt(); - auto cookie = xcb_randr_set_screen_config(XCB::connection(), xcbScreen->root, - XCB_CURRENT_TIME, info->config_timestamp, sizeId, - (short) output->rotation(), mode->refreshRate()); - XCB::ScopedPointer<xcb_randr_set_screen_config_reply_t> reply( - xcb_randr_set_screen_config_reply(XCB::connection(), cookie, &err)); + auto cookie = xcb_randr_set_screen_config(XCB::connection(), + xcbScreen->root, + XCB_CURRENT_TIME, + info->config_timestamp, + sizeId, + (short)output->rotation(), + mode->refreshRate()); + XCB::ScopedPointer<xcb_randr_set_screen_config_reply_t> reply(xcb_randr_set_screen_config_reply(XCB::connection(), cookie, &err)); if (err) { free(err); }
  99. Download patch backends/xrandr/xrandroutput.h

    --- 4:5.20.5-1/backends/xrandr/xrandroutput.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/xrandr/xrandroutput.h 2021-01-21 12:52:36.000000000 +0000 @@ -19,11 +19,11 @@ #include "output.h" -#include "xrandrmode.h" #include "../xcbwrapper.h" +#include "xrandrmode.h" -#include <QObject> #include <QMap> +#include <QObject> #include <QVariant> class XRandRConfig; @@ -39,7 +39,7 @@ class XRandROutput : public QObject Q_OBJECT public: - typedef QMap<xcb_randr_output_t, XRandROutput*> Map; + typedef QMap<xcb_randr_output_t, XRandROutput *> Map; explicit XRandROutput(xcb_randr_output_t id, XRandRConfig *config); ~XRandROutput() override; @@ -48,8 +48,7 @@ public: void disconnected(); void update(); - void update(xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_randr_connection_t conn, - bool primary); + void update(xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_randr_connection_t conn, bool primary); void setIsPrimary(bool primary); @@ -65,13 +64,13 @@ public: QString currentModeId() const; XRandRMode::Map modes() const; - XRandRMode* currentMode() const; + XRandRMode *currentMode() const; KScreen::Output::Rotation rotation() const; bool isHorizontal() const; QByteArray edid() const; - XRandRCrtc* crtc() const; + XRandRCrtc *crtc() const; KScreen::OutputPtr toKScreenOutput() const;
  100. Download patch backends/qscreen/qscreenoutput.h

    --- 4:5.20.5-1/backends/qscreen/qscreenoutput.h 2021-01-05 12:10:18.000000000 +0000 +++ 4:5.20.90-0ubuntu1/backends/qscreen/qscreenoutput.h 2021-01-21 12:52:36.000000000 +0000 @@ -22,14 +22,13 @@ #include "qscreenconfig.h" #include "config.h" -#include "output.h" #include "edid.h" +#include "output.h" #include <QScreen> namespace KScreen { - class QScreenOutput : public QObject { Q_OBJECT @@ -47,7 +46,6 @@ public: const QScreen *qscreen() const; private: - void updateFromQScreen(const QScreen *qscreen); const QScreen *m_qscreen; int m_id; };
  101. ...
  1. libkscreen