KWayland
8 #include "event_queue.h"
11 #include "wayland_pointer_p.h"
13 #include <wayland-contrast-client-protocol.h>
19 class Q_DECL_HIDDEN ContrastManager::Private
24 WaylandPointer<org_kde_kwin_contrast_manager, org_kde_kwin_contrast_manager_destroy> manager;
25 EventQueue *queue =
nullptr;
34 ContrastManager::~ContrastManager()
51 return d->manager.isValid();
57 Q_ASSERT(!d->manager);
58 d->manager.setup(manager);
75 auto w = org_kde_kwin_contrast_manager_create(d->manager, *surface);
77 d->queue->addProxy(w);
83 void ContrastManager::removeContrast(
Surface *surface)
86 org_kde_kwin_contrast_manager_unset(d->manager, *surface);
89 ContrastManager::operator org_kde_kwin_contrast_manager *()
94 ContrastManager::operator org_kde_kwin_contrast_manager *()
const
99 class Contrast::Private
102 WaylandPointer<org_kde_kwin_contrast, org_kde_kwin_contrast_release> contrast;
105 Contrast::Contrast(
QObject *parent)
111 Contrast::~Contrast()
118 d->contrast.release();
124 Q_ASSERT(!d->contrast);
125 d->contrast.setup(contrast);
130 d->contrast.destroy();
135 return d->contrast.isValid();
138 void Contrast::commit()
141 org_kde_kwin_contrast_commit(d->contrast);
146 org_kde_kwin_contrast_set_region(d->contrast, *region);
149 void Contrast::setContrast(qreal contrast)
151 org_kde_kwin_contrast_set_contrast(d->contrast, wl_fixed_from_double(contrast));
154 void Contrast::setIntensity(qreal intensity)
156 org_kde_kwin_contrast_set_intensity(d->contrast, wl_fixed_from_double(intensity));
159 void Contrast::setSaturation(qreal saturation)
161 org_kde_kwin_contrast_set_saturation(d->contrast, wl_fixed_from_double(saturation));
164 void Contrast::setFrost(
QColor frost)
166 if (org_kde_kwin_contrast_get_version(d->contrast) < ORG_KDE_KWIN_CONTRAST_SET_FROST_SINCE_VERSION) {
171 org_kde_kwin_contrast_set_frost(d->contrast, frost.
red(), frost.
green(), frost.
blue(), frost.
alpha());
173 org_kde_kwin_contrast_unset_frost(d->contrast);
177 Contrast::operator org_kde_kwin_contrast *()
182 Contrast::operator org_kde_kwin_contrast *()
const
void destroy()
Destroys the data held by this Contrast.
Wrapper for the org_kde_kwin_contrast interface.
void release()
Releases the org_kde_kwin_contrast interface.
Wrapper for the wl_surface interface.
void setup(org_kde_kwin_contrast *contrast)
Setup this Contrast to manage the contrast.
void setEventQueue(EventQueue *queue)
Sets the queue to use for creating a Contrast.
void destroy()
Destroys the data held by this ContrastManager.
ContrastManager(QObject *parent=nullptr)
Creates a new ContrastManager.
Wrapper class for wl_event_queue interface.
Contrast * createContrast(Surface *surface, QObject *parent=nullptr)
Creates and setup a new Contrast with parent.
EventQueue * eventQueue()
bool isValid() const const
void setup(org_kde_kwin_contrast_manager *contrastManager)
Setup this ContrastManager to manage the contrastManager.
void setRegion(Region *region)
Sets the area of the window that will have a contrasted background.
QObject * parent() const const
void release()
Releases the org_kde_kwin_contrast_manager interface.
Wrapper for the wl_region interface.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 03:56:21 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.