diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 198634df4c..65e55ed862 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -52,7 +52,6 @@ add_subdirectory(blendchanges) add_subdirectory(blur) add_subdirectory(buttonrebinds) add_subdirectory(colorblindnesscorrection) -add_subdirectory(colord-integration) add_subdirectory(colorpicker) add_subdirectory(desktopchangeosd) add_subdirectory(dialogparent) diff --git a/src/plugins/colord-integration/CMakeLists.txt b/src/plugins/colord-integration/CMakeLists.txt deleted file mode 100644 index 0a983e28d4..0000000000 --- a/src/plugins/colord-integration/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -kcoreaddons_add_plugin(colordintegration INSTALL_NAMESPACE "kwin/plugins") -target_sources(colordintegration PRIVATE - colorddevice.cpp - colordintegration.cpp - main.cpp -) - -ecm_qt_declare_logging_category(colordintegration - HEADER colordlogging.h - IDENTIFIER KWIN_COLORD - CATEGORY_NAME kwin_colord - DEFAULT_SEVERITY Warning - DESCRIPTION "KWin colord integration" -) - -set(colordintegration_xml_SOURCES) -set(COLORD_DEVICE_XML org.freedesktop.ColorManager.Device.xml) -set(COLORD_PROFILE_XML org.freedesktop.ColorManager.Profile.xml) -set(COLORD_MANAGER_XML org.freedesktop.ColorManager.xml) - -set_source_files_properties(${COLORD_MANAGER_XML} PROPERTIES INCLUDE "colordtypes.h") -set_source_files_properties(${COLORD_MANAGER_XML} PROPERTIES NO_NAMESPACE true) -set_source_files_properties(${COLORD_MANAGER_XML} PROPERTIES CLASSNAME CdInterface) -qt_add_dbus_interface(colordintegration_xml_SOURCES ${COLORD_MANAGER_XML} colordinterface) - -set_source_files_properties(${COLORD_DEVICE_XML} PROPERTIES INCLUDE "colordtypes.h") -set_source_files_properties(${COLORD_DEVICE_XML} PROPERTIES NO_NAMESPACE true) -set_source_files_properties(${COLORD_DEVICE_XML} PROPERTIES CLASSNAME CdDeviceInterface) -qt_add_dbus_interface(colordintegration_xml_SOURCES ${COLORD_DEVICE_XML} colorddeviceinterface) - -set_source_files_properties(${COLORD_PROFILE_XML} PROPERTIES INCLUDE "colordtypes.h") -set_source_files_properties(${COLORD_PROFILE_XML} PROPERTIES NO_NAMESPACE true) -set_source_files_properties(${COLORD_PROFILE_XML} PROPERTIES CLASSNAME CdProfileInterface) -qt_add_dbus_interface(colordintegration_xml_SOURCES ${COLORD_PROFILE_XML} colordprofileinterface) - -target_sources(colordintegration PRIVATE ${colordintegration_xml_SOURCES}) -target_link_libraries(colordintegration kwin) diff --git a/src/plugins/colord-integration/colorddevice.cpp b/src/plugins/colord-integration/colorddevice.cpp deleted file mode 100644 index 477ee82a9b..0000000000 --- a/src/plugins/colord-integration/colorddevice.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - SPDX-FileCopyrightText: 2020 Vlad Zahorodnii - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#include "colorddevice.h" -#include "colordlogging.h" -#include "colordprofileinterface.h" -#include "colors/colordevice.h" -#include "colors/colormanager.h" -#include "core/output.h" -#include "core/outputconfiguration.h" -#include "main.h" -#include "workspace.h" - -namespace KWin -{ - -ColordDevice::ColordDevice(Output *output, QObject *parent) - : QObject(parent) - , m_output(output) -{ -} - -Output *ColordDevice::output() const -{ - return m_output; -} - -QDBusObjectPath ColordDevice::objectPath() const -{ - return m_colordInterface ? QDBusObjectPath(m_colordInterface->path()) : QDBusObjectPath(); -} - -void ColordDevice::initialize(const QDBusObjectPath &devicePath) -{ - m_colordInterface = new CdDeviceInterface(QStringLiteral("org.freedesktop.ColorManager"), - devicePath.path(), QDBusConnection::systemBus(), this); - connect(m_colordInterface, &CdDeviceInterface::Changed, this, &ColordDevice::updateProfile); - - updateProfile(); -} - -void ColordDevice::updateProfile() -{ - const QList profiles = m_colordInterface->profiles(); - if (profiles.isEmpty()) { - qCDebug(KWIN_COLORD) << m_output->name() << "has no any color profile assigned"; - return; - } - - CdProfileInterface profile(QStringLiteral("org.freedesktop.ColorManager"), - profiles.first().path(), QDBusConnection::systemBus()); - if (!profile.isValid()) { - qCWarning(KWIN_COLORD) << profiles.first().path() << "is an invalid color profile"; - return; - } - - OutputConfiguration cfg; - cfg.changeSet(m_output)->iccProfilePath = profile.filename(); - workspace()->applyOutputConfiguration(cfg); -} - -} // namespace KWin diff --git a/src/plugins/colord-integration/colorddevice.h b/src/plugins/colord-integration/colorddevice.h deleted file mode 100644 index 92f0d4523c..0000000000 --- a/src/plugins/colord-integration/colorddevice.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - SPDX-FileCopyrightText: 2020 Vlad Zahorodnii - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#pragma once - -#include "colorddeviceinterface.h" - -#include -#include -#include - -namespace KWin -{ - -class Output; - -class ColordDevice : public QObject -{ -public: - explicit ColordDevice(Output *output, QObject *parent = nullptr); - - void initialize(const QDBusObjectPath &devicePath); - - Output *output() const; - QDBusObjectPath objectPath() const; - -private Q_SLOTS: - void updateProfile(); - -private: - CdDeviceInterface *m_colordInterface = nullptr; - QPointer m_output; -}; - -} // namespace KWin diff --git a/src/plugins/colord-integration/colordintegration.cpp b/src/plugins/colord-integration/colordintegration.cpp deleted file mode 100644 index 3a38e8dae1..0000000000 --- a/src/plugins/colord-integration/colordintegration.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - SPDX-FileCopyrightText: 2020 Vlad Zahorodnii - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#include "colordintegration.h" -#include "colorddevice.h" -#include "colordlogging.h" -#include "core/output.h" -#include "workspace.h" - -#include -#include - -namespace KWin -{ - -ColordIntegration::ColordIntegration() -{ - qDBusRegisterMetaType(); - - auto watcher = new QDBusServiceWatcher(QStringLiteral("org.freedesktop.ColorManager"), - QDBusConnection::systemBus(), - QDBusServiceWatcher::WatchForRegistration | QDBusServiceWatcher::WatchForUnregistration, this); - - connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &ColordIntegration::initialize); - connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, &ColordIntegration::teardown); - - QDBusConnectionInterface *interface = QDBusConnection::systemBus().interface(); - if (interface->isServiceRegistered(QStringLiteral("org.freedesktop.ColorManager"))) { - initialize(); - } -} - -void ColordIntegration::initialize() -{ - m_colordInterface = new CdInterface(QStringLiteral("org.freedesktop.ColorManager"), - QStringLiteral("/org/freedesktop/ColorManager"), - QDBusConnection::systemBus(), this); - - const QList outputs = workspace()->outputs(); - for (Output *output : outputs) { - handleOutputAdded(output); - } - - connect(workspace(), &Workspace::outputAdded, this, &ColordIntegration::handleOutputAdded); - connect(workspace(), &Workspace::outputRemoved, this, &ColordIntegration::handleOutputRemoved); -} - -void ColordIntegration::teardown() -{ - const QList outputs = workspace()->outputs(); - for (Output *output : outputs) { - handleOutputRemoved(output); - } - - delete m_colordInterface; - m_colordInterface = nullptr; - - disconnect(workspace(), &Workspace::outputAdded, this, &ColordIntegration::handleOutputAdded); - disconnect(workspace(), &Workspace::outputRemoved, this, &ColordIntegration::handleOutputRemoved); -} - -void ColordIntegration::handleOutputAdded(Output *output) -{ - if (output->isNonDesktop()) { - return; - } - ColordDevice *device = new ColordDevice(output, this); - - CdStringMap properties; - properties.insert(QStringLiteral("Kind"), QStringLiteral("display")); - properties.insert(QStringLiteral("Colorspace"), QStringLiteral("RGB")); - - const QString vendor = output->manufacturer(); - if (!vendor.isEmpty()) { - properties.insert(QStringLiteral("Vendor"), vendor); - } - - const QString model = output->model(); - if (!model.isEmpty()) { - properties.insert(QStringLiteral("Model"), model); - } - - const QString serialNumber = output->serialNumber(); - if (!serialNumber.isEmpty()) { - properties.insert(QStringLiteral("Serial"), serialNumber); - } - - if (output->isInternal()) { - properties.insert(QStringLiteral("Embedded"), QString()); - } - - QDBusPendingReply reply = - m_colordInterface->CreateDevice(output->name(), QStringLiteral("temp"), properties); - - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); - connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, device, watcher]() { - watcher->deleteLater(); - - const QDBusPendingReply reply = *watcher; - if (reply.isError()) { - qCDebug(KWIN_COLORD) << "Failed to add a colord device:" << reply.error(); - delete device; - return; - } - - const QDBusObjectPath objectPath = reply.value(); - if (!device->output()) { - m_colordInterface->DeleteDevice(objectPath); - delete device; - return; - } - - device->initialize(objectPath); - m_outputToDevice.insert(device->output(), device); - }); -} - -void ColordIntegration::handleOutputRemoved(Output *output) -{ - if (output->isNonDesktop()) { - return; - } - ColordDevice *device = m_outputToDevice.take(output); - if (device) { - m_colordInterface->DeleteDevice(device->objectPath()); - delete device; - } -} - -} // namespace KWin - -#include "moc_colordintegration.cpp" diff --git a/src/plugins/colord-integration/colordintegration.h b/src/plugins/colord-integration/colordintegration.h deleted file mode 100644 index ffcbe3d9ee..0000000000 --- a/src/plugins/colord-integration/colordintegration.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - SPDX-FileCopyrightText: 2020 Vlad Zahorodnii - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#pragma once - -#include "colordinterface.h" -#include "plugin.h" - -#include -#include - -namespace KWin -{ - -class Output; -class ColordDevice; - -class KWIN_EXPORT ColordIntegration : public Plugin -{ - Q_OBJECT - -public: - explicit ColordIntegration(); - -private Q_SLOTS: - void handleOutputAdded(Output *output); - void handleOutputRemoved(Output *output); - -private: - void initialize(); - void teardown(); - - QHash m_outputToDevice; - CdInterface *m_colordInterface; -}; - -} // namespace KWin diff --git a/src/plugins/colord-integration/colordtypes.h b/src/plugins/colord-integration/colordtypes.h deleted file mode 100644 index af81af9c6a..0000000000 --- a/src/plugins/colord-integration/colordtypes.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - SPDX-FileCopyrightText: 2020 Vlad Zahorodnii - - SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#pragma once - -#include -#include -#include - -typedef QMap CdStringMap; -Q_DECLARE_METATYPE(CdStringMap) diff --git a/src/plugins/colord-integration/main.cpp b/src/plugins/colord-integration/main.cpp deleted file mode 100644 index 726ea06946..0000000000 --- a/src/plugins/colord-integration/main.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - SPDX-FileCopyrightText: 2020 Vlad Zahorodnii - - SPDX-License-Identifier: LGPL-2.0-or-later -*/ - -#include "main.h" -#include "colordintegration.h" - -#include - -using namespace KWin; - -class KWIN_EXPORT ColordIntegrationFactory : public PluginFactory -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID PluginFactory_iid FILE "metadata.json") - Q_INTERFACES(KWin::PluginFactory) - -public: - explicit ColordIntegrationFactory() = default; - - std::unique_ptr create() const override; -}; - -std::unique_ptr ColordIntegrationFactory::create() const -{ - switch (kwinApp()->operationMode()) { - case Application::OperationModeX11: - return nullptr; - case Application::OperationModeXwayland: - case Application::OperationModeWaylandOnly: - return std::make_unique(); - default: - return nullptr; - } -} - -#include "main.moc" diff --git a/src/plugins/colord-integration/metadata.json b/src/plugins/colord-integration/metadata.json deleted file mode 100644 index aa304f4093..0000000000 --- a/src/plugins/colord-integration/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "KPlugin": { - "EnabledByDefault": true - } -} diff --git a/src/plugins/colord-integration/org.freedesktop.ColorManager.Device.xml b/src/plugins/colord-integration/org.freedesktop.ColorManager.Device.xml deleted file mode 100644 index f78bff7635..0000000000 --- a/src/plugins/colord-integration/org.freedesktop.ColorManager.Device.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - The interface used for querying color parameters for a specific device. - - - - - - - - - - The profile paths associated with this device. - Profiles are returned even if the device is disabled or - is profiling, and clients should not assume that the first - profile in this array should be applied. - - - - - - - - - - - Some value on the interface has changed. - - - - - - - diff --git a/src/plugins/colord-integration/org.freedesktop.ColorManager.Profile.xml b/src/plugins/colord-integration/org.freedesktop.ColorManager.Profile.xml deleted file mode 100644 index 2ff44bce88..0000000000 --- a/src/plugins/colord-integration/org.freedesktop.ColorManager.Profile.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - The interface used for querying color profiles. - - - - - - - - - - The profile filename, if one exists. - - - - - - - diff --git a/src/plugins/colord-integration/org.freedesktop.ColorManager.xml b/src/plugins/colord-integration/org.freedesktop.ColorManager.xml deleted file mode 100644 index 052bd1ab3e..0000000000 --- a/src/plugins/colord-integration/org.freedesktop.ColorManager.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - The interface used for querying color parameters for the system. - - - - - - - - - - Creates a device. - - - If the device has profiles added to it in the past, and - that profiles exists already, then the new device will be - automatically have profiles added to the device. - To prevent this from happening, remove the assignment by - doing RemoveProfile on the relevant - device object. - - - - - - - - A device ID that is used to map to the device path. - - - - - - - - - Options for creating the device. This allows the session - color management component to have per-session virtual - devices cleaned up automatically or devices that are - re-created on each boot. - - - - - normal - - Normal device. - - - - temp - - Device that is removed if the user logs out. - - - - disk - - Device that is saved to disk, and restored if the - computer is restarted. - - - - - - - - - - - Properties to be used when constructing the device. - - - This optional value allows the device to be created with - the latency of one bus round-trip, rather than doing - a few SetProperty methods indervidually. - - - Any properties not interstood by colord will be added as - dictionary values to the Metadata - property. - - - - - - - - - A device path. - - - - - - - - - - - - Deletes a device. - - - - - - - - A device path. - - - - - - - -