Krita Source Code Documentation
Loading...
Searching...
No Matches
KisWaylandSurfaceColorManager Class Reference

#include <KisWaylandSurfaceColorManager.h>

+ Inheritance diagram for KisWaylandSurfaceColorManager:

Public Types

enum class  WaylandSurfaceState {
  Disconnected = 0 , Connected , WaylandWindowCreated , WaylandSurfaceCreated ,
  APIFeedbackCreated , PreferredDescriptionReceived
}
 

Public Member Functions

bool isReady () const override
 
 KisWaylandSurfaceColorManager (QWindow *window, QObject *parent=nullptr)
 
std::optional< KisSurfaceColorimetry::SurfaceDescriptionpreferredSurfaceDescription () const override
 
std::optional< KisSurfaceColorimetry::RenderIntentrenderingIntent () const override
 
QFuture< bool > setSurfaceDescription (const KisSurfaceColorimetry::SurfaceDescription &desc, KisSurfaceColorimetry::RenderIntent intent) override
 
bool supportsRenderIntent (const KisSurfaceColorimetry::RenderIntent &intent) override
 
bool supportsSurfaceDescription (const KisSurfaceColorimetry::SurfaceDescription &desc) override
 
std::optional< KisSurfaceColorimetry::SurfaceDescriptionsurfaceDescription () const override
 
void unsetSurfaceDescription () override
 
 ~KisWaylandSurfaceColorManager () override
 
- Public Member Functions inherited from KisSurfaceColorManagerInterface
 KisSurfaceColorManagerInterface (QWindow *window, QObject *parent=nullptr)
 
virtual ~KisSurfaceColorManagerInterface ()
 

Static Public Member Functions

static std::shared_ptr< KisWaylandAPIColorManagergetOrCreateGlobalWaylandManager ()
 

Private Slots

void slotPlatformWindowCreated ()
 
void slotPlatformWindowDestroyed ()
 
void slotPreferredChanged ()
 
void slotWaylandSurfaceCreated ()
 
void slotWaylandSurfaceDestroyed ()
 

Private Member Functions

void reinitialize ()
 
void setReadyImpl (bool value)
 
WaylandSurfaceState tryDeinitialize (std::optional< KisWaylandSurfaceColorManager::WaylandSurfaceState > targetState)
 
WaylandSurfaceState tryInitilize ()
 

Private Attributes

std::optional< KisSurfaceColorimetry::SurfaceDescriptionm_currentDescription
 
WaylandSurfaceState m_currentState {WaylandSurfaceState::Disconnected}
 
bool m_isReady {false}
 
QPointer< QObject > m_platformWindowStateDetector
 
std::optional< KisSurfaceColorimetry::SurfaceDescriptionm_preferredDescription
 
std::optional< KisSurfaceColorimetry::RenderIntentm_renderingIntent
 
std::unique_ptr< KisWaylandAPISurfacem_surface
 
QMetaObject::Connection m_surfaceCreatedConnection
 
QMetaObject::Connection m_surfaceDestroyedConnection
 
std::shared_ptr< KisWaylandAPIColorManagerm_waylandManager
 

Additional Inherited Members

- Signals inherited from KisSurfaceColorManagerInterface
void sigPreferredSurfaceDescriptionChanged (const KisSurfaceColorimetry::SurfaceDescription &desc)
 
void sigReadyChanged (bool value)
 
- Protected Attributes inherited from KisSurfaceColorManagerInterface
QWindow * m_window
 

Detailed Description

Definition at line 16 of file KisWaylandSurfaceColorManager.h.

Member Enumeration Documentation

◆ WaylandSurfaceState

Enumerator
Disconnected 
Connected 
WaylandWindowCreated 
WaylandSurfaceCreated 
APIFeedbackCreated 
PreferredDescriptionReceived 

Definition at line 34 of file KisWaylandSurfaceColorManager.h.

34 {
35 Disconnected = 0, // 1) the underlying wayland manager is inactive
36 Connected, // 1) the wayland manager is active; 2) m_platformWindowStateDetector is connected
37 WaylandWindowCreated, // 1) QWaylandWindow is created; 2) surfaceCreated() and surfaceDestroyed() signals are connected
38 WaylandSurfaceCreated, // 1) wayland surface is created inside Qt
39 APIFeedbackCreated, // 1) surface feedback (m_surface) is created and connected to the wayland surface
40 PreferredDescriptionReceived // 1) m_preferredDescription is initialized
41 };

Constructor & Destructor Documentation

◆ KisWaylandSurfaceColorManager()

KisWaylandSurfaceColorManager::KisWaylandSurfaceColorManager ( QWindow * window,
QObject * parent = nullptr )

If we have reused an existing wayland manager, then it will be ready

Definition at line 51 of file KisWaylandSurfaceColorManager.cpp.

52 : KisSurfaceColorManagerInterface(window, parent)
53{
57
61 if (m_waylandManager->isReady()) {
63 }
64}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KisSurfaceColorManagerInterface(QWindow *window, QObject *parent=nullptr)
void sigReadyChanged(bool value)
static std::shared_ptr< KisWaylandAPIColorManager > getOrCreateGlobalWaylandManager()
std::shared_ptr< KisWaylandAPIColorManager > m_waylandManager

References connect(), getOrCreateGlobalWaylandManager(), m_waylandManager, reinitialize(), and KisWaylandAPIColorManager::sigReadyChanged().

◆ ~KisWaylandSurfaceColorManager()

KisWaylandSurfaceColorManager::~KisWaylandSurfaceColorManager ( )
override

Definition at line 66 of file KisWaylandSurfaceColorManager.cpp.

67{
68}

Member Function Documentation

◆ getOrCreateGlobalWaylandManager()

std::shared_ptr< KisWaylandAPIColorManager > KisWaylandSurfaceColorManager::getOrCreateGlobalWaylandManager ( )
static

Definition at line 37 of file KisWaylandSurfaceColorManager.cpp.

38{
39 std::shared_ptr<KisWaylandAPIColorManager> result;
40
41 if (s_waylandManager.exists()) {
42 result = s_waylandManager->lock();
43 } else {
44 result.reset(new KisWaylandAPIColorManager());
45 *s_waylandManager = result;
46 }
47
48 return result;
49}

◆ isReady()

bool KisWaylandSurfaceColorManager::isReady ( ) const
overridevirtual
Returns
true when the interface is considered as "fully initialized", i.e. all the methods of the interface are supposed to work as expected

Implements KisSurfaceColorManagerInterface.

Definition at line 132 of file KisWaylandSurfaceColorManager.cpp.

References m_isReady.

◆ preferredSurfaceDescription()

std::optional< KisSurfaceColorimetry::SurfaceDescription > KisWaylandSurfaceColorManager::preferredSurfaceDescription ( ) const
overridevirtual
Returns
the preferred description for the underlying surface from the viewpoint of the compositor

It can return std::nullopt only when the interface is not ready

Implements KisSurfaceColorManagerInterface.

Definition at line 315 of file KisWaylandSurfaceColorManager.cpp.

316{
318}
std::optional< KisSurfaceColorimetry::SurfaceDescription > m_preferredDescription

References m_preferredDescription.

◆ reinitialize()

void KisWaylandSurfaceColorManager::reinitialize ( )
private

Definition at line 112 of file KisWaylandSurfaceColorManager.cpp.

113{
114 if (!m_waylandManager->isReady()) {
115 auto newState = tryDeinitialize(std::nullopt);
117 setReadyImpl(false);
118 return;
119 }
120
122 qWarning() << "WARNING: KisWaylandSurfaceColorManager::reinitialize(): received unbalanced connectionActive(true) signal!";
123 qWarning() << " " << ppVar(m_currentState);
124 m_currentState = tryDeinitialize(std::nullopt);
126 }
127
130}
WaylandSurfaceState tryDeinitialize(std::optional< KisWaylandSurfaceColorManager::WaylandSurfaceState > targetState)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:130
#define ppVar(var)
Definition kis_debug.h:155

References Connected, Disconnected, KIS_SAFE_ASSERT_RECOVER_NOOP, KIS_SAFE_ASSERT_RECOVER_RETURN, m_currentState, m_waylandManager, ppVar, PreferredDescriptionReceived, setReadyImpl(), tryDeinitialize(), and tryInitilize().

◆ renderingIntent()

std::optional< KisSurfaceColorimetry::RenderIntent > KisWaylandSurfaceColorManager::renderingIntent ( ) const
overridevirtual
Returns
the current rendering intent assign to the surface

It can return std::nullopt if the surface description is unset or if the connection to the compositor has been lost.

Implements KisSurfaceColorManagerInterface.

Definition at line 310 of file KisWaylandSurfaceColorManager.cpp.

311{
312 return m_renderingIntent;
313}
std::optional< KisSurfaceColorimetry::RenderIntent > m_renderingIntent

References m_renderingIntent.

◆ setReadyImpl()

void KisWaylandSurfaceColorManager::setReadyImpl ( bool value)
private

Definition at line 70 of file KisWaylandSurfaceColorManager.cpp.

71{
72 if (value == m_isReady) return;
73
76}
float value(const T *src, size_t ch)
void sigReadyChanged(bool value)

References m_isReady, KisSurfaceColorManagerInterface::sigReadyChanged(), and value().

◆ setSurfaceDescription()

QFuture< bool > KisWaylandSurfaceColorManager::setSurfaceDescription ( const KisSurfaceColorimetry::SurfaceDescription & desc,
KisSurfaceColorimetry::RenderIntent intent )
overridevirtual

Sets the surface description of the linked QWindow

The operation may be asynchronous on some platforms, so you should handle a QFuture<bool> object to get the actual result.

Returns
a future telling if the description has already been set or not.

WARNING: Please do NOT call future.waitForFinished() from the GUI thread. On some platforms (e.g. wayland) a signal from the even loop should be processed to actually set the surface description, so you'll get a deadlock if you try to wait for it in the event loop's thread.

Implements KisSurfaceColorManagerInterface.

Definition at line 227 of file KisWaylandSurfaceColorManager.cpp.

228{
229 if (!m_isReady) {
230 qWarning() << "ERROR: KisWaylandSurfaceColorManager::setSurfaceDescription: the manager is not ready";
231 return makeReadyQFuture(false);
232 }
233
235
236 auto waylandDescription = WaylandSurfaceDescription::fromSurfaceDescription(desc);
237 auto waylandIntent = renderIntentKritaToWayland(intent);
238
239 if (!supportsSurfaceDescription(desc)) {
240 qWarning() << "ERROR: KisWaylandSurfaceColorManager::setSurfaceDescription: unsupported surface description";
241 return makeReadyQFuture(false);
242 }
243
244 if (!m_waylandManager->isIntentSupported(waylandIntent)) {
245 qWarning() << "ERROR: KisWaylandSurfaceColorManager::setSurfaceDescription: unsupported rendering intent";
246 return makeReadyQFuture(false);
247 }
248
250 std::shared_ptr<KisWaylandAPIImageDescriptionNoInfo> descriptionObject =
251 creator.createImageDescription(waylandDescription);
252
253 QPromise<bool> imageDescriptionPromise;
254 auto future = imageDescriptionPromise.future();
255
257 this,
258 [promise = std::move(imageDescriptionPromise), descriptionObject] (bool success) mutable {
259 promise.start();
260 promise.addResult(success);
261 promise.finish();
262 });
263
264 QFuture<bool> result =
265 future.then([this, desc, descriptionObject, waylandIntent, intent] (QFuture<bool> future) {
266 if (!future.result()) return false;
267
268 if (!m_surface) {
269 qWarning() << "WARNING: the surface has been destroyed while its format was being set!";
270 return false;
271 }
272
273#ifdef USE_KWIN_BUG_WORKAROUND
274 if (qEnvironmentVariableIsSet("KRITA_ENABLE_KWIN_INTENT_WORKAROUND")) {
275 // WARNING: KWin <= 6.4.4 doesn't handle intent changes properly
278
279 m_surface->unset_image_description();
280 auto waylandWindow = m_window->nativeInterface<QNativeInterface::Private::QWaylandWindow>();
281 ::wl_surface_commit(waylandWindow->surface());
282 }
283 }
284#endif
285
286 m_surface->set_image_description(descriptionObject->object(), waylandIntent);
287 m_window->requestUpdate();
289 m_renderingIntent = intent;
290 return true;
291 });
292
293 return result;
294}
Q_SIGNAL void sigDescriptionConstructed(bool success)
bool supportsSurfaceDescription(const KisSurfaceColorimetry::SurfaceDescription &desc) override
std::unique_ptr< KisWaylandAPISurface > m_surface
std::optional< KisSurfaceColorimetry::SurfaceDescription > m_currentDescription
QtWayland::wp_color_manager_v1::render_intent renderIntentKritaToWayland(KisSurfaceColorimetry::RenderIntent intent)

References connect(), KisWaylandAPIImageDescriptionCreatorParams::createImageDescription(), m_currentDescription, m_isReady, m_renderingIntent, m_surface, m_waylandManager, KisSurfaceColorManagerInterface::m_window, KisWaylandAPIImageDescriptionNoInfo::sigDescriptionConstructed(), and supportsSurfaceDescription().

◆ slotPlatformWindowCreated

void KisWaylandSurfaceColorManager::slotPlatformWindowCreated ( )
privateslot

Definition at line 336 of file KisWaylandSurfaceColorManager.cpp.

337{
339 qWarning() << "WARNING: KisWaylandSurfaceColorManager::slotPlatformWindowCreated(): received unbalanced window created signal!";
340 qWarning() << " " << ppVar(m_currentState);
343 setReadyImpl(false);
344 }
345
346 auto newState = tryInitilize();
347
349 qWarning() << "WARNING: KisWaylandSurfaceColorManager::slotPlatformWindowCreated(): failed to reach WaylandWindowCreated state";
350 }
351
352 m_currentState = newState;
353}

References Connected, KIS_SAFE_ASSERT_RECOVER_RETURN, m_currentState, ppVar, setReadyImpl(), tryDeinitialize(), tryInitilize(), and WaylandWindowCreated.

◆ slotPlatformWindowDestroyed

void KisWaylandSurfaceColorManager::slotPlatformWindowDestroyed ( )
privateslot

◆ slotPreferredChanged

◆ slotWaylandSurfaceCreated

void KisWaylandSurfaceColorManager::slotWaylandSurfaceCreated ( )
privateslot

Definition at line 363 of file KisWaylandSurfaceColorManager.cpp.

364{
366 qWarning() << "WARNING: KisWaylandSurfaceColorManager::slotWaylandSurfaceCreated(): received unbalanced surface created signal!";
367 qWarning() << " " << ppVar(m_currentState);
370 setReadyImpl(false);
371 }
372
373 auto newState = tryInitilize();
374
376 qWarning() << "WARNING: KisWaylandSurfaceColorManager::slotWaylandSurfaceCreated(): failed to reach WaylandSurfaceCreated state";
377 }
378 m_currentState = newState;
379}

References KIS_SAFE_ASSERT_RECOVER_RETURN, m_currentState, ppVar, setReadyImpl(), tryDeinitialize(), tryInitilize(), WaylandSurfaceCreated, and WaylandWindowCreated.

◆ slotWaylandSurfaceDestroyed

void KisWaylandSurfaceColorManager::slotWaylandSurfaceDestroyed ( )
privateslot

◆ supportsRenderIntent()

bool KisWaylandSurfaceColorManager::supportsRenderIntent ( const KisSurfaceColorimetry::RenderIntent & intent)
overridevirtual

Test if the rendering intent is supported by the compositor

Implements KisSurfaceColorManagerInterface.

Definition at line 215 of file KisWaylandSurfaceColorManager.cpp.

216{
217 auto waylandIntent = renderIntentKritaToWayland(intent);
218 return m_waylandManager->isIntentSupported(waylandIntent);
219}

References m_waylandManager.

◆ supportsSurfaceDescription()

bool KisWaylandSurfaceColorManager::supportsSurfaceDescription ( const KisSurfaceColorimetry::SurfaceDescription & desc)
overridevirtual

Test if the surface description is supported by the compositor

For some obscure reason Wayland compositors implemented transfer_function_srgb as gamma-2.2 transfer function, which caused a lot of confusion. Hence the enum is going to be deprecated in the upcoming version of the protocol.

https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/442

Implements KisSurfaceColorManagerInterface.

Definition at line 137 of file KisWaylandSurfaceColorManager.cpp.

138{
139 using feature = QtWayland::wp_color_manager_v1::feature;
140 using namespace KisColorimetryUtils;
141
142 if (!m_waylandManager->isFeatureSupported(feature::feature_parametric)) {
143 qWarning() << "KisWaylandSurfaceColorManager: feature_parametric is not supported";
144 return false;
145 }
146
147 if (!m_waylandManager->isFeatureSupported(feature::feature_set_primaries) &&
148 std::holds_alternative<Colorimetry>(desc.colorSpace.primaries)) {
149
150 qWarning() << "KisWaylandSurfaceColorManager: feature_set_primaries is not supported, even though requested";
151 return false;
152 }
153
154 if (!m_waylandManager->isFeatureSupported(feature::feature_set_tf_power) &&
155 std::holds_alternative<uint32_t>(desc.colorSpace.transferFunction)) {
156
157 qWarning() << "KisWaylandSurfaceColorManager: feature_set_tf_power is not supported, even though requested";
158 return false;
159 }
160
161 if (!m_waylandManager->isFeatureSupported(feature::feature_set_luminances) &&
162 desc.colorSpace.luminance) {
163
164 qWarning() << "KisWaylandSurfaceColorManager: feature_set_luminances is not supported, even though requested";
165 return false;
166 }
167
168 if (!m_waylandManager->isFeatureSupported(feature::feature_set_mastering_display_primaries) &&
169 desc.masteringInfo) {
170
171 qWarning() << "KisWaylandSurfaceColorManager: feature_set_mastering_display_primaries is not supported, even though requested";
172 return false;
173 }
174
175 if (!m_waylandManager->isFeatureSupported(feature::feature_extended_target_volume) &&
176 desc.masteringInfo && desc.colorSpace.luminance) {
177 if (desc.masteringInfo->luminance.minLuminance < desc.colorSpace.luminance->minLuminance
178 || desc.masteringInfo->luminance.maxLuminance > desc.colorSpace.luminance->maxLuminance) {
179
180 qWarning() << "KisWaylandSurfaceColorManager: feature_set_mastering_display_primaries is not supported, even though requested";
181 return false;
182 }
183 }
184
185 if (std::holds_alternative<KisSurfaceColorimetry::NamedPrimaries>(desc.colorSpace.primaries)) {
186 auto waylandPrimaries = primariesKritaToWayland(std::get<KisSurfaceColorimetry::NamedPrimaries>(desc.colorSpace.primaries));
187
188 if (!m_waylandManager->isPrimariesNamedSupported(waylandPrimaries))
189 return false;
190 }
191
192 if (std::holds_alternative<KisSurfaceColorimetry::NamedTransferFunction>(desc.colorSpace.transferFunction)) {
193 auto waylandTransferFunction = transferFunctionKritaToWayland(std::get<KisSurfaceColorimetry::NamedTransferFunction>(desc.colorSpace.transferFunction));
194
202 if (waylandTransferFunction == QtWayland::wp_color_manager_v1::transfer_function_srgb ||
203 waylandTransferFunction == QtWayland::wp_color_manager_v1::transfer_function_ext_srgb) {
204
205 return false;
206 }
207
208 if (!m_waylandManager->isTransferFunctionNamedSupported(waylandTransferFunction))
209 return false;
210 }
211
212 return true;
213}
QtWayland::wp_color_manager_v1::primaries primariesKritaToWayland(KisSurfaceColorimetry::NamedPrimaries primaries)
QtWayland::wp_color_manager_v1::transfer_function transferFunctionKritaToWayland(KisSurfaceColorimetry::NamedTransferFunction transferFunction)
std::optional< Luminance > luminance
std::variant< NamedPrimaries, Colorimetry > primaries
std::variant< NamedTransferFunction, uint32_t > transferFunction

References KisSurfaceColorimetry::SurfaceDescription::colorSpace, KisSurfaceColorimetry::ColorSpace::luminance, m_waylandManager, KisSurfaceColorimetry::SurfaceDescription::masteringInfo, KisSurfaceColorimetry::ColorSpace::primaries, and KisSurfaceColorimetry::ColorSpace::transferFunction.

◆ surfaceDescription()

std::optional< KisSurfaceColorimetry::SurfaceDescription > KisWaylandSurfaceColorManager::surfaceDescription ( ) const
overridevirtual
Returns
the current description of the underlying surface

It can return std::nullopt if the surface description is unset or if the connection to the compositor has been lost.

Implements KisSurfaceColorManagerInterface.

Definition at line 305 of file KisWaylandSurfaceColorManager.cpp.

306{
308}

References m_currentDescription.

◆ tryDeinitialize()

KisWaylandSurfaceColorManager::WaylandSurfaceState KisWaylandSurfaceColorManager::tryDeinitialize ( std::optional< KisWaylandSurfaceColorManager::WaylandSurfaceState > targetState)
private

Definition at line 477 of file KisWaylandSurfaceColorManager.cpp.

478{
480
481 if (!targetState || *targetState < currentState) {
482 m_currentDescription = std::nullopt;
483 m_renderingIntent = std::nullopt;
484 m_preferredDescription = std::nullopt;
485
487 }
488
489 auto waylandWindow = m_window->nativeInterface<QNativeInterface::Private::QWaylandWindow>();
490
491 if (!waylandWindow || !waylandWindow->surface() ||
492 (targetState && *targetState < currentState)) {
493
494 m_surface.reset();
496 }
497
498 if (!waylandWindow || !waylandWindow->surface() ||
499 (targetState && *targetState < currentState)) {
500
502 }
503
504 if (!waylandWindow || (targetState && *targetState < currentState)) {
506 disconnect(m_surfaceCreatedConnection);
507 }
510 }
511 currentState = WaylandSurfaceState::Connected;
512 }
513
514 if (!m_waylandManager->isReady() || (targetState && *targetState < currentState)) {
515 m_window->removeEventFilter(m_platformWindowStateDetector);
516 m_platformWindowStateDetector->deleteLater();
518
520 }
521
522 return currentState;
523}
QMetaObject::Connection m_surfaceCreatedConnection
QMetaObject::Connection m_surfaceDestroyedConnection

References APIFeedbackCreated, Connected, Disconnected, m_currentDescription, m_platformWindowStateDetector, m_preferredDescription, m_renderingIntent, m_surface, m_surfaceCreatedConnection, m_surfaceDestroyedConnection, m_waylandManager, KisSurfaceColorManagerInterface::m_window, PreferredDescriptionReceived, WaylandSurfaceCreated, and WaylandWindowCreated.

◆ tryInitilize()

KisWaylandSurfaceColorManager::WaylandSurfaceState KisWaylandSurfaceColorManager::tryInitilize ( )
private

Initialization of the managed happens sequentially by transitioning through a set of states. Some states may be transitioned asynchronously, e.g. when Qt creates a platform windows or when it creates or recreates a surface.

Definition at line 390 of file KisWaylandSurfaceColorManager.cpp.

391{
399
400 if (m_waylandManager->isReady()) {
401 currentState = WaylandSurfaceState::Connected;
402 }
403
404 if (currentState == WaylandSurfaceState::Connected) {
406 auto *filter = new PlatformWindowDetectionEventFilter(m_window, this);
407 connect(filter,
409 this,
411 connect(filter,
413 this,
415 m_window->installEventFilter(filter);
417 }
418
419 auto waylandWindow = m_window->nativeInterface<QNativeInterface::Private::QWaylandWindow>();
420 if (waylandWindow) {
422 }
423 }
424
425 if (currentState == WaylandSurfaceState::WaylandWindowCreated) {
426 auto waylandWindow = m_window->nativeInterface<QNativeInterface::Private::QWaylandWindow>();
427
429 m_surfaceCreatedConnection = connect(waylandWindow,
430 &QNativeInterface::Private::QWaylandWindow::surfaceCreated,
431 this,
433 }
434
437 &QNativeInterface::Private::QWaylandWindow::surfaceDestroyed,
438 this,
440 }
441
442 if (waylandWindow->surface()) {
444 }
445 }
446
447 if (currentState == WaylandSurfaceState::WaylandSurfaceCreated) {
448 auto waylandWindow = m_window->nativeInterface<QNativeInterface::Private::QWaylandWindow>();
449
450 if (!m_surface) {
451 auto feedback = std::make_unique<KisWaylandAPISurfaceFeedback>(
452 m_waylandManager->get_surface_feedback(waylandWindow->surface()));
453 connect(feedback.get(),
455 this,
457 m_surface = std::make_unique<KisWaylandAPISurface>(m_waylandManager->get_surface(waylandWindow->surface()),
458 std::move(feedback));
459 }
460
462 }
463
464 if (currentState == WaylandSurfaceState::APIFeedbackCreated) {
465 if (m_surface->m_feedback->m_preferred->info.isReady()) {
466 auto waylandDesc = m_surface->m_feedback->m_preferred->info.m_data;
467 m_preferredDescription = waylandDesc.toSurfaceDescription();
468
470 }
471 }
472
473 return currentState;
474}
Q_SIGNAL void preferredChanged()

References APIFeedbackCreated, connect(), Connected, Disconnected, m_platformWindowStateDetector, m_preferredDescription, m_surface, m_surfaceCreatedConnection, m_surfaceDestroyedConnection, m_waylandManager, KisSurfaceColorManagerInterface::m_window, KisWaylandAPISurfaceFeedback::preferredChanged(), PreferredDescriptionReceived, PlatformWindowDetectionEventFilter::sigPlatformWindowCreated(), PlatformWindowDetectionEventFilter::sigPlatformWindowDestroyed(), slotPlatformWindowCreated(), slotPlatformWindowDestroyed(), slotPreferredChanged(), slotWaylandSurfaceCreated(), slotWaylandSurfaceDestroyed(), WaylandSurfaceCreated, and WaylandWindowCreated.

◆ unsetSurfaceDescription()

void KisWaylandSurfaceColorManager::unsetSurfaceDescription ( )
overridevirtual

Unset the surface description of the underlying surface. In most of the compositors it means that the surface will be treated as sRGB.

Implements KisSurfaceColorManagerInterface.

Definition at line 296 of file KisWaylandSurfaceColorManager.cpp.

297{
298 if (!m_isReady) return;
299
300 m_surface->unset_image_description();
301 m_currentDescription = std::nullopt;
302 m_renderingIntent = std::nullopt;
303}

References m_currentDescription, m_isReady, m_renderingIntent, and m_surface.

Member Data Documentation

◆ m_currentDescription

std::optional<KisSurfaceColorimetry::SurfaceDescription> KisWaylandSurfaceColorManager::m_currentDescription
private

Definition at line 65 of file KisWaylandSurfaceColorManager.h.

◆ m_currentState

WaylandSurfaceState KisWaylandSurfaceColorManager::m_currentState {WaylandSurfaceState::Disconnected}
private

◆ m_isReady

bool KisWaylandSurfaceColorManager::m_isReady {false}
private

Definition at line 69 of file KisWaylandSurfaceColorManager.h.

69{false};

◆ m_platformWindowStateDetector

QPointer<QObject> KisWaylandSurfaceColorManager::m_platformWindowStateDetector
private

Definition at line 73 of file KisWaylandSurfaceColorManager.h.

◆ m_preferredDescription

std::optional<KisSurfaceColorimetry::SurfaceDescription> KisWaylandSurfaceColorManager::m_preferredDescription
private

Definition at line 67 of file KisWaylandSurfaceColorManager.h.

◆ m_renderingIntent

std::optional<KisSurfaceColorimetry::RenderIntent> KisWaylandSurfaceColorManager::m_renderingIntent
private

Definition at line 66 of file KisWaylandSurfaceColorManager.h.

◆ m_surface

std::unique_ptr<KisWaylandAPISurface> KisWaylandSurfaceColorManager::m_surface
private

Definition at line 63 of file KisWaylandSurfaceColorManager.h.

◆ m_surfaceCreatedConnection

QMetaObject::Connection KisWaylandSurfaceColorManager::m_surfaceCreatedConnection
private

Definition at line 71 of file KisWaylandSurfaceColorManager.h.

◆ m_surfaceDestroyedConnection

QMetaObject::Connection KisWaylandSurfaceColorManager::m_surfaceDestroyedConnection
private

Definition at line 72 of file KisWaylandSurfaceColorManager.h.

◆ m_waylandManager

std::shared_ptr<KisWaylandAPIColorManager> KisWaylandSurfaceColorManager::m_waylandManager
private

Definition at line 62 of file KisWaylandSurfaceColorManager.h.


The documentation for this class was generated from the following files: