summaryrefslogtreecommitdiff
path: root/src/protocols/ColorManagement.hpp
diff options
context:
space:
mode:
authorUjinT34 <41110182+UjinT34@users.noreply.github.com>2025-02-26 17:56:37 +0300
committerGitHub <noreply@github.com>2025-02-26 15:56:37 +0100
commit6787fe8933b54f9e68f123df457e502dee9be13a (patch)
treef77f71d739e8d403347b83fde4377bc519acea3e /src/protocols/ColorManagement.hpp
parentf0850905f0275922340035f62b6d808c2980ceda (diff)
protocols: Support wp color management proto (#9444)
Adds support for the recently merged w-p CM protocol alongside the (now deprecated) old CM WIP protocols
Diffstat (limited to 'src/protocols/ColorManagement.hpp')
-rw-r--r--src/protocols/ColorManagement.hpp101
1 files changed, 63 insertions, 38 deletions
diff --git a/src/protocols/ColorManagement.hpp b/src/protocols/ColorManagement.hpp
index 39e3f486..644b0a4d 100644
--- a/src/protocols/ColorManagement.hpp
+++ b/src/protocols/ColorManagement.hpp
@@ -4,8 +4,9 @@
#include <vector>
#include <cstdint>
#include "WaylandProtocol.hpp"
+#include "helpers/Monitor.hpp"
#include "protocols/core/Compositor.hpp"
-#include "xx-color-management-v4.hpp"
+#include "color-management-v1.hpp"
#include "types/ColorManagement.hpp"
class CColorManager;
@@ -15,17 +16,17 @@ class CColorManagementProtocol;
class CColorManager {
public:
- CColorManager(SP<CXxColorManagerV4> resource_);
+ CColorManager(SP<CWpColorManagerV1> resource);
bool good();
private:
- SP<CXxColorManagerV4> resource;
+ SP<CWpColorManagerV1> m_resource;
};
class CColorManagementOutput {
public:
- CColorManagementOutput(SP<CXxColorManagementOutputV4> resource_);
+ CColorManagementOutput(SP<CWpColorManagementOutputV1> resource, WP<CMonitor> monitor);
bool good();
wl_client* client();
@@ -34,8 +35,9 @@ class CColorManagementOutput {
WP<CColorManagementImageDescription> imageDescription;
private:
- SP<CXxColorManagementOutputV4> resource;
+ SP<CWpColorManagementOutputV1> m_resource;
wl_client* pClient = nullptr;
+ WP<CMonitor> m_monitor;
friend class CColorManagementProtocol;
friend class CColorManagementImageDescription;
@@ -44,35 +46,36 @@ class CColorManagementOutput {
class CColorManagementSurface {
public:
CColorManagementSurface(SP<CWLSurfaceResource> surface_); // temporary interface for frog CM
- CColorManagementSurface(SP<CXxColorManagementSurfaceV4> resource_, SP<CWLSurfaceResource> surface_);
+ CColorManagementSurface(SP<CWpColorManagementSurfaceV1> resource, SP<CWLSurfaceResource> surface_);
- bool good();
- wl_client* client();
+ bool good();
+ wl_client* client();
- WP<CColorManagementSurface> self;
- WP<CWLSurfaceResource> surface;
+ WP<CColorManagementSurface> self;
+ WP<CWLSurfaceResource> surface;
- const SImageDescription& imageDescription();
- bool hasImageDescription();
- void setHasImageDescription(bool has);
- const hdr_output_metadata& hdrMetadata();
- void setHDRMetadata(const hdr_output_metadata& metadata);
- bool needsHdrMetadataUpdate();
+ const NColorManagement::SImageDescription& imageDescription();
+ bool hasImageDescription();
+ void setHasImageDescription(bool has);
+ const hdr_output_metadata& hdrMetadata();
+ void setHDRMetadata(const hdr_output_metadata& metadata);
+ bool needsHdrMetadataUpdate();
private:
- SP<CXxColorManagementSurfaceV4> resource;
- wl_client* pClient = nullptr;
- SImageDescription m_imageDescription;
- bool m_hasImageDescription = false;
- bool m_needsNewMetadata = false;
- hdr_output_metadata m_hdrMetadata;
-
+ SP<CWpColorManagementSurfaceV1> m_resource;
+ wl_client* pClient = nullptr;
+ NColorManagement::SImageDescription m_imageDescription;
+ bool m_hasImageDescription = false;
+ bool m_needsNewMetadata = false;
+ hdr_output_metadata m_hdrMetadata;
+
+ friend class CXXColorManagementSurface;
friend class CFrogColorManagementSurface;
};
class CColorManagementFeedbackSurface {
public:
- CColorManagementFeedbackSurface(SP<CXxColorManagementFeedbackSurfaceV4> resource_, SP<CWLSurfaceResource> surface_);
+ CColorManagementFeedbackSurface(SP<CWpColorManagementSurfaceFeedbackV1> resource, SP<CWLSurfaceResource> surface_);
bool good();
wl_client* client();
@@ -81,7 +84,7 @@ class CColorManagementFeedbackSurface {
WP<CWLSurfaceResource> surface;
private:
- SP<CXxColorManagementFeedbackSurfaceV4> resource;
+ SP<CWpColorManagementSurfaceFeedbackV1> m_resource;
wl_client* pClient = nullptr;
WP<CColorManagementImageDescription> m_currentPreferred;
@@ -89,16 +92,32 @@ class CColorManagementFeedbackSurface {
friend class CColorManagementProtocol;
};
+class CColorManagementIccCreator {
+ public:
+ CColorManagementIccCreator(SP<CWpImageDescriptionCreatorIccV1> resource);
+
+ bool good();
+ wl_client* client();
+
+ WP<CColorManagementIccCreator> self;
+
+ NColorManagement::SImageDescription settings;
+
+ private:
+ SP<CWpImageDescriptionCreatorIccV1> m_resource;
+ wl_client* pClient = nullptr;
+};
+
class CColorManagementParametricCreator {
public:
- CColorManagementParametricCreator(SP<CXxImageDescriptionCreatorParamsV4> resource_);
+ CColorManagementParametricCreator(SP<CWpImageDescriptionCreatorParamsV1> resource);
bool good();
wl_client* client();
WP<CColorManagementParametricCreator> self;
- SImageDescription settings;
+ NColorManagement::SImageDescription settings;
private:
enum eValuesSet : uint32_t { // NOLINT
@@ -112,25 +131,25 @@ class CColorManagementParametricCreator {
PC_FALL = (1 << 7),
};
- SP<CXxImageDescriptionCreatorParamsV4> resource;
+ SP<CWpImageDescriptionCreatorParamsV1> m_resource;
wl_client* pClient = nullptr;
uint32_t valuesSet = 0; // enum eValuesSet
};
class CColorManagementImageDescription {
public:
- CColorManagementImageDescription(SP<CXxImageDescriptionV4> resource_, bool allowGetInformation = false);
+ CColorManagementImageDescription(SP<CWpImageDescriptionV1> resource, bool allowGetInformation = false);
bool good();
wl_client* client();
- SP<CXxImageDescriptionV4> resource();
+ SP<CWpImageDescriptionV1> resource();
WP<CColorManagementImageDescription> self;
- SImageDescription settings;
+ NColorManagement::SImageDescription settings;
private:
- SP<CXxImageDescriptionV4> m_resource;
+ SP<CWpImageDescriptionV1> m_resource;
wl_client* pClient = nullptr;
bool m_allowGetInformation = false;
@@ -139,30 +158,32 @@ class CColorManagementImageDescription {
class CColorManagementImageDescriptionInfo {
public:
- CColorManagementImageDescriptionInfo(SP<CXxImageDescriptionInfoV4> resource_, const SImageDescription& settings_);
+ CColorManagementImageDescriptionInfo(SP<CWpImageDescriptionInfoV1> resource, const NColorManagement::SImageDescription& settings_);
bool good();
wl_client* client();
private:
- SP<CXxImageDescriptionInfoV4> m_resource;
- wl_client* pClient = nullptr;
- SImageDescription settings;
+ SP<CWpImageDescriptionInfoV1> m_resource;
+ wl_client* pClient = nullptr;
+ NColorManagement::SImageDescription settings;
};
class CColorManagementProtocol : public IWaylandProtocol {
public:
- CColorManagementProtocol(const wl_interface* iface, const int& ver, const std::string& name);
+ CColorManagementProtocol(const wl_interface* iface, const int& ver, const std::string& name, bool debug = false);
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
- void onImagePreferredChanged();
+ void onImagePreferredChanged(uint32_t preferredId);
+ void onMonitorImageDescriptionChanged(WP<CMonitor> monitor);
private:
void destroyResource(CColorManager* resource);
void destroyResource(CColorManagementOutput* resource);
void destroyResource(CColorManagementSurface* resource);
void destroyResource(CColorManagementFeedbackSurface* resource);
+ void destroyResource(CColorManagementIccCreator* resource);
void destroyResource(CColorManagementParametricCreator* resource);
void destroyResource(CColorManagementImageDescription* resource);
@@ -170,16 +191,20 @@ class CColorManagementProtocol : public IWaylandProtocol {
std::vector<SP<CColorManagementOutput>> m_vOutputs;
std::vector<SP<CColorManagementSurface>> m_vSurfaces;
std::vector<SP<CColorManagementFeedbackSurface>> m_vFeedbackSurfaces;
+ std::vector<SP<CColorManagementIccCreator>> m_vIccCreators;
std::vector<SP<CColorManagementParametricCreator>> m_vParametricCreators;
std::vector<SP<CColorManagementImageDescription>> m_vImageDescriptions;
+ bool m_debug = false;
friend class CColorManager;
friend class CColorManagementOutput;
friend class CColorManagementSurface;
friend class CColorManagementFeedbackSurface;
+ friend class CColorManagementIccCreator;
friend class CColorManagementParametricCreator;
friend class CColorManagementImageDescription;
+ friend class CXXColorManagementSurface;
friend class CFrogColorManagementSurface;
};