Remove unused code after cee6912d00
This commit is contained in:
parent
57f8837e39
commit
a9458fa031
10 changed files with 0 additions and 1692 deletions
|
@ -9,7 +9,6 @@
|
|||
#include "../../src/server/clientconnection.h"
|
||||
#include "../../src/server/display.h"
|
||||
#include "../../src/server/output_interface.h"
|
||||
#include "../../src/server/outputmanagement_interface.h"
|
||||
#include "../../src/server/outputmanagement_v2_interface.h"
|
||||
// Wayland
|
||||
#include <wayland-server.h>
|
||||
|
|
|
@ -1,112 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2015 Sebastian Kügler <sebas@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#include "outputchangeset.h"
|
||||
#include "outputchangeset_p.h"
|
||||
|
||||
namespace KWaylandServer
|
||||
{
|
||||
OutputChangeSetPrivate::OutputChangeSetPrivate(OutputDeviceInterface *outputdevice, OutputChangeSet *parent)
|
||||
: q(parent)
|
||||
, outputDevice(outputdevice)
|
||||
, enabled(outputDevice->enabled())
|
||||
, modeId(outputDevice->currentModeId())
|
||||
, transform(outputDevice->transform())
|
||||
, position(outputDevice->globalPosition())
|
||||
, scale(outputDevice->scaleF())
|
||||
, colorCurves(outputDevice->colorCurves())
|
||||
, overscan(outputDevice->overscan())
|
||||
{
|
||||
}
|
||||
|
||||
OutputChangeSet::OutputChangeSet(OutputDeviceInterface *outputdevice, QObject *parent)
|
||||
: QObject(parent)
|
||||
, d(new OutputChangeSetPrivate(outputdevice, this))
|
||||
{
|
||||
}
|
||||
|
||||
OutputChangeSet::~OutputChangeSet() = default;
|
||||
|
||||
bool OutputChangeSet::enabledChanged() const
|
||||
{
|
||||
return d->enabled != d->outputDevice->enabled();
|
||||
}
|
||||
|
||||
OutputDeviceInterface::Enablement OutputChangeSet::enabled() const
|
||||
{
|
||||
return d->enabled;
|
||||
}
|
||||
|
||||
bool OutputChangeSet::modeChanged() const
|
||||
{
|
||||
return d->modeId != d->outputDevice->currentModeId();
|
||||
}
|
||||
|
||||
int OutputChangeSet::mode() const
|
||||
{
|
||||
return d->modeId;
|
||||
}
|
||||
|
||||
bool OutputChangeSet::transformChanged() const
|
||||
{
|
||||
return d->transform != d->outputDevice->transform();
|
||||
}
|
||||
|
||||
OutputDeviceInterface::Transform OutputChangeSet::transform() const
|
||||
{
|
||||
return d->transform;
|
||||
}
|
||||
bool OutputChangeSet::positionChanged() const
|
||||
{
|
||||
return d->position != d->outputDevice->globalPosition();
|
||||
}
|
||||
|
||||
QPoint OutputChangeSet::position() const
|
||||
{
|
||||
return d->position;
|
||||
}
|
||||
|
||||
bool OutputChangeSet::scaleChanged() const
|
||||
{
|
||||
return !qFuzzyCompare(d->scale, d->outputDevice->scaleF());
|
||||
}
|
||||
|
||||
qreal OutputChangeSet::scaleF() const
|
||||
{
|
||||
return d->scale;
|
||||
}
|
||||
|
||||
bool OutputChangeSet::colorCurvesChanged() const
|
||||
{
|
||||
return d->colorCurves != d->outputDevice->colorCurves();
|
||||
}
|
||||
|
||||
OutputDeviceInterface::ColorCurves OutputChangeSet::colorCurves() const
|
||||
{
|
||||
return d->colorCurves;
|
||||
}
|
||||
|
||||
bool OutputChangeSet::overscanChanged() const
|
||||
{
|
||||
return d->overscan != d->outputDevice->overscan();
|
||||
}
|
||||
|
||||
uint32_t OutputChangeSet::overscan() const
|
||||
{
|
||||
return d->overscan;
|
||||
}
|
||||
|
||||
bool OutputChangeSet::vrrPolicyChanged() const
|
||||
{
|
||||
return d->vrrPolicy != d->outputDevice->vrrPolicy();
|
||||
}
|
||||
|
||||
OutputDeviceInterface::VrrPolicy OutputChangeSet::vrrPolicy() const
|
||||
{
|
||||
return d->vrrPolicy;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2015 Sebastian Kügler <sebas@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "outputdevice_interface.h"
|
||||
#include <KWaylandServer/kwaylandserver_export.h>
|
||||
|
||||
namespace KWaylandServer
|
||||
{
|
||||
class OutputChangeSetPrivate;
|
||||
|
||||
/**
|
||||
* @brief Holds a set of changes to an OutputInterface or OutputDeviceInterface.
|
||||
*
|
||||
* This class implements a set of changes that the compositor can apply to an
|
||||
* OutputInterface after OutputConfiguration::apply has been called on the client
|
||||
* side. The changes are per-configuration.
|
||||
*
|
||||
* @see OutputConfiguration
|
||||
*/
|
||||
class KWAYLANDSERVER_EXPORT OutputChangeSet : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
~OutputChangeSet() override;
|
||||
/** Whether the enabled() property of the outputdevice changed.
|
||||
* @returns @c true if the enabled property of the outputdevice has changed.
|
||||
*/
|
||||
bool enabledChanged() const;
|
||||
|
||||
/** Whether the currentModeId() property of the outputdevice changed.
|
||||
* @returns @c true if the enabled property of the outputdevice has changed.
|
||||
* bool modeChanged() const;
|
||||
*/
|
||||
/** Whether the transform() property of the outputdevice changed. */
|
||||
bool transformChanged() const;
|
||||
|
||||
/** Whether the currentModeId() property of the outputdevice changed.
|
||||
* @returns @c true if the currentModeId() property of the outputdevice has changed.
|
||||
*/
|
||||
bool modeChanged() const;
|
||||
|
||||
/** Whether the globalPosition() property of the outputdevice changed.
|
||||
* @returns @c true if the globalPosition() property of the outputdevice has changed.
|
||||
*/
|
||||
bool positionChanged() const;
|
||||
|
||||
/** Whether the scale() property of the outputdevice changed.
|
||||
* @returns @c true if the scale() property of the outputdevice has changed.
|
||||
*/
|
||||
bool scaleChanged() const;
|
||||
|
||||
/** Whether the colorCurves() property of the outputdevice changed.
|
||||
* @returns @c true if the colorCurves() property of the outputdevice has changed.
|
||||
*/
|
||||
bool colorCurvesChanged() const;
|
||||
|
||||
/** Whether the overscan() property of the outputdevice changed.
|
||||
* @returns @c true if the overscan() property of the outputdevice has changed
|
||||
*/
|
||||
bool overscanChanged() const;
|
||||
|
||||
/**
|
||||
* Whether the vrrPolicy() property of the outputdevice changed.
|
||||
* @returns @c true if the vrrPolicy() property of the outputdevice has changed.
|
||||
*/
|
||||
bool vrrPolicyChanged() const;
|
||||
|
||||
/** The new value for enabled. */
|
||||
OutputDeviceInterface::Enablement enabled() const;
|
||||
|
||||
/** The new mode id.*/
|
||||
int mode() const;
|
||||
|
||||
/** The new value for transform. */
|
||||
OutputDeviceInterface::Transform transform() const;
|
||||
|
||||
/** The new value for globalPosition. */
|
||||
QPoint position() const;
|
||||
|
||||
/** The new value for scale.
|
||||
*/
|
||||
qreal scaleF() const;
|
||||
|
||||
/** The new value for colorCurves. */
|
||||
OutputDeviceInterface::ColorCurves colorCurves() const;
|
||||
|
||||
/** the overscan value in % */
|
||||
uint32_t overscan() const;
|
||||
|
||||
/** The new value for vrrPolicy */
|
||||
OutputDeviceInterface::VrrPolicy vrrPolicy() const;
|
||||
|
||||
private:
|
||||
friend class OutputConfigurationInterfacePrivate;
|
||||
explicit OutputChangeSet(OutputDeviceInterface *outputdevice, QObject *parent = nullptr);
|
||||
|
||||
QScopedPointer<OutputChangeSetPrivate> d;
|
||||
};
|
||||
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2015 Sebastian Kügler <sebas@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "outputchangeset.h"
|
||||
|
||||
namespace KWaylandServer
|
||||
{
|
||||
class OutputChangeSetPrivate
|
||||
{
|
||||
public:
|
||||
OutputChangeSetPrivate(OutputDeviceInterface *outputdevice, OutputChangeSet *parent);
|
||||
|
||||
OutputChangeSet *q;
|
||||
OutputDeviceInterface *outputDevice;
|
||||
|
||||
OutputDeviceInterface::Enablement enabled;
|
||||
int modeId;
|
||||
OutputDeviceInterface::Transform transform;
|
||||
QPoint position;
|
||||
qreal scale;
|
||||
OutputDeviceInterface::ColorCurves colorCurves;
|
||||
uint32_t overscan;
|
||||
OutputDeviceInterface::VrrPolicy vrrPolicy = OutputDeviceInterface::VrrPolicy::Automatic;
|
||||
};
|
||||
|
||||
}
|
|
@ -1,299 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
||||
SPDX-FileCopyrightText: 2015 Sebastian Kügler <sebas@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
#include "outputconfiguration_interface.h"
|
||||
#include "display.h"
|
||||
#include "logging.h"
|
||||
#include "outputchangeset_p.h"
|
||||
#include "outputdevice_interface.h"
|
||||
|
||||
#include "qwayland-server-org-kde-kwin-outputdevice.h"
|
||||
#include "qwayland-server-outputmanagement.h"
|
||||
#include <wayland-server.h>
|
||||
|
||||
#include <QSize>
|
||||
|
||||
namespace KWaylandServer
|
||||
{
|
||||
class OutputConfigurationInterfacePrivate : public QtWaylandServer::org_kde_kwin_outputconfiguration
|
||||
{
|
||||
public:
|
||||
OutputConfigurationInterfacePrivate(OutputConfigurationInterface *q, OutputManagementInterface *outputManagement, wl_resource *resource);
|
||||
|
||||
void sendApplied();
|
||||
void sendFailed();
|
||||
void emitConfigurationChangeRequested() const;
|
||||
void clearPendingChanges();
|
||||
|
||||
bool hasPendingChanges(OutputDeviceInterface *outputdevice) const;
|
||||
OutputChangeSet *pendingChanges(OutputDeviceInterface *outputdevice);
|
||||
|
||||
OutputManagementInterface *outputManagement;
|
||||
QHash<OutputDeviceInterface *, OutputChangeSet *> changes;
|
||||
OutputConfigurationInterface *q;
|
||||
|
||||
protected:
|
||||
void org_kde_kwin_outputconfiguration_enable(Resource *resource, wl_resource *outputdevice, int32_t enable) override;
|
||||
void org_kde_kwin_outputconfiguration_mode(Resource *resource, wl_resource *outputdevice, int32_t mode_id) override;
|
||||
void org_kde_kwin_outputconfiguration_transform(Resource *resource, wl_resource *outputdevice, int32_t transform) override;
|
||||
void org_kde_kwin_outputconfiguration_position(Resource *resource, wl_resource *outputdevice, int32_t x, int32_t y) override;
|
||||
void org_kde_kwin_outputconfiguration_scale(Resource *resource, wl_resource *outputdevice, int32_t scale) override;
|
||||
void org_kde_kwin_outputconfiguration_apply(Resource *resource) override;
|
||||
void org_kde_kwin_outputconfiguration_scalef(Resource *resource, wl_resource *outputdevice, wl_fixed_t scale) override;
|
||||
void org_kde_kwin_outputconfiguration_colorcurves(Resource *resource, wl_resource *outputdevice, wl_array *red, wl_array *green, wl_array *blue) override;
|
||||
void org_kde_kwin_outputconfiguration_set_vrr_policy(Resource *resource, wl_resource *outputdevice, uint32_t policy) override;
|
||||
void org_kde_kwin_outputconfiguration_destroy(Resource *resource) override;
|
||||
void org_kde_kwin_outputconfiguration_destroy_resource(Resource *resource) override;
|
||||
void org_kde_kwin_outputconfiguration_overscan(Resource *resource, wl_resource *outputdevice, uint32_t overscan) override;
|
||||
};
|
||||
|
||||
void OutputConfigurationInterfacePrivate::org_kde_kwin_outputconfiguration_enable(Resource *resource, wl_resource *outputdevice, int32_t enable)
|
||||
{
|
||||
Q_UNUSED(resource)
|
||||
auto _enable =
|
||||
(enable == ORG_KDE_KWIN_OUTPUTDEVICE_ENABLEMENT_ENABLED) ? OutputDeviceInterface::Enablement::Enabled : OutputDeviceInterface::Enablement::Disabled;
|
||||
|
||||
OutputDeviceInterface *output = OutputDeviceInterface::get(outputdevice);
|
||||
pendingChanges(output)->d->enabled = _enable;
|
||||
}
|
||||
|
||||
void OutputConfigurationInterfacePrivate::org_kde_kwin_outputconfiguration_mode(Resource *resource, wl_resource *outputdevice, int32_t mode_id)
|
||||
{
|
||||
Q_UNUSED(resource)
|
||||
OutputDeviceInterface *output = OutputDeviceInterface::get(outputdevice);
|
||||
|
||||
bool modeValid = false;
|
||||
for (const auto &m : output->modes()) {
|
||||
if (m.id == mode_id) {
|
||||
modeValid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!modeValid) {
|
||||
qCWarning(KWAYLAND_SERVER) << "Set invalid mode id:" << mode_id;
|
||||
return;
|
||||
}
|
||||
|
||||
pendingChanges(output)->d->modeId = mode_id;
|
||||
}
|
||||
|
||||
void OutputConfigurationInterfacePrivate::org_kde_kwin_outputconfiguration_transform(Resource *resource, wl_resource *outputdevice, int32_t transform)
|
||||
{
|
||||
Q_UNUSED(resource)
|
||||
auto toTransform = [transform]() {
|
||||
switch (transform) {
|
||||
case WL_OUTPUT_TRANSFORM_90:
|
||||
return OutputDeviceInterface::Transform::Rotated90;
|
||||
case WL_OUTPUT_TRANSFORM_180:
|
||||
return OutputDeviceInterface::Transform::Rotated180;
|
||||
case WL_OUTPUT_TRANSFORM_270:
|
||||
return OutputDeviceInterface::Transform::Rotated270;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED:
|
||||
return OutputDeviceInterface::Transform::Flipped;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||
return OutputDeviceInterface::Transform::Flipped90;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||
return OutputDeviceInterface::Transform::Flipped180;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||
return OutputDeviceInterface::Transform::Flipped270;
|
||||
case WL_OUTPUT_TRANSFORM_NORMAL:
|
||||
default:
|
||||
return OutputDeviceInterface::Transform::Normal;
|
||||
}
|
||||
};
|
||||
auto _transform = toTransform();
|
||||
OutputDeviceInterface *output = OutputDeviceInterface::get(outputdevice);
|
||||
pendingChanges(output)->d->transform = _transform;
|
||||
}
|
||||
|
||||
void OutputConfigurationInterfacePrivate::org_kde_kwin_outputconfiguration_position(Resource *resource, wl_resource *outputdevice, int32_t x, int32_t y)
|
||||
{
|
||||
Q_UNUSED(resource)
|
||||
auto _pos = QPoint(x, y);
|
||||
OutputDeviceInterface *output = OutputDeviceInterface::get(outputdevice);
|
||||
pendingChanges(output)->d->position = _pos;
|
||||
}
|
||||
|
||||
void OutputConfigurationInterfacePrivate::org_kde_kwin_outputconfiguration_scale(Resource *resource, wl_resource *outputdevice, int32_t scale)
|
||||
{
|
||||
Q_UNUSED(resource)
|
||||
if (scale <= 0) {
|
||||
qCWarning(KWAYLAND_SERVER) << "Requested to scale output device to" << scale << ", but I can't do that.";
|
||||
return;
|
||||
}
|
||||
OutputDeviceInterface *output = OutputDeviceInterface::get(outputdevice);
|
||||
|
||||
pendingChanges(output)->d->scale = scale;
|
||||
}
|
||||
|
||||
void OutputConfigurationInterfacePrivate::org_kde_kwin_outputconfiguration_apply(Resource *resource)
|
||||
{
|
||||
Q_UNUSED(resource)
|
||||
emitConfigurationChangeRequested();
|
||||
}
|
||||
|
||||
void OutputConfigurationInterfacePrivate::org_kde_kwin_outputconfiguration_scalef(Resource *resource, wl_resource *outputdevice, wl_fixed_t scale)
|
||||
{
|
||||
Q_UNUSED(resource)
|
||||
const qreal doubleScale = wl_fixed_to_double(scale);
|
||||
|
||||
if (doubleScale <= 0) {
|
||||
qCWarning(KWAYLAND_SERVER) << "Requested to scale output device to" << doubleScale << ", but I can't do that.";
|
||||
return;
|
||||
}
|
||||
OutputDeviceInterface *output = OutputDeviceInterface::get(outputdevice);
|
||||
|
||||
pendingChanges(output)->d->scale = doubleScale;
|
||||
}
|
||||
|
||||
void OutputConfigurationInterfacePrivate::org_kde_kwin_outputconfiguration_colorcurves(Resource *resource,
|
||||
wl_resource *outputdevice,
|
||||
wl_array *red,
|
||||
wl_array *green,
|
||||
wl_array *blue)
|
||||
{
|
||||
Q_UNUSED(resource)
|
||||
OutputDeviceInterface *output = OutputDeviceInterface::get(outputdevice);
|
||||
OutputDeviceInterface::ColorCurves oldCc = output->colorCurves();
|
||||
|
||||
auto checkArg = [](const wl_array *newColor, const QVector<quint16> &oldColor) {
|
||||
return (newColor->size % sizeof(uint16_t) == 0) && (newColor->size / sizeof(uint16_t) == static_cast<size_t>(oldColor.size()));
|
||||
};
|
||||
if (!checkArg(red, oldCc.red) || !checkArg(green, oldCc.green) || !checkArg(blue, oldCc.blue)) {
|
||||
qCWarning(KWAYLAND_SERVER) << "Requested to change color curves, but have wrong size.";
|
||||
return;
|
||||
}
|
||||
|
||||
OutputDeviceInterface::ColorCurves cc;
|
||||
|
||||
auto fillVector = [](const wl_array *array, QVector<quint16> *v) {
|
||||
const uint16_t *pos = (uint16_t *)array->data;
|
||||
|
||||
while ((char *)pos < (char *)array->data + array->size) {
|
||||
v->append(*pos);
|
||||
pos++;
|
||||
}
|
||||
};
|
||||
|
||||
fillVector(red, &cc.red);
|
||||
fillVector(green, &cc.green);
|
||||
fillVector(blue, &cc.blue);
|
||||
|
||||
pendingChanges(output)->d->colorCurves = cc;
|
||||
}
|
||||
|
||||
void OutputConfigurationInterfacePrivate::org_kde_kwin_outputconfiguration_overscan(Resource *resource, wl_resource *outputdevice, uint32_t overscan)
|
||||
{
|
||||
Q_UNUSED(resource)
|
||||
if (overscan > 100) {
|
||||
qCWarning(KWAYLAND_SERVER) << "Invalid overscan requested:" << overscan;
|
||||
return;
|
||||
}
|
||||
OutputDeviceInterface *output = OutputDeviceInterface::get(outputdevice);
|
||||
pendingChanges(output)->d->overscan = overscan;
|
||||
}
|
||||
|
||||
void OutputConfigurationInterfacePrivate::org_kde_kwin_outputconfiguration_set_vrr_policy(Resource *resource, wl_resource *outputdevice, uint32_t policy)
|
||||
{
|
||||
Q_UNUSED(resource)
|
||||
if (policy > static_cast<uint32_t>(OutputDeviceInterface::VrrPolicy::Automatic)) {
|
||||
qCWarning(KWAYLAND_SERVER) << "Invalid Vrr Policy requested:" << policy;
|
||||
return;
|
||||
}
|
||||
OutputDeviceInterface *output = OutputDeviceInterface::get(outputdevice);
|
||||
pendingChanges(output)->d->vrrPolicy = static_cast<OutputDeviceInterface::VrrPolicy>(policy);
|
||||
}
|
||||
|
||||
void OutputConfigurationInterfacePrivate::org_kde_kwin_outputconfiguration_destroy(Resource *resource)
|
||||
{
|
||||
wl_resource_destroy(resource->handle);
|
||||
}
|
||||
|
||||
void OutputConfigurationInterfacePrivate::org_kde_kwin_outputconfiguration_destroy_resource(Resource *resource)
|
||||
{
|
||||
Q_UNUSED(resource)
|
||||
delete q;
|
||||
}
|
||||
|
||||
void OutputConfigurationInterfacePrivate::emitConfigurationChangeRequested() const
|
||||
{
|
||||
auto configinterface = reinterpret_cast<OutputConfigurationInterface *>(q);
|
||||
Q_EMIT outputManagement->configurationChangeRequested(configinterface);
|
||||
}
|
||||
|
||||
OutputConfigurationInterfacePrivate::OutputConfigurationInterfacePrivate(OutputConfigurationInterface *q,
|
||||
OutputManagementInterface *outputManagement,
|
||||
wl_resource *resource)
|
||||
: QtWaylandServer::org_kde_kwin_outputconfiguration(resource)
|
||||
, outputManagement(outputManagement)
|
||||
, q(q)
|
||||
{
|
||||
}
|
||||
|
||||
QHash<OutputDeviceInterface *, OutputChangeSet *> OutputConfigurationInterface::changes() const
|
||||
{
|
||||
return d->changes;
|
||||
}
|
||||
|
||||
void OutputConfigurationInterface::setApplied()
|
||||
{
|
||||
d->clearPendingChanges();
|
||||
d->sendApplied();
|
||||
}
|
||||
|
||||
void OutputConfigurationInterfacePrivate::sendApplied()
|
||||
{
|
||||
send_applied();
|
||||
}
|
||||
|
||||
void OutputConfigurationInterface::setFailed()
|
||||
{
|
||||
d->clearPendingChanges();
|
||||
d->sendFailed();
|
||||
}
|
||||
|
||||
void OutputConfigurationInterfacePrivate::sendFailed()
|
||||
{
|
||||
send_failed();
|
||||
}
|
||||
|
||||
OutputChangeSet *OutputConfigurationInterfacePrivate::pendingChanges(OutputDeviceInterface *outputdevice)
|
||||
{
|
||||
auto &change = changes[outputdevice];
|
||||
if (!change) {
|
||||
change = new OutputChangeSet(outputdevice, q);
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
bool OutputConfigurationInterfacePrivate::hasPendingChanges(OutputDeviceInterface *outputdevice) const
|
||||
{
|
||||
auto it = changes.constFind(outputdevice);
|
||||
if (it == changes.constEnd()) {
|
||||
return false;
|
||||
}
|
||||
auto c = *it;
|
||||
return c->enabledChanged() || c->modeChanged() || c->transformChanged() || c->positionChanged() || c->scaleChanged();
|
||||
}
|
||||
|
||||
void OutputConfigurationInterfacePrivate::clearPendingChanges()
|
||||
{
|
||||
qDeleteAll(changes.begin(), changes.end());
|
||||
changes.clear();
|
||||
}
|
||||
|
||||
OutputConfigurationInterface::OutputConfigurationInterface(OutputManagementInterface *parent, wl_resource *resource)
|
||||
: QObject()
|
||||
, d(new OutputConfigurationInterfacePrivate(this, parent, resource))
|
||||
{
|
||||
}
|
||||
|
||||
OutputConfigurationInterface::~OutputConfigurationInterface()
|
||||
{
|
||||
d->clearPendingChanges();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2015 Sebastian Kügler <sebas@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "outputchangeset.h"
|
||||
#include "outputdevice_interface.h"
|
||||
#include "outputmanagement_interface.h"
|
||||
|
||||
#include <KWaylandServer/kwaylandserver_export.h>
|
||||
|
||||
namespace KWaylandServer
|
||||
{
|
||||
class OutputConfigurationInterfacePrivate;
|
||||
|
||||
/** @class OutputConfigurationInterface
|
||||
*
|
||||
* Holds a new configuration for the outputs.
|
||||
*
|
||||
* The overall mechanism is to get a new OutputConfiguration from the OutputManagement global and
|
||||
* apply changes through the OutputConfiguration::set* calls. When all changes are set, the client
|
||||
* calls apply, which asks the server to look at the changes and apply them. The server will then
|
||||
* signal back whether the changes have been applied successfully (@c setApplied()) or were rejected
|
||||
* or failed to apply (@c setFailed()).
|
||||
*
|
||||
* Once the client has called applied, the OutputManagementInterface send the configuration object
|
||||
* to the compositor through the OutputManagement::configurationChangeRequested(OutputConfiguration*)
|
||||
* signal, the compositor can then decide what to do with the changes.
|
||||
*
|
||||
* These KWayland classes will not apply changes to the OutputDevices, this is the compositor's
|
||||
* task. As such, the configuration set through this interface can be seen as a hint what the
|
||||
* compositor should set up, but whether or not the compositor does it (based on hardware or
|
||||
* rendering policies, for example), is up to the compositor. The mode setting is passed on to
|
||||
* the DRM subsystem through the compositor. The compositor also saves this configuration and reads
|
||||
* it on startup, this interface is not involved in that process.
|
||||
*
|
||||
* @see OutputManagementInterface
|
||||
* @see OutputConfiguration
|
||||
*/
|
||||
class KWAYLANDSERVER_EXPORT OutputConfigurationInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
~OutputConfigurationInterface() override;
|
||||
|
||||
/**
|
||||
* Accessor for the changes made to OutputDevices. The data returned from this call
|
||||
* will be deleted by the OutputConfigurationInterface when
|
||||
* OutputManagementInterface::setApplied() or OutputManagementInterface::setFailed()
|
||||
* is called, and on destruction of the OutputConfigurationInterface, so make sure you
|
||||
* do not keep these pointers around.
|
||||
* @returns A QHash of ChangeSets per outputdevice.
|
||||
* @see ChangeSet
|
||||
* @see OutputDeviceInterface
|
||||
* @see OutputManagement
|
||||
*/
|
||||
QHash<OutputDeviceInterface *, OutputChangeSet *> changes() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* Called by the compositor once the changes have successfully been applied.
|
||||
* The compositor is responsible for updating the OutputDevices. After having
|
||||
* done so, calling this function sends applied() through the client.
|
||||
* @see setFailed
|
||||
* @see OutputConfiguration::applied
|
||||
*/
|
||||
void setApplied();
|
||||
/**
|
||||
* Called by the compositor when the changes as a whole are rejected or
|
||||
* failed to apply. This function results in the client OutputConfiguration emitting
|
||||
* failed().
|
||||
* @see setApplied
|
||||
* @see OutputConfiguration::failed
|
||||
*/
|
||||
void setFailed();
|
||||
|
||||
private:
|
||||
explicit OutputConfigurationInterface(OutputManagementInterface *parent, wl_resource *resource);
|
||||
friend class OutputManagementInterfacePrivate;
|
||||
|
||||
QScopedPointer<OutputConfigurationInterfacePrivate> d;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(KWaylandServer::OutputConfigurationInterface *)
|
|
@ -1,740 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
#include "outputdevice_interface.h"
|
||||
#include "display.h"
|
||||
#include "display_p.h"
|
||||
#include "logging.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "qwayland-server-org-kde-kwin-outputdevice.h"
|
||||
#include <QDebug>
|
||||
#include <QPointer>
|
||||
#include <QString>
|
||||
|
||||
namespace KWaylandServer
|
||||
{
|
||||
static const quint32 s_version = 4;
|
||||
|
||||
class OutputDeviceInterfacePrivate : public QtWaylandServer::org_kde_kwin_outputdevice
|
||||
{
|
||||
public:
|
||||
OutputDeviceInterfacePrivate(OutputDeviceInterface *q, Display *display);
|
||||
|
||||
void updateGeometry();
|
||||
void updateUuid();
|
||||
void updateEdid();
|
||||
void updateEnabled();
|
||||
void updateScale();
|
||||
void updateColorCurves();
|
||||
void updateEisaId();
|
||||
void updateSerialNumber();
|
||||
void updateCapabilities();
|
||||
void updateOverscan();
|
||||
void updateVrrPolicy();
|
||||
|
||||
void sendGeometry(Resource *resource);
|
||||
void sendMode(Resource *resource, const OutputDeviceInterface::Mode &mode);
|
||||
void sendDone(Resource *resource);
|
||||
void sendUuid(Resource *resource);
|
||||
void sendEdid(Resource *resource);
|
||||
void sendEnabled(Resource *resource);
|
||||
void sendScale(Resource *resource);
|
||||
void sendColorCurves(Resource *resource);
|
||||
void sendEisaId(Resource *resource);
|
||||
void sendSerialNumber(Resource *resource);
|
||||
void sendCapabilities(Resource *resource);
|
||||
void sendOverscan(Resource *resource);
|
||||
void sendVrrPolicy(Resource *resource);
|
||||
|
||||
static OutputDeviceInterface *get(wl_resource *native);
|
||||
|
||||
QSize physicalSize;
|
||||
QPoint globalPosition;
|
||||
QString manufacturer = QStringLiteral("org.kde.kwin");
|
||||
QString model = QStringLiteral("none");
|
||||
qreal scale = 1.0;
|
||||
QString serialNumber;
|
||||
QString eisaId;
|
||||
OutputDeviceInterface::SubPixel subPixel = OutputDeviceInterface::SubPixel::Unknown;
|
||||
OutputDeviceInterface::Transform transform = OutputDeviceInterface::Transform::Normal;
|
||||
OutputDeviceInterface::ColorCurves colorCurves;
|
||||
QList<OutputDeviceInterface::Mode> modes;
|
||||
OutputDeviceInterface::Mode currentMode;
|
||||
QByteArray edid;
|
||||
OutputDeviceInterface::Enablement enabled = OutputDeviceInterface::Enablement::Enabled;
|
||||
QUuid uuid;
|
||||
OutputDeviceInterface::Capabilities capabilities;
|
||||
uint32_t overscan = 0;
|
||||
OutputDeviceInterface::VrrPolicy vrrPolicy = OutputDeviceInterface::VrrPolicy::Automatic;
|
||||
QPointer<Display> display;
|
||||
OutputDeviceInterface *q;
|
||||
|
||||
private:
|
||||
int32_t toTransform() const;
|
||||
int32_t toSubPixel() const;
|
||||
|
||||
protected:
|
||||
void org_kde_kwin_outputdevice_destroy_global() override;
|
||||
void org_kde_kwin_outputdevice_bind_resource(Resource *resource) override;
|
||||
};
|
||||
|
||||
void OutputDeviceInterfacePrivate::org_kde_kwin_outputdevice_destroy_global()
|
||||
{
|
||||
delete q;
|
||||
}
|
||||
|
||||
OutputDeviceInterfacePrivate::OutputDeviceInterfacePrivate(OutputDeviceInterface *q, Display *display)
|
||||
: QtWaylandServer::org_kde_kwin_outputdevice(*display, s_version)
|
||||
, display(display)
|
||||
, q(q)
|
||||
{
|
||||
}
|
||||
|
||||
OutputDeviceInterface::OutputDeviceInterface(Display *display, QObject *parent)
|
||||
: QObject(parent)
|
||||
, d(new OutputDeviceInterfacePrivate(this, display))
|
||||
{
|
||||
connect(this, &OutputDeviceInterface::currentModeChanged, this, [this] {
|
||||
Q_ASSERT(d->currentMode.id >= 0);
|
||||
const auto clientResources = d->resourceMap();
|
||||
for (auto resource : clientResources) {
|
||||
d->sendMode(resource, d->currentMode);
|
||||
d->sendDone(resource);
|
||||
}
|
||||
});
|
||||
connect(this, &OutputDeviceInterface::subPixelChanged, this, [this] {
|
||||
d->updateGeometry();
|
||||
});
|
||||
connect(this, &OutputDeviceInterface::transformChanged, this, [this] {
|
||||
d->updateGeometry();
|
||||
});
|
||||
connect(this, &OutputDeviceInterface::globalPositionChanged, this, [this] {
|
||||
d->updateGeometry();
|
||||
});
|
||||
connect(this, &OutputDeviceInterface::modelChanged, this, [this] {
|
||||
d->updateGeometry();
|
||||
});
|
||||
connect(this, &OutputDeviceInterface::manufacturerChanged, this, [this] {
|
||||
d->updateGeometry();
|
||||
});
|
||||
connect(this, &OutputDeviceInterface::scaleFChanged, this, [this] {
|
||||
d->updateScale();
|
||||
});
|
||||
connect(this, &OutputDeviceInterface::colorCurvesChanged, this, [this] {
|
||||
d->updateColorCurves();
|
||||
});
|
||||
|
||||
DisplayPrivate *displayPrivate = DisplayPrivate::get(display);
|
||||
displayPrivate->outputdevices.append(this);
|
||||
}
|
||||
|
||||
OutputDeviceInterface::~OutputDeviceInterface()
|
||||
{
|
||||
remove();
|
||||
}
|
||||
|
||||
void OutputDeviceInterface::remove()
|
||||
{
|
||||
if (d->isGlobalRemoved()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (d->display) {
|
||||
DisplayPrivate *displayPrivate = DisplayPrivate::get(d->display);
|
||||
displayPrivate->outputdevices.removeOne(this);
|
||||
}
|
||||
|
||||
d->globalRemove();
|
||||
}
|
||||
|
||||
QSize OutputDeviceInterface::pixelSize() const
|
||||
{
|
||||
if (d->currentMode.id == -1) {
|
||||
return QSize();
|
||||
}
|
||||
return d->currentMode.size;
|
||||
}
|
||||
|
||||
int OutputDeviceInterface::refreshRate() const
|
||||
{
|
||||
if (d->currentMode.id == -1) {
|
||||
return 60000;
|
||||
}
|
||||
return d->currentMode.refreshRate;
|
||||
}
|
||||
|
||||
void OutputDeviceInterface::addMode(Mode &mode)
|
||||
{
|
||||
Q_ASSERT(mode.id >= 0);
|
||||
Q_ASSERT(mode.size.isValid());
|
||||
|
||||
auto currentModeIt = std::find_if(d->modes.begin(), d->modes.end(), [](const Mode &mode) {
|
||||
return mode.flags.testFlag(ModeFlag::Current);
|
||||
});
|
||||
if (currentModeIt == d->modes.end() && !mode.flags.testFlag(ModeFlag::Current)) {
|
||||
// no mode with current flag - enforce
|
||||
mode.flags |= ModeFlag::Current;
|
||||
}
|
||||
if (currentModeIt != d->modes.end() && mode.flags.testFlag(ModeFlag::Current)) {
|
||||
// another mode has the current flag - remove
|
||||
(*currentModeIt).flags &= ~uint(ModeFlag::Current);
|
||||
}
|
||||
|
||||
if (mode.flags.testFlag(ModeFlag::Preferred)) {
|
||||
// remove from existing Preferred mode
|
||||
auto preferredIt = std::find_if(d->modes.begin(), d->modes.end(), [](const Mode &mode) {
|
||||
return mode.flags.testFlag(ModeFlag::Preferred);
|
||||
});
|
||||
if (preferredIt != d->modes.end()) {
|
||||
(*preferredIt).flags &= ~uint(ModeFlag::Preferred);
|
||||
}
|
||||
}
|
||||
|
||||
auto existingModeIt = std::find_if(d->modes.begin(), d->modes.end(), [mode](const Mode &mode_it) {
|
||||
return mode.size == mode_it.size && mode.refreshRate == mode_it.refreshRate && mode.id == mode_it.id;
|
||||
});
|
||||
auto emitChanges = [this, mode] {
|
||||
Q_EMIT modesChanged();
|
||||
if (mode.flags.testFlag(ModeFlag::Current)) {
|
||||
d->currentMode = mode;
|
||||
Q_EMIT refreshRateChanged(mode.refreshRate);
|
||||
Q_EMIT pixelSizeChanged(mode.size);
|
||||
Q_EMIT currentModeChanged();
|
||||
}
|
||||
};
|
||||
if (existingModeIt != d->modes.end()) {
|
||||
if ((*existingModeIt).flags == mode.flags) {
|
||||
// nothing to do
|
||||
return;
|
||||
}
|
||||
(*existingModeIt).flags = mode.flags;
|
||||
emitChanges();
|
||||
return;
|
||||
} else {
|
||||
auto idIt = std::find_if(d->modes.constBegin(), d->modes.constEnd(), [mode](const Mode &mode_it) {
|
||||
return mode.id == mode_it.id;
|
||||
});
|
||||
if (idIt != d->modes.constEnd()) {
|
||||
qCWarning(KWAYLAND_SERVER) << "Duplicate Mode id" << mode.id << ": not adding mode" << mode.size << mode.refreshRate;
|
||||
return;
|
||||
}
|
||||
}
|
||||
d->modes << mode;
|
||||
emitChanges();
|
||||
}
|
||||
|
||||
void OutputDeviceInterface::setCurrentMode(const int modeId)
|
||||
{
|
||||
auto currentModeIt = std::find_if(d->modes.begin(), d->modes.end(), [](const Mode &mode) {
|
||||
return mode.flags.testFlag(ModeFlag::Current);
|
||||
});
|
||||
if (currentModeIt != d->modes.end()) {
|
||||
// another mode has the current flag - remove
|
||||
(*currentModeIt).flags &= ~uint(ModeFlag::Current);
|
||||
}
|
||||
|
||||
auto existingModeIt = std::find_if(d->modes.begin(), d->modes.end(), [modeId](const Mode &mode) {
|
||||
return mode.id == modeId;
|
||||
});
|
||||
|
||||
Q_ASSERT(existingModeIt != d->modes.end());
|
||||
(*existingModeIt).flags |= ModeFlag::Current;
|
||||
d->currentMode = *existingModeIt;
|
||||
Q_EMIT modesChanged();
|
||||
Q_EMIT refreshRateChanged((*existingModeIt).refreshRate);
|
||||
Q_EMIT pixelSizeChanged((*existingModeIt).size);
|
||||
Q_EMIT currentModeChanged();
|
||||
}
|
||||
|
||||
bool OutputDeviceInterface::setCurrentMode(const QSize &size, int refreshRate)
|
||||
{
|
||||
auto mode = std::find_if(d->modes.constBegin(), d->modes.constEnd(), [size, refreshRate](const Mode &mode) {
|
||||
return mode.size == size && mode.refreshRate == refreshRate;
|
||||
});
|
||||
if (mode == d->modes.constEnd()) {
|
||||
return false;
|
||||
}
|
||||
setCurrentMode((*mode).id);
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t OutputDeviceInterfacePrivate::toTransform() const
|
||||
{
|
||||
switch (transform) {
|
||||
case OutputDeviceInterface::Transform::Normal:
|
||||
return WL_OUTPUT_TRANSFORM_NORMAL;
|
||||
case OutputDeviceInterface::Transform::Rotated90:
|
||||
return WL_OUTPUT_TRANSFORM_90;
|
||||
case OutputDeviceInterface::Transform::Rotated180:
|
||||
return WL_OUTPUT_TRANSFORM_180;
|
||||
case OutputDeviceInterface::Transform::Rotated270:
|
||||
return WL_OUTPUT_TRANSFORM_270;
|
||||
case OutputDeviceInterface::Transform::Flipped:
|
||||
return WL_OUTPUT_TRANSFORM_FLIPPED;
|
||||
case OutputDeviceInterface::Transform::Flipped90:
|
||||
return WL_OUTPUT_TRANSFORM_FLIPPED_90;
|
||||
case OutputDeviceInterface::Transform::Flipped180:
|
||||
return WL_OUTPUT_TRANSFORM_FLIPPED_180;
|
||||
case OutputDeviceInterface::Transform::Flipped270:
|
||||
return WL_OUTPUT_TRANSFORM_FLIPPED_270;
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
int32_t OutputDeviceInterfacePrivate::toSubPixel() const
|
||||
{
|
||||
switch (subPixel) {
|
||||
case OutputDeviceInterface::SubPixel::Unknown:
|
||||
return WL_OUTPUT_SUBPIXEL_UNKNOWN;
|
||||
case OutputDeviceInterface::SubPixel::None:
|
||||
return WL_OUTPUT_SUBPIXEL_NONE;
|
||||
case OutputDeviceInterface::SubPixel::HorizontalRGB:
|
||||
return WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB;
|
||||
case OutputDeviceInterface::SubPixel::HorizontalBGR:
|
||||
return WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR;
|
||||
case OutputDeviceInterface::SubPixel::VerticalRGB:
|
||||
return WL_OUTPUT_SUBPIXEL_VERTICAL_RGB;
|
||||
case OutputDeviceInterface::SubPixel::VerticalBGR:
|
||||
return WL_OUTPUT_SUBPIXEL_VERTICAL_BGR;
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::org_kde_kwin_outputdevice_bind_resource(Resource *resource)
|
||||
{
|
||||
sendGeometry(resource);
|
||||
sendScale(resource);
|
||||
sendColorCurves(resource);
|
||||
sendEisaId(resource);
|
||||
sendSerialNumber(resource);
|
||||
|
||||
auto currentModeIt = modes.constEnd();
|
||||
for (auto it = modes.constBegin(); it != modes.constEnd(); ++it) {
|
||||
const OutputDeviceInterface::Mode &mode = *it;
|
||||
if (mode.flags.testFlag(OutputDeviceInterface::ModeFlag::Current)) {
|
||||
// needs to be sent as last mode
|
||||
currentModeIt = it;
|
||||
continue;
|
||||
}
|
||||
sendMode(resource, mode);
|
||||
}
|
||||
|
||||
if (currentModeIt != modes.constEnd()) {
|
||||
sendMode(resource, *currentModeIt);
|
||||
}
|
||||
|
||||
sendUuid(resource);
|
||||
sendEdid(resource);
|
||||
sendEnabled(resource);
|
||||
sendCapabilities(resource);
|
||||
sendOverscan(resource);
|
||||
sendVrrPolicy(resource);
|
||||
sendDone(resource);
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::sendMode(Resource *resource, const OutputDeviceInterface::Mode &mode)
|
||||
{
|
||||
int32_t flags = 0;
|
||||
if (mode.flags.testFlag(OutputDeviceInterface::ModeFlag::Current)) {
|
||||
flags |= WL_OUTPUT_MODE_CURRENT;
|
||||
}
|
||||
if (mode.flags.testFlag(OutputDeviceInterface::ModeFlag::Preferred)) {
|
||||
flags |= WL_OUTPUT_MODE_PREFERRED;
|
||||
}
|
||||
send_mode(resource->handle, flags, mode.size.width(), mode.size.height(), mode.refreshRate, mode.id);
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::sendGeometry(Resource *resource)
|
||||
{
|
||||
send_geometry(resource->handle,
|
||||
globalPosition.x(),
|
||||
globalPosition.y(),
|
||||
physicalSize.width(),
|
||||
physicalSize.height(),
|
||||
toSubPixel(),
|
||||
manufacturer,
|
||||
model,
|
||||
toTransform());
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::sendScale(Resource *resource)
|
||||
{
|
||||
if (resource->version() < ORG_KDE_KWIN_OUTPUTDEVICE_SCALEF_SINCE_VERSION) {
|
||||
send_scale(resource->handle, qRound(scale));
|
||||
} else {
|
||||
send_scalef(resource->handle, wl_fixed_from_double(scale));
|
||||
}
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::sendColorCurves(Resource *resource)
|
||||
{
|
||||
if (resource->version() < ORG_KDE_KWIN_OUTPUTDEVICE_COLORCURVES_SINCE_VERSION) {
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray red = QByteArray::fromRawData(reinterpret_cast<const char *>(colorCurves.red.constData()), sizeof(quint16) * colorCurves.red.size());
|
||||
|
||||
QByteArray green = QByteArray::fromRawData(reinterpret_cast<const char *>(colorCurves.green.constData()), sizeof(quint16) * colorCurves.green.size());
|
||||
|
||||
QByteArray blue = QByteArray::fromRawData(reinterpret_cast<const char *>(colorCurves.blue.constData()), sizeof(quint16) * colorCurves.blue.size());
|
||||
|
||||
send_colorcurves(resource->handle, red, green, blue);
|
||||
}
|
||||
|
||||
void KWaylandServer::OutputDeviceInterfacePrivate::sendSerialNumber(Resource *resource)
|
||||
{
|
||||
if (resource->version() >= ORG_KDE_KWIN_OUTPUTDEVICE_SERIAL_NUMBER_SINCE_VERSION) {
|
||||
send_serial_number(resource->handle, serialNumber);
|
||||
}
|
||||
}
|
||||
|
||||
void KWaylandServer::OutputDeviceInterfacePrivate::sendEisaId(Resource *resource)
|
||||
{
|
||||
if (resource->version() >= ORG_KDE_KWIN_OUTPUTDEVICE_EISA_ID_SINCE_VERSION) {
|
||||
send_eisa_id(resource->handle, eisaId);
|
||||
}
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::sendDone(Resource *resource)
|
||||
{
|
||||
send_done(resource->handle);
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::updateGeometry()
|
||||
{
|
||||
const auto clientResources = resourceMap();
|
||||
for (auto resource : clientResources) {
|
||||
sendGeometry(resource);
|
||||
sendDone(resource);
|
||||
}
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::updateScale()
|
||||
{
|
||||
const auto clientResources = resourceMap();
|
||||
for (auto resource : clientResources) {
|
||||
sendScale(resource);
|
||||
sendDone(resource);
|
||||
}
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::updateColorCurves()
|
||||
{
|
||||
const auto clientResources = resourceMap();
|
||||
for (auto resource : clientResources) {
|
||||
sendColorCurves(resource);
|
||||
sendDone(resource);
|
||||
}
|
||||
}
|
||||
|
||||
bool OutputDeviceInterface::ColorCurves::operator==(const ColorCurves &cc) const
|
||||
{
|
||||
return red == cc.red && green == cc.green && blue == cc.blue;
|
||||
}
|
||||
bool OutputDeviceInterface::ColorCurves::operator!=(const ColorCurves &cc) const
|
||||
{
|
||||
return !operator==(cc);
|
||||
}
|
||||
|
||||
#define SETTER(setterName, type, argumentName) \
|
||||
void OutputDeviceInterface::setterName(type arg) \
|
||||
{ \
|
||||
if (d->argumentName == arg) { \
|
||||
return; \
|
||||
} \
|
||||
d->argumentName = arg; \
|
||||
Q_EMIT argumentName##Changed(d->argumentName); \
|
||||
}
|
||||
|
||||
SETTER(setPhysicalSize, const QSize &, physicalSize)
|
||||
SETTER(setGlobalPosition, const QPoint &, globalPosition)
|
||||
SETTER(setManufacturer, const QString &, manufacturer)
|
||||
SETTER(setModel, const QString &, model)
|
||||
SETTER(setSerialNumber, const QString &, serialNumber)
|
||||
SETTER(setEisaId, const QString &, eisaId)
|
||||
SETTER(setSubPixel, SubPixel, subPixel)
|
||||
SETTER(setTransform, Transform, transform)
|
||||
|
||||
#undef SETTER
|
||||
|
||||
void OutputDeviceInterface::setScaleF(qreal scale)
|
||||
{
|
||||
if (qFuzzyCompare(d->scale, scale)) {
|
||||
return;
|
||||
}
|
||||
d->scale = scale;
|
||||
Q_EMIT scaleFChanged(d->scale);
|
||||
}
|
||||
|
||||
QSize OutputDeviceInterface::physicalSize() const
|
||||
{
|
||||
return d->physicalSize;
|
||||
}
|
||||
|
||||
QPoint OutputDeviceInterface::globalPosition() const
|
||||
{
|
||||
return d->globalPosition;
|
||||
}
|
||||
|
||||
QString OutputDeviceInterface::manufacturer() const
|
||||
{
|
||||
return d->manufacturer;
|
||||
}
|
||||
|
||||
QString OutputDeviceInterface::model() const
|
||||
{
|
||||
return d->model;
|
||||
}
|
||||
|
||||
QString OutputDeviceInterface::serialNumber() const
|
||||
{
|
||||
return d->serialNumber;
|
||||
}
|
||||
|
||||
QString OutputDeviceInterface::eisaId() const
|
||||
{
|
||||
return d->eisaId;
|
||||
}
|
||||
|
||||
qreal OutputDeviceInterface::scaleF() const
|
||||
{
|
||||
return d->scale;
|
||||
}
|
||||
|
||||
OutputDeviceInterface::SubPixel OutputDeviceInterface::subPixel() const
|
||||
{
|
||||
return d->subPixel;
|
||||
}
|
||||
|
||||
OutputDeviceInterface::Transform OutputDeviceInterface::transform() const
|
||||
{
|
||||
return d->transform;
|
||||
}
|
||||
|
||||
OutputDeviceInterface::ColorCurves OutputDeviceInterface::colorCurves() const
|
||||
{
|
||||
return d->colorCurves;
|
||||
}
|
||||
|
||||
QList<OutputDeviceInterface::Mode> OutputDeviceInterface::modes() const
|
||||
{
|
||||
return d->modes;
|
||||
}
|
||||
|
||||
int OutputDeviceInterface::currentModeId() const
|
||||
{
|
||||
for (const Mode &m : d->modes) {
|
||||
if (m.flags.testFlag(OutputDeviceInterface::ModeFlag::Current)) {
|
||||
return m.id;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void OutputDeviceInterface::setColorCurves(const ColorCurves &colorCurves)
|
||||
{
|
||||
if (d->colorCurves == colorCurves) {
|
||||
return;
|
||||
}
|
||||
d->colorCurves = colorCurves;
|
||||
Q_EMIT colorCurvesChanged(d->colorCurves);
|
||||
}
|
||||
|
||||
void OutputDeviceInterface::setEdid(const QByteArray &edid)
|
||||
{
|
||||
d->edid = edid;
|
||||
d->updateEdid();
|
||||
Q_EMIT edidChanged();
|
||||
}
|
||||
|
||||
QByteArray OutputDeviceInterface::edid() const
|
||||
{
|
||||
return d->edid;
|
||||
}
|
||||
|
||||
void OutputDeviceInterface::setEnabled(OutputDeviceInterface::Enablement enabled)
|
||||
{
|
||||
if (d->enabled != enabled) {
|
||||
d->enabled = enabled;
|
||||
d->updateEnabled();
|
||||
Q_EMIT enabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
OutputDeviceInterface::Enablement OutputDeviceInterface::enabled() const
|
||||
{
|
||||
return d->enabled;
|
||||
}
|
||||
|
||||
void OutputDeviceInterface::setUuid(const QUuid &uuid)
|
||||
{
|
||||
if (d->uuid != uuid) {
|
||||
d->uuid = uuid;
|
||||
d->updateUuid();
|
||||
Q_EMIT uuidChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QUuid OutputDeviceInterface::uuid() const
|
||||
{
|
||||
return d->uuid;
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::sendEdid(Resource *resource)
|
||||
{
|
||||
send_edid(resource->handle, QString::fromStdString(edid.toBase64().toStdString()));
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::sendEnabled(Resource *resource)
|
||||
{
|
||||
int32_t _enabled = 0;
|
||||
if (enabled == OutputDeviceInterface::Enablement::Enabled) {
|
||||
_enabled = 1;
|
||||
}
|
||||
send_enabled(resource->handle, _enabled);
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::sendUuid(Resource *resource)
|
||||
{
|
||||
send_uuid(resource->handle, uuid.toString(QUuid::WithoutBraces));
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::updateEnabled()
|
||||
{
|
||||
const auto clientResources = resourceMap();
|
||||
for (auto resource : clientResources) {
|
||||
sendEnabled(resource);
|
||||
}
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::updateEdid()
|
||||
{
|
||||
const auto clientResources = resourceMap();
|
||||
for (auto resource : clientResources) {
|
||||
sendEdid(resource);
|
||||
}
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::updateUuid()
|
||||
{
|
||||
const auto clientResources = resourceMap();
|
||||
for (auto resource : clientResources) {
|
||||
sendUuid(resource);
|
||||
}
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::updateEisaId()
|
||||
{
|
||||
const auto clientResources = resourceMap();
|
||||
for (auto resource : clientResources) {
|
||||
sendEisaId(resource);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t OutputDeviceInterface::overscan() const
|
||||
{
|
||||
return d->overscan;
|
||||
}
|
||||
|
||||
OutputDeviceInterface::Capabilities OutputDeviceInterface::capabilities() const
|
||||
{
|
||||
return d->capabilities;
|
||||
}
|
||||
|
||||
void OutputDeviceInterface::setCapabilities(Capabilities cap)
|
||||
{
|
||||
if (d->capabilities != cap) {
|
||||
d->capabilities = cap;
|
||||
d->updateCapabilities();
|
||||
Q_EMIT capabilitiesChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::sendCapabilities(Resource *resource)
|
||||
{
|
||||
if (resource->version() < ORG_KDE_KWIN_OUTPUTDEVICE_CAPABILITIES_SINCE_VERSION) {
|
||||
return;
|
||||
}
|
||||
send_capabilities(resource->handle, static_cast<uint32_t>(capabilities));
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::updateCapabilities()
|
||||
{
|
||||
const auto clientResources = resourceMap();
|
||||
for (const auto &resource : clientResources) {
|
||||
sendCapabilities(resource);
|
||||
}
|
||||
}
|
||||
|
||||
void OutputDeviceInterface::setOverscan(uint32_t overscan)
|
||||
{
|
||||
if (d->overscan != overscan) {
|
||||
d->overscan = overscan;
|
||||
d->updateOverscan();
|
||||
Q_EMIT overscanChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::sendOverscan(Resource *resource)
|
||||
{
|
||||
if (resource->version() < ORG_KDE_KWIN_OUTPUTDEVICE_OVERSCAN_SINCE_VERSION) {
|
||||
return;
|
||||
}
|
||||
send_overscan(resource->handle, static_cast<uint32_t>(overscan));
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::updateOverscan()
|
||||
{
|
||||
const auto clientResources = resourceMap();
|
||||
for (const auto &resource : clientResources) {
|
||||
sendOverscan(resource);
|
||||
}
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::sendVrrPolicy(Resource *resource)
|
||||
{
|
||||
if (resource->version() < ORG_KDE_KWIN_OUTPUTDEVICE_VRR_POLICY_SINCE_VERSION) {
|
||||
return;
|
||||
}
|
||||
send_vrr_policy(resource->handle, static_cast<uint32_t>(vrrPolicy));
|
||||
}
|
||||
|
||||
OutputDeviceInterface::VrrPolicy OutputDeviceInterface::vrrPolicy() const
|
||||
{
|
||||
return d->vrrPolicy;
|
||||
}
|
||||
|
||||
void OutputDeviceInterface::setVrrPolicy(VrrPolicy policy)
|
||||
{
|
||||
if (d->vrrPolicy != policy) {
|
||||
d->vrrPolicy = policy;
|
||||
d->updateVrrPolicy();
|
||||
Q_EMIT vrrPolicyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void OutputDeviceInterfacePrivate::updateVrrPolicy()
|
||||
{
|
||||
const auto clientResources = resourceMap();
|
||||
for (const auto &resource : clientResources) {
|
||||
sendVrrPolicy(resource);
|
||||
}
|
||||
}
|
||||
|
||||
OutputDeviceInterface *OutputDeviceInterfacePrivate::get(wl_resource *native)
|
||||
{
|
||||
if (auto devicePrivate = resource_cast<OutputDeviceInterfacePrivate *>(native)) {
|
||||
return devicePrivate->q;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OutputDeviceInterface *OutputDeviceInterface::get(wl_resource *native)
|
||||
{
|
||||
return OutputDeviceInterfacePrivate::get(native);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,201 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <KWaylandServer/kwaylandserver_export.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QPoint>
|
||||
#include <QSize>
|
||||
#include <QUuid>
|
||||
#include <QVector>
|
||||
|
||||
struct wl_resource;
|
||||
|
||||
namespace KWaylandServer
|
||||
{
|
||||
class Display;
|
||||
class OutputDeviceInterfacePrivate;
|
||||
|
||||
/** @class OutputDeviceInterface
|
||||
*
|
||||
* Represents an output device, the difference to Output is that this output can be disabled,
|
||||
* so not currently used to display content.
|
||||
*
|
||||
* @see OutputManagementInterface
|
||||
*/
|
||||
class KWAYLANDSERVER_EXPORT OutputDeviceInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QSize physicalSize READ physicalSize WRITE setPhysicalSize NOTIFY physicalSizeChanged)
|
||||
Q_PROPERTY(QPoint globalPosition READ globalPosition WRITE setGlobalPosition NOTIFY globalPositionChanged)
|
||||
Q_PROPERTY(QString manufacturer READ manufacturer WRITE setManufacturer NOTIFY manufacturerChanged)
|
||||
Q_PROPERTY(QString model READ model WRITE setModel NOTIFY modelChanged)
|
||||
Q_PROPERTY(QString serialNumber READ serialNumber WRITE setSerialNumber NOTIFY serialNumberChanged)
|
||||
Q_PROPERTY(QString eisaId READ eisaId WRITE setEisaId NOTIFY eisaIdChanged)
|
||||
Q_PROPERTY(QSize pixelSize READ pixelSize NOTIFY pixelSizeChanged)
|
||||
Q_PROPERTY(int refreshRate READ refreshRate NOTIFY refreshRateChanged)
|
||||
Q_PROPERTY(qreal scale READ scaleF WRITE setScaleF NOTIFY scaleFChanged)
|
||||
Q_PROPERTY(QByteArray edid READ edid WRITE setEdid NOTIFY edidChanged)
|
||||
Q_PROPERTY(OutputDeviceInterface::Enablement enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
|
||||
Q_PROPERTY(QUuid uuid READ uuid WRITE setUuid NOTIFY uuidChanged)
|
||||
Q_PROPERTY(Capabilities capabilities READ capabilities WRITE setCapabilities NOTIFY capabilitiesChanged)
|
||||
Q_PROPERTY(uint32_t overscan READ overscan WRITE setOverscan NOTIFY overscanChanged)
|
||||
Q_PROPERTY(VrrPolicy vrrPolicy READ vrrPolicy WRITE setVrrPolicy NOTIFY vrrPolicyChanged)
|
||||
public:
|
||||
enum class SubPixel {
|
||||
Unknown,
|
||||
None,
|
||||
HorizontalRGB,
|
||||
HorizontalBGR,
|
||||
VerticalRGB,
|
||||
VerticalBGR,
|
||||
};
|
||||
Q_ENUM(SubPixel)
|
||||
enum class Transform {
|
||||
Normal,
|
||||
Rotated90,
|
||||
Rotated180,
|
||||
Rotated270,
|
||||
Flipped,
|
||||
Flipped90,
|
||||
Flipped180,
|
||||
Flipped270,
|
||||
};
|
||||
Q_ENUM(Transform)
|
||||
enum class Enablement {
|
||||
Disabled = 0,
|
||||
Enabled = 1,
|
||||
};
|
||||
Q_ENUM(Enablement)
|
||||
enum class ModeFlag {
|
||||
Current = 1,
|
||||
Preferred = 2,
|
||||
};
|
||||
Q_ENUM(ModeFlag)
|
||||
Q_DECLARE_FLAGS(ModeFlags, ModeFlag)
|
||||
struct Mode {
|
||||
QSize size = QSize();
|
||||
int refreshRate = 60000;
|
||||
ModeFlags flags;
|
||||
int id = -1;
|
||||
};
|
||||
struct ColorCurves {
|
||||
QVector<quint16> red, green, blue;
|
||||
bool operator==(const ColorCurves &cc) const;
|
||||
bool operator!=(const ColorCurves &cc) const;
|
||||
};
|
||||
enum class Capability {
|
||||
Overscan = 0x1,
|
||||
Vrr = 0x2,
|
||||
};
|
||||
Q_ENUM(Capability)
|
||||
Q_DECLARE_FLAGS(Capabilities, Capability)
|
||||
enum class VrrPolicy { Never = 0, Always = 1, Automatic = 2 };
|
||||
Q_ENUM(VrrPolicy)
|
||||
|
||||
explicit OutputDeviceInterface(Display *display, QObject *parent = nullptr);
|
||||
~OutputDeviceInterface() override;
|
||||
|
||||
void remove();
|
||||
|
||||
QSize physicalSize() const;
|
||||
QPoint globalPosition() const;
|
||||
QString manufacturer() const;
|
||||
QString model() const;
|
||||
QString serialNumber() const;
|
||||
QString eisaId() const;
|
||||
QSize pixelSize() const;
|
||||
int refreshRate() const;
|
||||
|
||||
qreal scaleF() const;
|
||||
SubPixel subPixel() const;
|
||||
Transform transform() const;
|
||||
ColorCurves colorCurves() const;
|
||||
QList<Mode> modes() const;
|
||||
int currentModeId() const;
|
||||
|
||||
QByteArray edid() const;
|
||||
OutputDeviceInterface::Enablement enabled() const;
|
||||
QUuid uuid() const;
|
||||
|
||||
Capabilities capabilities() const;
|
||||
uint32_t overscan() const;
|
||||
VrrPolicy vrrPolicy() const;
|
||||
|
||||
void setPhysicalSize(const QSize &size);
|
||||
void setGlobalPosition(const QPoint &pos);
|
||||
void setManufacturer(const QString &manufacturer);
|
||||
void setModel(const QString &model);
|
||||
void setSerialNumber(const QString &serialNumber);
|
||||
void setEisaId(const QString &eisaId);
|
||||
|
||||
void setScaleF(qreal scale);
|
||||
void setSubPixel(SubPixel subPixel);
|
||||
void setTransform(Transform transform);
|
||||
void setColorCurves(const ColorCurves &colorCurves);
|
||||
|
||||
/**
|
||||
* Add an additional mode to this output device. This is only allowed before create() is called
|
||||
* on the object.
|
||||
*
|
||||
* @param mode must have a valid size and non-negative id.
|
||||
*/
|
||||
void addMode(Mode &mode);
|
||||
void setCurrentMode(const int modeId);
|
||||
/**
|
||||
* Makes the mode with the specified @a size and @a refreshRate current.
|
||||
* Returns @c false if no mode with the given attributes exists; otherwise returns @c true.
|
||||
*/
|
||||
bool setCurrentMode(const QSize &size, int refreshRate);
|
||||
|
||||
void setEdid(const QByteArray &edid);
|
||||
void setEnabled(OutputDeviceInterface::Enablement enabled);
|
||||
void setUuid(const QUuid &uuid);
|
||||
|
||||
void setCapabilities(Capabilities cap);
|
||||
void setOverscan(uint32_t overscan);
|
||||
void setVrrPolicy(VrrPolicy policy);
|
||||
|
||||
static OutputDeviceInterface *get(wl_resource *native);
|
||||
static QList<OutputDeviceInterface *> list();
|
||||
|
||||
Q_SIGNALS:
|
||||
void physicalSizeChanged(const QSize &);
|
||||
void globalPositionChanged(const QPoint &);
|
||||
void manufacturerChanged(const QString &);
|
||||
void modelChanged(const QString &);
|
||||
void serialNumberChanged(const QString &);
|
||||
void eisaIdChanged(const QString &);
|
||||
void pixelSizeChanged(const QSize &);
|
||||
void refreshRateChanged(int);
|
||||
|
||||
void scaleFChanged(qreal);
|
||||
void subPixelChanged(SubPixel);
|
||||
void transformChanged(Transform);
|
||||
void colorCurvesChanged(ColorCurves);
|
||||
void modesChanged();
|
||||
void currentModeChanged();
|
||||
|
||||
void edidChanged();
|
||||
void enabledChanged();
|
||||
void uuidChanged();
|
||||
|
||||
void capabilitiesChanged();
|
||||
void overscanChanged();
|
||||
void vrrPolicyChanged();
|
||||
|
||||
private:
|
||||
QScopedPointer<OutputDeviceInterfacePrivate> d;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(KWaylandServer::OutputDeviceInterface::ModeFlags)
|
||||
Q_DECLARE_METATYPE(KWaylandServer::OutputDeviceInterface::Enablement)
|
||||
Q_DECLARE_METATYPE(KWaylandServer::OutputDeviceInterface::SubPixel)
|
||||
Q_DECLARE_METATYPE(KWaylandServer::OutputDeviceInterface::Transform)
|
||||
Q_DECLARE_METATYPE(KWaylandServer::OutputDeviceInterface::ColorCurves)
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
||||
SPDX-FileCopyrightText: 2015 Sebastian Kügler <sebas@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
#include "display.h"
|
||||
|
||||
#include "outputmanagement_interface.h"
|
||||
#include "outputconfiguration_interface.h"
|
||||
|
||||
#include "qwayland-server-outputmanagement.h"
|
||||
#include <wayland-server.h>
|
||||
|
||||
#include <QHash>
|
||||
|
||||
namespace KWaylandServer
|
||||
{
|
||||
static const quint32 s_version = 4;
|
||||
|
||||
class OutputManagementInterfacePrivate : public QtWaylandServer::org_kde_kwin_outputmanagement
|
||||
{
|
||||
public:
|
||||
OutputManagementInterfacePrivate(OutputManagementInterface *_q, Display *display);
|
||||
|
||||
private:
|
||||
OutputManagementInterface *q;
|
||||
|
||||
protected:
|
||||
void org_kde_kwin_outputmanagement_create_configuration(Resource *resource, uint32_t id) override;
|
||||
};
|
||||
|
||||
OutputManagementInterfacePrivate::OutputManagementInterfacePrivate(OutputManagementInterface *_q, Display *display)
|
||||
: QtWaylandServer::org_kde_kwin_outputmanagement(*display, s_version)
|
||||
, q(_q)
|
||||
{
|
||||
}
|
||||
|
||||
void OutputManagementInterfacePrivate::org_kde_kwin_outputmanagement_create_configuration(Resource *resource, uint32_t id)
|
||||
{
|
||||
wl_resource *config_resource = wl_resource_create(resource->client(), &org_kde_kwin_outputconfiguration_interface, resource->version(), id);
|
||||
if (!config_resource) {
|
||||
wl_client_post_no_memory(resource->client());
|
||||
return;
|
||||
}
|
||||
new OutputConfigurationInterface(q, config_resource);
|
||||
}
|
||||
|
||||
OutputManagementInterface::OutputManagementInterface(Display *display, QObject *parent)
|
||||
: QObject(parent)
|
||||
, d(new OutputManagementInterfacePrivate(this, display))
|
||||
{
|
||||
}
|
||||
|
||||
OutputManagementInterface::~OutputManagementInterface() = default;
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2015 Sebastian Kügler <sebas@kde.org>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <KWaylandServer/kwaylandserver_export.h>
|
||||
|
||||
namespace KWaylandServer
|
||||
{
|
||||
class OutputManagementInterfacePrivate;
|
||||
class OutputConfigurationInterface;
|
||||
/**
|
||||
* @class OutputManagementInterface
|
||||
*
|
||||
* This class is used to change the configuration of the Wayland server's outputs.
|
||||
* The client requests an OutputConfiguration, changes its OutputDevices and then
|
||||
* calls OutputConfiguration::apply, which makes this class Q_EMIT a signal, carrying
|
||||
* the new configuration.
|
||||
* The server is then expected to make the requested changes by applying the settings
|
||||
* of the OutputDevices to the Outputs.
|
||||
*
|
||||
* @see OutputConfiguration
|
||||
* @see OutputConfigurationInterface
|
||||
*/
|
||||
class KWAYLANDSERVER_EXPORT OutputManagementInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OutputManagementInterface(Display *display, QObject *parent = nullptr);
|
||||
~OutputManagementInterface() override;
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* Emitted after the client has requested an OutputConfiguration to be applied.
|
||||
* through OutputConfiguration::apply. The compositor can use this object to get
|
||||
* notified when the new configuration is set up, and it should be applied to the
|
||||
* Wayland server's OutputInterfaces.
|
||||
*
|
||||
* @param config The OutputConfigurationInterface corresponding to the client that
|
||||
* called apply().
|
||||
* @see OutputConfiguration::apply
|
||||
* @see OutputConfigurationInterface
|
||||
* @see OutputDeviceInterface
|
||||
* @see OutputInterface
|
||||
*/
|
||||
void configurationChangeRequested(KWaylandServer::OutputConfigurationInterface *configurationInterface);
|
||||
|
||||
private:
|
||||
QScopedPointer<OutputManagementInterfacePrivate> d;
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in a new issue