mirror of
https://github.com/gwenhael-le-moine/sway-patched-tray-menu.git
synced 2024-12-26 21:58:08 +01:00
a23cdbbea1
This makes it possible to hint to the renderer and backends how many bits per channel the buffers that the compositor draws windows onto should have. Renderers and backends may deviate from this if they do not support the formats with higher bit depth.
29 lines
838 B
C
29 lines
838 B
C
#include <drm_fourcc.h>
|
|
#include <strings.h>
|
|
#include "sway/commands.h"
|
|
#include "sway/config.h"
|
|
|
|
struct cmd_results *output_cmd_render_bit_depth(int argc, char **argv) {
|
|
if (!config->handler_context.output_config) {
|
|
return cmd_results_new(CMD_FAILURE, "Missing output config");
|
|
}
|
|
if (!argc) {
|
|
return cmd_results_new(CMD_INVALID, "Missing bit depth argument.");
|
|
}
|
|
|
|
if (strcmp(*argv, "8") == 0) {
|
|
config->handler_context.output_config->render_bit_depth =
|
|
RENDER_BIT_DEPTH_8;
|
|
} else if (strcmp(*argv, "10") == 0) {
|
|
config->handler_context.output_config->render_bit_depth =
|
|
RENDER_BIT_DEPTH_10;
|
|
} else {
|
|
return cmd_results_new(CMD_INVALID,
|
|
"Invalid bit depth. Must be a value in (8|10).");
|
|
}
|
|
|
|
config->handler_context.leftovers.argc = argc - 1;
|
|
config->handler_context.leftovers.argv = argv + 1;
|
|
return NULL;
|
|
}
|
|
|