Commit 47853796 authored by Jan Blackquill's avatar Jan Blackquill 🌈
Browse files

Implement set_frost in contrast protocol

parent 893e4a1f
Pipeline #69304 failed with stage
in 1 minute and 58 seconds
......@@ -14,7 +14,7 @@
namespace KWaylandServer
{
static const quint32 s_version = 1;
static const quint32 s_managerVersion = 2;
class ContrastManagerInterfacePrivate : public QtWaylandServer::org_kde_kwin_contrast_manager
{
......@@ -30,7 +30,7 @@ protected:
};
ContrastManagerInterfacePrivate::ContrastManagerInterfacePrivate(ContrastManagerInterface *q, Display *display)
: QtWaylandServer::org_kde_kwin_contrast_manager(*display, s_version)
: QtWaylandServer::org_kde_kwin_contrast_manager(*display, s_managerVersion)
, q(q)
{
}
......@@ -97,6 +97,8 @@ public:
qreal currentIntensity;
qreal pendingSaturation;
qreal currentSaturation;
std::optional<QColor> currentFrost;
std::optional<QColor> pendingFrost;
ContrastInterface *q;
protected:
......@@ -105,6 +107,8 @@ protected:
void org_kde_kwin_contrast_set_contrast(Resource *resource, wl_fixed_t contrast) override;
void org_kde_kwin_contrast_set_intensity(Resource *resource, wl_fixed_t intensity) override;
void org_kde_kwin_contrast_set_saturation(Resource *resource, wl_fixed_t saturation) override;
void org_kde_kwin_contrast_set_frost(Resource *resource, int r, int g, int b, int a) override;
void org_kde_kwin_contrast_unset_frost(Resource *resource) override;
void org_kde_kwin_contrast_release(Resource *resource) override;
void org_kde_kwin_contrast_destroy_resource(Resource *resource) override;
......@@ -117,6 +121,7 @@ void ContrastInterfacePrivate::org_kde_kwin_contrast_commit(Resource *resource)
currentContrast = pendingContrast;
currentIntensity = pendingIntensity;
currentSaturation = pendingSaturation;
currentFrost = pendingFrost;
}
void ContrastInterfacePrivate::org_kde_kwin_contrast_set_region(Resource *resource, wl_resource *region)
......@@ -148,6 +153,20 @@ void ContrastInterfacePrivate::org_kde_kwin_contrast_set_saturation(Resource *re
pendingSaturation = wl_fixed_to_double(saturation);
}
void ContrastInterfacePrivate::org_kde_kwin_contrast_set_frost(Resource *resource, int r, int g, int b, int a)
{
Q_UNUSED(resource)
pendingFrost = QColor(r, g, b, a);
}
void ContrastInterfacePrivate::org_kde_kwin_contrast_unset_frost(Resource *resource)
{
Q_UNUSED(resource)
pendingFrost = {};
}
void ContrastInterfacePrivate::org_kde_kwin_contrast_release(Resource *resource)
{
wl_resource_destroy(resource->handle);
......@@ -193,4 +212,9 @@ qreal ContrastInterface::saturation() const
return d->currentSaturation;
}
std::optional<QColor> ContrastInterface::frost() const
{
return d->currentFrost;
}
}
......@@ -6,6 +6,9 @@
*/
#pragma once
#include <optional>
#include <QColor>
#include <QObject>
#include <KWaylandServer/kwaylandserver_export.h>
......@@ -63,6 +66,7 @@ public:
qreal contrast() const;
qreal intensity() const;
qreal saturation() const;
std::optional<QColor> frost() const;
private:
explicit ContrastInterface(wl_resource *resource);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment