mirror of
https://github.com/labwc/labwc.git
synced 2026-04-07 08:21:20 -04:00
chase wlroots: Add support for color-management-v1
v2: Chase wlroots!5122 v3: Chase wlroots!5141 v4: Chase wlroots!5165 v5: Chase wlroots 9b4d9eab v6: Chase wlroots 58f0867c v7: Rebase chase/0.20 v8: Reorder some of the setup code v9: Update wayland-protocols version v10: Chase wlroots 7101a69 v11: Fix code style v12: Remove server protocol declaration
This commit is contained in:
parent
2a6fe0409d
commit
4b545fdcbd
5 changed files with 64 additions and 12 deletions
39
src/server.c
39
src/server.c
|
|
@ -9,6 +9,7 @@
|
|||
#include <wlr/config.h>
|
||||
#include <wlr/render/allocator.h>
|
||||
#include <wlr/types/wlr_alpha_modifier_v1.h>
|
||||
#include <wlr/types/wlr_color_management_v1.h>
|
||||
#include <wlr/types/wlr_data_control_v1.h>
|
||||
#include <wlr/types/wlr_data_device.h>
|
||||
#include <wlr/types/wlr_drm.h>
|
||||
|
|
@ -724,6 +725,44 @@ server_init(void)
|
|||
|
||||
server.tablet_manager = wlr_tablet_v2_create(server.wl_display);
|
||||
|
||||
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_log(WLR_ERROR, "Failed to create color manager");
|
||||
} else {
|
||||
wlr_scene_set_color_manager_v1(server.scene, cm);
|
||||
}
|
||||
}
|
||||
|
||||
layers_init();
|
||||
|
||||
/* These get cleaned up automatically on display destroy */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue