delete the colord integration plugin
ICC profiles are now set through KScreen, which conflicts with colord. Colord is also dropped because applications may read the profile for the current output from it, and so KWin and the application both apply the profile, resulting in wrong colors.
This commit is contained in:
parent
872aa55630
commit
c1b4806962
12 changed files with 0 additions and 565 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
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<QDBusObjectPath> 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
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "colorddeviceinterface.h"
|
||||
|
||||
#include <QDBusObjectPath>
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
|
||||
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<Output> m_output;
|
||||
};
|
||||
|
||||
} // namespace KWin
|
|
@ -1,135 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
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 <QDBusPendingCallWatcher>
|
||||
#include <QDBusServiceWatcher>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
ColordIntegration::ColordIntegration()
|
||||
{
|
||||
qDBusRegisterMetaType<CdStringMap>();
|
||||
|
||||
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<Output *> 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<Output *> 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<QDBusObjectPath> 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<QDBusObjectPath> 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"
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "colordinterface.h"
|
||||
#include "plugin.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QObject>
|
||||
|
||||
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<Output *, ColordDevice *> m_outputToDevice;
|
||||
CdInterface *m_colordInterface;
|
||||
};
|
||||
|
||||
} // namespace KWin
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QMap>
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
|
||||
typedef QMap<QString, QString> CdStringMap;
|
||||
Q_DECLARE_METATYPE(CdStringMap)
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
#include "colordintegration.h"
|
||||
|
||||
#include <KPluginFactory>
|
||||
|
||||
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<Plugin> create() const override;
|
||||
};
|
||||
|
||||
std::unique_ptr<Plugin> ColordIntegrationFactory::create() const
|
||||
{
|
||||
switch (kwinApp()->operationMode()) {
|
||||
case Application::OperationModeX11:
|
||||
return nullptr;
|
||||
case Application::OperationModeXwayland:
|
||||
case Application::OperationModeWaylandOnly:
|
||||
return std::make_unique<ColordIntegration>();
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
#include "main.moc"
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"KPlugin": {
|
||||
"EnabledByDefault": true
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
<!DOCTYPE node PUBLIC
|
||||
"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"https://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node name="/" xmlns:doc="https://www.freedesktop.org/dbus/1.0/doc.dtd">
|
||||
<interface name='org.freedesktop.ColorManager.Device'>
|
||||
<doc:doc>
|
||||
<doc:description>
|
||||
<doc:para>
|
||||
The interface used for querying color parameters for a specific device.
|
||||
</doc:para>
|
||||
</doc:description>
|
||||
</doc:doc>
|
||||
|
||||
<!--***********************************************************-->
|
||||
<property name='Profiles' type='ao' access='read'>
|
||||
<doc:doc>
|
||||
<doc:description>
|
||||
<doc:para>
|
||||
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.
|
||||
</doc:para>
|
||||
</doc:description>
|
||||
</doc:doc>
|
||||
</property>
|
||||
|
||||
<!-- ************************************************************ -->
|
||||
<signal name='Changed'>
|
||||
<doc:doc>
|
||||
<doc:description>
|
||||
<doc:para>
|
||||
Some value on the interface has changed.
|
||||
</doc:para>
|
||||
</doc:description>
|
||||
</doc:doc>
|
||||
</signal>
|
||||
|
||||
</interface>
|
||||
</node>
|
|
@ -1,26 +0,0 @@
|
|||
<!DOCTYPE node PUBLIC
|
||||
"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"https://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node name="/" xmlns:doc="https://www.freedesktop.org/dbus/1.0/doc.dtd">
|
||||
<interface name='org.freedesktop.ColorManager.Profile'>
|
||||
<doc:doc>
|
||||
<doc:description>
|
||||
<doc:para>
|
||||
The interface used for querying color profiles.
|
||||
</doc:para>
|
||||
</doc:description>
|
||||
</doc:doc>
|
||||
|
||||
<!--***********************************************************-->
|
||||
<property name='Filename' type='s' access='read'>
|
||||
<doc:doc>
|
||||
<doc:description>
|
||||
<doc:para>
|
||||
The profile filename, if one exists.
|
||||
</doc:para>
|
||||
</doc:description>
|
||||
</doc:doc>
|
||||
</property>
|
||||
|
||||
</interface>
|
||||
</node>
|
|
@ -1,125 +0,0 @@
|
|||
<!DOCTYPE node PUBLIC
|
||||
"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"https://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node name="/" xmlns:doc="https://www.freedesktop.org/dbus/1.0/doc.dtd">
|
||||
<interface name='org.freedesktop.ColorManager'>
|
||||
<doc:doc>
|
||||
<doc:description>
|
||||
<doc:para>
|
||||
The interface used for querying color parameters for the system.
|
||||
</doc:para>
|
||||
</doc:description>
|
||||
</doc:doc>
|
||||
|
||||
<!--***********************************************************-->
|
||||
<method name='CreateDevice'>
|
||||
<doc:doc>
|
||||
<doc:description>
|
||||
<doc:para>
|
||||
Creates a device.
|
||||
</doc:para>
|
||||
<doc:para>
|
||||
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 <doc:tt>RemoveProfile</doc:tt> on the relevant
|
||||
device object.
|
||||
</doc:para>
|
||||
</doc:description>
|
||||
</doc:doc>
|
||||
<arg type='s' name='device_id' direction='in'>
|
||||
<doc:doc>
|
||||
<doc:summary>
|
||||
<doc:para>
|
||||
A device ID that is used to map to the device path.
|
||||
</doc:para>
|
||||
</doc:summary>
|
||||
</doc:doc>
|
||||
</arg>
|
||||
<arg type='s' name='scope' direction='in'>
|
||||
<doc:doc>
|
||||
<doc:summary>
|
||||
<doc:para>
|
||||
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.
|
||||
</doc:para>
|
||||
</doc:summary>
|
||||
<doc:list>
|
||||
<doc:item>
|
||||
<doc:term>normal</doc:term>
|
||||
<doc:definition>
|
||||
Normal device.
|
||||
</doc:definition>
|
||||
</doc:item>
|
||||
<doc:item>
|
||||
<doc:term>temp</doc:term>
|
||||
<doc:definition>
|
||||
Device that is removed if the user logs out.
|
||||
</doc:definition>
|
||||
</doc:item>
|
||||
<doc:item>
|
||||
<doc:term>disk</doc:term>
|
||||
<doc:definition>
|
||||
Device that is saved to disk, and restored if the
|
||||
computer is restarted.
|
||||
</doc:definition>
|
||||
</doc:item>
|
||||
</doc:list>
|
||||
</doc:doc>
|
||||
</arg>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="CdStringMap"/>
|
||||
<arg type='a{ss}' name='properties' direction='in'>
|
||||
<doc:doc>
|
||||
<doc:summary>
|
||||
<doc:para>
|
||||
Properties to be used when constructing the device.
|
||||
</doc:para>
|
||||
<doc:para>
|
||||
This optional value allows the device to be created with
|
||||
the latency of one bus round-trip, rather than doing
|
||||
a few <doc:tt>SetProperty</doc:tt> methods indervidually.
|
||||
</doc:para>
|
||||
<doc:para>
|
||||
Any properties not interstood by colord will be added as
|
||||
dictionary values to the <doc:tt>Metadata</doc:tt>
|
||||
property.
|
||||
</doc:para>
|
||||
</doc:summary>
|
||||
</doc:doc>
|
||||
</arg>
|
||||
<arg type='o' name='object_path' direction='out'>
|
||||
<doc:doc>
|
||||
<doc:summary>
|
||||
<doc:para>
|
||||
A device path.
|
||||
</doc:para>
|
||||
</doc:summary>
|
||||
</doc:doc>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<!--***********************************************************-->
|
||||
<method name='DeleteDevice'>
|
||||
<doc:doc>
|
||||
<doc:description>
|
||||
<doc:para>
|
||||
Deletes a device.
|
||||
</doc:para>
|
||||
</doc:description>
|
||||
</doc:doc>
|
||||
<arg type='o' name='object_path' direction='in'>
|
||||
<doc:doc>
|
||||
<doc:summary>
|
||||
<doc:para>
|
||||
A device path.
|
||||
</doc:para>
|
||||
</doc:summary>
|
||||
</doc:doc>
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
</interface>
|
||||
</node>
|
Loading…
Reference in a new issue