feat: advertise color-management-v1 (SDR sRGB session)

This commit is contained in:
Andrew Hamilton 2026-09-09 22:47:44 +10:00
parent 04e056518a
commit 5b871e447b
3 changed files with 60 additions and 0 deletions

39
kick.c
View file

@ -76,6 +76,7 @@
#include <wlr/render/wlr_renderer.h>
#include <wlr/render/wlr_texture.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_color_management_v1.h>
#include <wlr/types/wlr_color_representation_v1.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_content_type_v1.h>
@ -459,6 +460,12 @@ struct kick_server {
validates client values against the advertised SDR sRGB set, so
beyond creating the manager there is nothing to wire. */
struct wlr_color_representation_manager_v1 *color_repr_mgr;
/* Color management (wp_color_manager_v1): clients describe surface
colors via image descriptions; the scene forwards feedback.
kick is an SDR sRGB session, so advertise perceptual intent with
sRGB transfer characteristics and primaries (no ICC/parametric
features, matching wlroots' current scope). */
struct wlr_color_manager_v1 *color_manager;
/* Keyboard shortcuts inhibit (zwp_keyboard_shortcuts_inhibit_v1): lets a
fullscreen game/VM grab the compositor's keyboard shortcuts. While the
focused surface's inhibitor is active, the grab chords in
@ -12110,6 +12117,38 @@ int main(int argc, char *argv[]) {
server.wl_display, 1, &color_opts);
}
/* Color management: advertise the SDR sRGB session so color-aware
clients can negotiate image descriptions; the scene handles
per-surface feedback once linked. */
{
static const enum wp_color_manager_v1_render_intent
color_render_intents[] = {
WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL,
};
static const enum wp_color_manager_v1_transfer_function
color_transfer_functions[] = {
WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_SRGB,
};
static const enum wp_color_manager_v1_primaries
color_primaries[] = {
WP_COLOR_MANAGER_V1_PRIMARIES_SRGB,
};
const struct wlr_color_manager_v1_options color_mgmt_opts = {
.features = {0},
.render_intents = color_render_intents,
.render_intents_len = 1,
.transfer_functions = color_transfer_functions,
.transfer_functions_len = 1,
.primaries = color_primaries,
.primaries_len = 1,
};
server.color_manager = wlr_color_manager_v1_create(
server.wl_display, 1, &color_mgmt_opts);
if (server.color_manager)
wlr_scene_set_color_manager_v1(server.scene,
server.color_manager);
}
/* The output layout exists in both modes so xdg-output can advertise
logical output geometry to clients; nested mode simply has one output
(the host window) in the layout. */