Skip to content

Commit 02cf56a

Browse files
committed
feat: color management v1 impl
1 parent bf67330 commit 02cf56a

3 files changed

Lines changed: 32 additions & 0 deletions

File tree

include/wlr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ extern "C" {
5151

5252
// Unstable
5353
#include <wlr/types/wlr_alpha_modifier_v1.h>
54+
#include <wlr/types/wlr_color_management_v1.h>
5455
#include <wlr/types/wlr_cursor_shape_v1.h>
5556
#include <wlr/types/wlr_data_control_v1.h>
5657
#include <wlr/types/wlr_drm.h>

meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ protocols = [
3636
wl_protocols_dir / 'staging' / 'ext-image-capture-source' / 'ext-image-capture-source-v1.xml',
3737
wl_protocols_dir / 'staging' / 'ext-image-copy-capture' / 'ext-image-copy-capture-v1.xml',
3838
wl_protocols_dir / 'staging' / 'cursor-shape' / 'cursor-shape-v1.xml',
39+
wl_protocols_dir / 'staging' / 'color-management' / 'color-management-v1.xml',
3940
wl_protocols_dir / 'unstable' / 'xdg-output' / 'xdg-output-unstable-v1.xml',
4041
wl_protocols_dir / 'unstable' / 'linux-dmabuf' / 'linux-dmabuf-unstable-v1.xml',
4142
wl_protocols_dir / 'unstable' / 'pointer-constraints' / 'pointer-constraints-unstable-v1.xml',

src/Server.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "Server.h"
2+
#include "wlr.h"
23

34
// get workspace by toplevel
45
Workspace *Server::get_workspace(Toplevel *toplevel) const {
@@ -733,6 +734,35 @@ Server::Server(Config *config) : config(config) {
733734
// primary selection
734735
wlr_primary_selection_v1_device_manager_create(display);
735736

737+
// color manager
738+
const struct wlr_color_manager_v1_features color_manager_features = {
739+
false, true, false, false, false, true, false, false};
740+
const enum wp_color_manager_v1_render_intent
741+
color_manager_render_intents[] = {
742+
WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL,
743+
};
744+
const enum wp_color_manager_v1_transfer_function
745+
color_manager_transfer_functions[] = {
746+
WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB,
747+
WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST2084_PQ,
748+
};
749+
const enum wp_color_manager_v1_primaries color_manager_primaries[] = {
750+
WP_COLOR_MANAGER_V1_PRIMARIES_SRGB,
751+
WP_COLOR_MANAGER_V1_PRIMARIES_BT2020,
752+
};
753+
const wlr_color_manager_v1_options color_manager_options = {
754+
color_manager_features,
755+
color_manager_render_intents,
756+
sizeof(color_manager_render_intents) /
757+
sizeof(color_manager_render_intents[0]),
758+
color_manager_transfer_functions,
759+
sizeof(color_manager_transfer_functions) /
760+
sizeof(color_manager_transfer_functions[0]),
761+
color_manager_primaries,
762+
sizeof(color_manager_primaries) / sizeof(color_manager_primaries[0]),
763+
};
764+
wlr_color_manager_v1_create(display, 1, &color_manager_options);
765+
736766
// avoid using "wayland-0" as display socket
737767
std::string socket;
738768
for (unsigned int i = 1; i <= 32; i++) {

0 commit comments

Comments
 (0)