Skip to content

Commit

Permalink
Add support for color-management-v1
Browse files Browse the repository at this point in the history
  • Loading branch information
emersion committed Jan 26, 2025
1 parent 8acb048 commit ea4181a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions protocols/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ wayland_scanner = find_program(
protocols = [
wl_protocol_dir / 'stable/tablet/tablet-v2.xml',
wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
wl_protocol_dir / 'staging/color-management/color-management-v1.xml',
wl_protocol_dir / 'staging/content-type/content-type-v1.xml',
wl_protocol_dir / 'staging/cursor-shape/cursor-shape-v1.xml',
wl_protocol_dir / 'staging/ext-foreign-toplevel-list/ext-foreign-toplevel-list-v1.xml',
Expand Down
25 changes: 25 additions & 0 deletions sway/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_alpha_modifier_v1.h>
#include <wlr/types/wlr_color_management_v1.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_content_type_v1.h>
#include <wlr/types/wlr_cursor_shape_v1.h>
Expand Down Expand Up @@ -411,6 +412,30 @@ bool server_init(struct sway_server *server) {
server->request_set_cursor_shape.notify = handle_request_set_cursor_shape;
wl_signal_add(&cursor_shape_manager->events.request_set_shape, &server->request_set_cursor_shape);

const enum wp_color_manager_v1_render_intent render_intents[] = {
WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL,
};
const enum wp_color_manager_v1_transfer_function transfer_functions[] = {
WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB,
WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST2084_PQ,
};
const enum wp_color_manager_v1_primaries primaries[] = {
WP_COLOR_MANAGER_V1_PRIMARIES_SRGB,
WP_COLOR_MANAGER_V1_PRIMARIES_BT2020,
};
wlr_color_manager_v1_create(server->wl_display, 1, &(struct wlr_color_manager_v1_options){
.features = {
.parametric = true,
.set_mastering_display_primaries = true,
},
.render_intents = render_intents,
.render_intents_len = sizeof(render_intents) / sizeof(render_intents[0]),
.transfer_functions = transfer_functions,
.transfer_functions_len = sizeof(transfer_functions) / sizeof(transfer_functions[0]),
.primaries = primaries,
.primaries_len = sizeof(primaries) / sizeof(primaries[0]),
});

wl_list_init(&server->pending_launcher_ctxs);

// Avoid using "wayland-0" as display socket
Expand Down

0 comments on commit ea4181a

Please sign in to comment.