sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

render_bit_depth.c (962B) - View raw


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#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, "6") == 0) {
		config->handler_context.output_config->render_bit_depth =
			RENDER_BIT_DEPTH_6;
	} else 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 (6|8|10).");
	}

	config->handler_context.leftovers.argc = argc - 1;
	config->handler_context.leftovers.argv = argv + 1;
	return NULL;
}