This commit is contained in:
Manu Linares 2026-04-02 19:31:32 +00:00 committed by GitHub
commit 0759289c3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,6 +9,8 @@
#include <wlr/config.h> #include <wlr/config.h>
#include <wlr/render/allocator.h> #include <wlr/render/allocator.h>
#include <wlr/types/wlr_alpha_modifier_v1.h> #include <wlr/types/wlr_alpha_modifier_v1.h>
#include <wlr/types/wlr_color_management_v1.h>
#include <wlr/types/wlr_color_representation_v1.h>
#include <wlr/types/wlr_data_control_v1.h> #include <wlr/types/wlr_data_control_v1.h>
#include <wlr/types/wlr_data_device.h> #include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_drm.h> #include <wlr/types/wlr_drm.h>
@ -592,6 +594,47 @@ server_init(void)
* | output->layer_tree[0] | background layer surfaces (e.g. swaybg) * | output->layer_tree[0] | background layer surfaces (e.g. swaybg)
*/ */
if (server.renderer->features.input_color_transform) {
const enum wp_color_manager_v1_render_intent render_intents[] = {
WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL,
};
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, 2, &(struct wlr_color_manager_v1_options){
.features = {
.parametric = true,
.set_mastering_display_primaries = true,
},
.render_intents = render_intents,
.render_intents_len = ARRAY_SIZE(render_intents),
.transfer_functions = transfer_functions,
.transfer_functions_len = transfer_functions_len,
.primaries = primaries,
.primaries_len = primaries_len,
});
free(transfer_functions);
free(primaries);
if (cm) {
wlr_scene_set_color_manager_v1(server.scene, cm);
} else {
wlr_log(WLR_ERROR, "unable to create color manager");
}
}
wlr_color_representation_manager_v1_create_with_renderer(
server.wl_display, 1, server.renderer);
server.workspace_tree = lab_wlr_scene_tree_create(&server.scene->tree); server.workspace_tree = lab_wlr_scene_tree_create(&server.scene->tree);
server.xdg_popup_tree = lab_wlr_scene_tree_create(&server.scene->tree); server.xdg_popup_tree = lab_wlr_scene_tree_create(&server.scene->tree);
#if HAVE_XWAYLAND #if HAVE_XWAYLAND