commit fa81ce8ee64d690b881d97b734583e26cb2acb72
parent f4aba22582184c9a4a20fd7a9ffd70c63b4b393d
Author: Simon Ser <contact@emersion.fr>
Date: Sat, 4 Oct 2025 11:54:31 +0200
Use helpers to get supported TFs/primaries
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5086
Diffstat:
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/sway/server.c b/sway/server.c
@@ -459,17 +459,12 @@ bool server_init(struct sway_server *server) {
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,
- WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR,
- WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22,
- WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_BT1886,
- };
- const enum wp_color_manager_v1_primaries primaries[] = {
- WP_COLOR_MANAGER_V1_PRIMARIES_SRGB,
- WP_COLOR_MANAGER_V1_PRIMARIES_BT2020,
- };
+ size_t transfer_functions_len = 0;
+ enum wp_color_manager_v1_transfer_function *transfer_functions =
+ wlr_color_manager_v1_transfer_function_list_from_renderer(server->renderer, &transfer_functions_len);
+ size_t primaries_len = 0;
+ enum wp_color_manager_v1_primaries *primaries =
+ wlr_color_manager_v1_primaries_list_from_renderer(server->renderer, &primaries_len);
struct wlr_color_manager_v1 *cm = wlr_color_manager_v1_create(
server->wl_display, 1, &(struct wlr_color_manager_v1_options){
.features = {
@@ -479,10 +474,12 @@ bool server_init(struct sway_server *server) {
.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]),
+ .transfer_functions_len = transfer_functions_len,
.primaries = primaries,
- .primaries_len = sizeof(primaries) / sizeof(primaries[0]),
+ .primaries_len = primaries_len,
});
+ free(transfer_functions);
+ free(primaries);
wlr_scene_set_color_manager_v1(root->root_scene, cm);
}