sway/commands/output: color_profile "srgb" applies the piece-wise TF

Document that "gamma22" replaced the previous default.
This commit is contained in:
Félix Poisot 2025-11-01 16:15:26 +00:00 committed by Simon Ser
parent f654fe8ede
commit 776d445ec5
2 changed files with 13 additions and 4 deletions

View file

@ -59,11 +59,19 @@ struct cmd_results *output_cmd_color_profile(int argc, char **argv) {
return cmd_results_new(CMD_INVALID, "Missing color_profile first argument."); return cmd_results_new(CMD_INVALID, "Missing color_profile first argument.");
} }
if (strcmp(*argv, "srgb") == 0) { if (strcmp(*argv, "gamma22") == 0) {
wlr_color_transform_unref(config->handler_context.output_config->color_transform); wlr_color_transform_unref(config->handler_context.output_config->color_transform);
config->handler_context.output_config->color_transform = NULL; config->handler_context.output_config->color_transform = NULL;
config->handler_context.output_config->set_color_transform = true; config->handler_context.output_config->set_color_transform = true;
config->handler_context.leftovers.argc = argc - 1;
config->handler_context.leftovers.argv = argv + 1;
} else if (strcmp(*argv, "srgb") == 0) {
wlr_color_transform_unref(config->handler_context.output_config->color_transform);
config->handler_context.output_config->color_transform =
wlr_color_transform_init_linear_to_inverse_eotf(WLR_COLOR_TRANSFER_FUNCTION_SRGB);
config->handler_context.output_config->set_color_transform = true;
config->handler_context.leftovers.argc = argc - 1; config->handler_context.leftovers.argc = argc - 1;
config->handler_context.leftovers.argv = argv + 1; config->handler_context.leftovers.argv = argv + 1;
} else if (strcmp(*argv, "icc") == 0) { } else if (strcmp(*argv, "icc") == 0) {
@ -106,7 +114,8 @@ struct cmd_results *output_cmd_color_profile(int argc, char **argv) {
config->handler_context.leftovers.argv = argv + 2; config->handler_context.leftovers.argv = argv + 2;
} else { } else {
return cmd_results_new(CMD_INVALID, return cmd_results_new(CMD_INVALID,
"Invalid color profile specification: first argument should be icc|srgb"); "Invalid color profile specification: "
"first argument should be gamma22|icc|srgb");
} }
return NULL; return NULL;

View file

@ -178,8 +178,8 @@ must be separated by one space. For example:
updated to work with different bit depths. This command is experimental, updated to work with different bit depths. This command is experimental,
and may be removed or changed in the future. and may be removed or changed in the future.
*output* <name> color_profile srgb|[icc <file>] *output* <name> color_profile gamma22|srgb|[icc <file>]
Sets the color profile for an output. The default is _srgb_. <file> should be a Sets the color profile for an output. The default is _gamma22_. <file> should be a
path to a display ICC profile. path to a display ICC profile.
Not all renderers support this feature; currently it only works with the Not all renderers support this feature; currently it only works with the