| 1 | /* |
| 2 | * SPDX-FileCopyrightText: 2025 Dmitry Kazakov <[email protected]> |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #include "KisWaylandAPIColorManager.h" |
| 8 | |
| 9 | #include <QDebug> |
| 10 | |
| 11 | KisWaylandAPIColorManager::KisWaylandAPIColorManager() |
| 12 | : QWaylandClientExtensionTemplate(1) |
| 13 | { |
| 14 | connect(this, &QWaylandClientExtensionTemplate::activeChanged, this, [this] { |
| 15 | if (!isActive()) { |
| 16 | m_supportedFeatures.clear(); |
| 17 | m_supportedIntents.clear(); |
| 18 | m_supportedPrimariesNamed.clear(); |
| 19 | m_supportedTransferFunctionsNamed.clear(); |
| 20 | if (m_isReady) { |
| 21 | m_isReady = false; |
| 22 | Q_EMIT sigReadyChanged(m_isReady); |
| 23 | } |
| 24 | } |
| 25 | }); |
| 26 | } |
| 27 | |
| 28 | KisWaylandAPIColorManager::~KisWaylandAPIColorManager() |
| 29 | { |
| 30 | // the destruction of the member object is automatically handled |
| 31 | // be the extension template class (thanks to the second template |
| 32 | // parameter) |
| 33 | } |
| 34 | |
| 35 | void KisWaylandAPIColorManager::wp_color_manager_v1_supported_intent(uint32_t _render_intent) |
| 36 | { |
| 37 | m_supportedIntents.insert(static_cast<render_intent>(_render_intent)); |
| 38 | } |
| 39 | void KisWaylandAPIColorManager::wp_color_manager_v1_supported_feature(uint32_t _feature) |
| 40 | { |
| 41 | m_supportedFeatures.insert(static_cast<feature>(_feature)); |
| 42 | } |
| 43 | void KisWaylandAPIColorManager::wp_color_manager_v1_supported_tf_named(uint32_t tf) |
| 44 | { |
| 45 | m_supportedTransferFunctionsNamed.insert(static_cast<transfer_function>(tf)); |
| 46 | } |
| 47 | void KisWaylandAPIColorManager::wp_color_manager_v1_supported_primaries_named(uint32_t _primaries) |
| 48 | { |
| 49 | m_supportedPrimariesNamed.insert(static_cast<primaries>(_primaries)); |
| 50 | } |
| 51 | void KisWaylandAPIColorManager::wp_color_manager_v1_done() |
| 52 | { |
| 53 | if (m_isReady) { |
| 54 | qWarning() << "WARNING: KisWaylandAPIColorManager::wp_color_manager_v1_done(): done event arrived while ready is true"; |
| 55 | } |
| 56 | |
| 57 | m_isReady = true; |
| 58 | Q_EMIT sigReadyChanged(m_isReady); |
| 59 | } |
| 60 | |
| 61 | #include "moc_KisWaylandAPIColorManager.cpp" |