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 57 of file KisWaylandSurfaceColorManager.cpp.

58 : KisSurfaceColorManagerInterface(window, parent)
59{
63
67 if (m_waylandManager->isReady()) {
69 }
70}
KisSurfaceColorManagerInterface(QWindow *window, QObject *parent=nullptr)
void sigReadyChanged(bool value)
static std::shared_ptr< KisWaylandAPIColorManager > getOrCreateGlobalWaylandManager()
std::shared_ptr< KisWaylandAPIColorManager > m_waylandManager

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

◆ ~KisWaylandSurfaceColorManager()

KisWaylandSurfaceColorManager::~KisWaylandSurfaceColorManager ( )
override

Definition at line 72 of file KisWaylandSurfaceColorManager.cpp.

73{
74}

Member Function Documentation

◆ getOrCreateGlobalWaylandManager()

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

A weak pointer in s_waylandManager may have become released, so it may be null, even though the static itself is non-null.

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 }
44
49 if (!result) {
50 result.reset(new KisWaylandAPIColorManager());
51 *s_waylandManager = result;
52 }
53
54 return result;
55}

◆ 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 138 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 321 of file KisWaylandSurfaceColorManager.cpp.

322{
324}
std::optional< KisSurfaceColorimetry::SurfaceDescription > m_preferredDescription

References m_preferredDescription.

◆ reinitialize()

void KisWaylandSurfaceColorManager::reinitialize ( )
private

Definition at line 118 of file KisWaylandSurfaceColorManager.cpp.

119{
120 if (!m_waylandManager->isReady()) {
121 auto newState = tryDeinitialize(std::nullopt);
123 setReadyImpl(false);
124 return;
125 }
126
128 qWarning() << "WARNING: KisWaylandSurfaceColorManager::reinitialize(): received unbalanced connectionActive(true) signal!";
129 qWarning() << " " << ppVar(m_currentState);
130 m_currentState = tryDeinitialize(std::nullopt);
132 }
133
136}
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 316 of file KisWaylandSurfaceColorManager.cpp.

317{
318 return m_renderingIntent;
319}
std::optional< KisSurfaceColorimetry::RenderIntent > m_renderingIntent

References m_renderingIntent.

◆ setReadyImpl()

void KisWaylandSurfaceColorManager::setReadyImpl ( bool value)
private

Definition at line 76 of file KisWaylandSurfaceColorManager.cpp.

77{
78 if (value == m_isReady) return;
79
82}
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 233 of file KisWaylandSurfaceColorManager.cpp.

234{
235 if (!m_isReady) {
236 qWarning() << "ERROR: KisWaylandSurfaceColorManager::setSurfaceDescription: the manager is not ready";
237 return makeReadyQFuture(false);
238 }
239
241
242 auto waylandDescription = WaylandSurfaceDescription::fromSurfaceDescription(desc);
243 auto waylandIntent = renderIntentKritaToWayland(intent);
244
245 if (!supportsSurfaceDescription(desc)) {
246 qWarning() << "ERROR: KisWaylandSurfaceColorManager::setSurfaceDescription: unsupported surface description";
247 return makeReadyQFuture(false);
248 }
249
250 if (!m_waylandManager->isIntentSupported(waylandIntent)) {
251 qWarning() << "ERROR: KisWaylandSurfaceColorManager::setSurfaceDescription: unsupported rendering intent";
252 return makeReadyQFuture(false);
253 }
254
256 std::shared_ptr<KisWaylandAPIImageDescriptionNoInfo> descriptionObject =
257 creator.createImageDescription(waylandDescription);
258
259 QPromise<bool> imageDescriptionPromise;
260 auto future = imageDescriptionPromise.future();
261
262 connect(descriptionObject.get(), &KisWaylandAPIImageDescription::sigDescriptionConstructed,
263 this,
264 [promise = std::move(imageDescriptionPromise), descriptionObject] (bool success) mutable {
265 promise.start();
266 promise.addResult(success);
267 promise.finish();
268 });
269
270 QFuture<bool> result =
271 future.then([this, desc, descriptionObject, waylandIntent, intent] (QFuture<bool> future) {
272 if (!future.result()) return false;
273
274 if (!m_surface) {
275 qWarning() << "WARNING: the surface has been destroyed while its format was being set!";
276 return false;
277 }
278
279#ifdef USE_KWIN_BUG_WORKAROUND
280 if (qEnvironmentVariableIsSet("KRITA_ENABLE_KWIN_INTENT_WORKAROUND")) {
281 // WARNING: KWin <= 6.4.4 doesn't handle intent changes properly
284
285 m_surface->unset_image_description();
286 auto waylandWindow = m_window->nativeInterface<QNativeInterface::Private::QWaylandWindow>();
287 ::wl_surface_commit(waylandWindow->surface());
288 }
289 }
290#endif
291
292 m_surface->set_image_description(descriptionObject->object(), waylandIntent);
293 m_window->requestUpdate();
295 m_renderingIntent = intent;
296 return true;
297 });
298
299 return result;
300}
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 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 342 of file KisWaylandSurfaceColorManager.cpp.

343{
345 qWarning() << "WARNING: KisWaylandSurfaceColorManager::slotPlatformWindowCreated(): received unbalanced window created signal!";
346 qWarning() << " " << ppVar(m_currentState);
349 setReadyImpl(false);
350 }
351
352 auto newState = tryInitilize();
353
355 qWarning() << "WARNING: KisWaylandSurfaceColorManager::slotPlatformWindowCreated(): failed to reach WaylandWindowCreated state";
356 }
357
358 m_currentState = newState;
359}

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 369 of file KisWaylandSurfaceColorManager.cpp.

370{
372 qWarning() << "WARNING: KisWaylandSurfaceColorManager::slotWaylandSurfaceCreated(): received unbalanced surface created signal!";
373 qWarning() << " " << ppVar(m_currentState);
376 setReadyImpl(false);
377 }
378
379 auto newState = tryInitilize();
380
382 qWarning() << "WARNING: KisWaylandSurfaceColorManager::slotWaylandSurfaceCreated(): failed to reach WaylandSurfaceCreated state";
383 }
384 m_currentState = newState;
385}

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 221 of file KisWaylandSurfaceColorManager.cpp.

222{
223 auto waylandIntent = renderIntentKritaToWayland(intent);
224 return m_waylandManager->isIntentSupported(waylandIntent);
225}

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 143 of file KisWaylandSurfaceColorManager.cpp.

144{
145 using feature = QtWayland::wp_color_manager_v1::feature;
146 using namespace KisColorimetryUtils;
147
148 if (!m_waylandManager->isFeatureSupported(feature::feature_parametric)) {
149 qWarning() << "KisWaylandSurfaceColorManager: feature_parametric is not supported";
150 return false;
151 }
152
153 if (!m_waylandManager->isFeatureSupported(feature::feature_set_primaries) &&
154 std::holds_alternative<Colorimetry>(desc.colorSpace.primaries)) {
155
156 qWarning() << "KisWaylandSurfaceColorManager: feature_set_primaries is not supported, even though requested";
157 return false;
158 }
159
160 if (!m_waylandManager->isFeatureSupported(feature::feature_set_tf_power) &&
161 std::holds_alternative<uint32_t>(desc.colorSpace.transferFunction)) {
162
163 qWarning() << "KisWaylandSurfaceColorManager: feature_set_tf_power is not supported, even though requested";
164 return false;
165 }
166
167 if (!m_waylandManager->isFeatureSupported(feature::feature_set_luminances) &&
168 desc.colorSpace.luminance) {
169
170 qWarning() << "KisWaylandSurfaceColorManager: feature_set_luminances is not supported, even though requested";
171 return false;
172 }
173
174 if (!m_waylandManager->isFeatureSupported(feature::feature_set_mastering_display_primaries) &&
175 desc.masteringInfo) {
176
177 qWarning() << "KisWaylandSurfaceColorManager: feature_set_mastering_display_primaries is not supported, even though requested";
178 return false;
179 }
180
181 if (!m_waylandManager->isFeatureSupported(feature::feature_extended_target_volume) &&
182 desc.masteringInfo && desc.colorSpace.luminance) {
183 if (desc.masteringInfo->luminance.minLuminance < desc.colorSpace.luminance->minLuminance
184 || desc.masteringInfo->luminance.maxLuminance > desc.colorSpace.luminance->maxLuminance) {
185
186 qWarning() << "KisWaylandSurfaceColorManager: feature_set_mastering_display_primaries is not supported, even though requested";
187 return false;
188 }
189 }
190
191 if (std::holds_alternative<KisSurfaceColorimetry::NamedPrimaries>(desc.colorSpace.primaries)) {
192 auto waylandPrimaries = primariesKritaToWayland(std::get<KisSurfaceColorimetry::NamedPrimaries>(desc.colorSpace.primaries));
193
194 if (!m_waylandManager->isPrimariesNamedSupported(waylandPrimaries))
195 return false;
196 }
197
198 if (std::holds_alternative<KisSurfaceColorimetry::NamedTransferFunction>(desc.colorSpace.transferFunction)) {
199 auto waylandTransferFunction = transferFunctionKritaToWayland(std::get<KisSurfaceColorimetry::NamedTransferFunction>(desc.colorSpace.transferFunction));
200
208 if (waylandTransferFunction == QtWayland::wp_color_manager_v1::transfer_function_srgb ||
209 waylandTransferFunction == QtWayland::wp_color_manager_v1::transfer_function_ext_srgb) {
210
211 return false;
212 }
213
214 if (!m_waylandManager->isTransferFunctionNamedSupported(waylandTransferFunction))
215 return false;
216 }
217
218 return true;
219}
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 311 of file KisWaylandSurfaceColorManager.cpp.

312{
314}

References m_currentDescription.

◆ tryDeinitialize()

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

Definition at line 483 of file KisWaylandSurfaceColorManager.cpp.

484{
486
487 if (!targetState || *targetState < currentState) {
488 m_currentDescription = std::nullopt;
489 m_renderingIntent = std::nullopt;
490 m_preferredDescription = std::nullopt;
491
493 }
494
495 auto waylandWindow = m_window->nativeInterface<QNativeInterface::Private::QWaylandWindow>();
496
497 if (!waylandWindow || !waylandWindow->surface() ||
498 (targetState && *targetState < currentState)) {
499
500 m_surface.reset();
502 }
503
504 if (!waylandWindow || !waylandWindow->surface() ||
505 (targetState && *targetState < currentState)) {
506
508 }
509
510 if (!waylandWindow || (targetState && *targetState < currentState)) {
512 disconnect(m_surfaceCreatedConnection);
513 }
516 }
517 currentState = WaylandSurfaceState::Connected;
518 }
519
520 if (!m_waylandManager->isReady() || (targetState && *targetState < currentState)) {
521 m_window->removeEventFilter(m_platformWindowStateDetector);
522 m_platformWindowStateDetector->deleteLater();
524
526 }
527
528 return currentState;
529}
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 396 of file KisWaylandSurfaceColorManager.cpp.

397{
405
406 if (m_waylandManager->isReady()) {
407 currentState = WaylandSurfaceState::Connected;
408 }
409
410 if (currentState == WaylandSurfaceState::Connected) {
412 auto *filter = new PlatformWindowDetectionEventFilter(m_window, this);
413 connect(filter,
415 this,
417 connect(filter,
419 this,
421 m_window->installEventFilter(filter);
423 }
424
425 auto waylandWindow = m_window->nativeInterface<QNativeInterface::Private::QWaylandWindow>();
426 if (waylandWindow) {
428 }
429 }
430
431 if (currentState == WaylandSurfaceState::WaylandWindowCreated) {
432 auto waylandWindow = m_window->nativeInterface<QNativeInterface::Private::QWaylandWindow>();
433
435 m_surfaceCreatedConnection = connect(waylandWindow,
436 &QNativeInterface::Private::QWaylandWindow::surfaceCreated,
437 this,
439 }
440
442 m_surfaceDestroyedConnection = connect(waylandWindow,
443 &QNativeInterface::Private::QWaylandWindow::surfaceDestroyed,
444 this,
446 }
447
448 if (waylandWindow->surface()) {
450 }
451 }
452
453 if (currentState == WaylandSurfaceState::WaylandSurfaceCreated) {
454 auto waylandWindow = m_window->nativeInterface<QNativeInterface::Private::QWaylandWindow>();
455
456 if (!m_surface) {
457 auto feedback = std::make_unique<KisWaylandAPISurfaceFeedback>(
458 m_waylandManager->get_surface_feedback(waylandWindow->surface()));
459 connect(feedback.get(),
461 this,
463 m_surface = std::make_unique<KisWaylandAPISurface>(m_waylandManager->get_surface(waylandWindow->surface()),
464 std::move(feedback));
465 }
466
468 }
469
470 if (currentState == WaylandSurfaceState::APIFeedbackCreated) {
471 if (m_surface->m_feedback->m_preferred->info.isReady()) {
472 auto waylandDesc = m_surface->m_feedback->m_preferred->info.m_data;
473 m_preferredDescription = waylandDesc.toSurfaceDescription();
474
476 }
477 }
478
479 return currentState;
480}
Q_SIGNAL void preferredChanged()

References APIFeedbackCreated, 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 302 of file KisWaylandSurfaceColorManager.cpp.

303{
304 if (!m_isReady) return;
305
306 m_surface->unset_image_description();
307 m_currentDescription = std::nullopt;
308 m_renderingIntent = std::nullopt;
309}

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: