sway/config/output: Add max_render_time=auto option

This commit is contained in:
Andri Yngvason 2022-09-24 15:22:30 +00:00
parent ccf1cc7c2d
commit ff14df6db3
3 changed files with 11 additions and 2 deletions

View file

@ -21,6 +21,9 @@
// TODO: Refactor this shit
#define MAX_RENDER_TIME_OFF 0
#define MAX_RENDER_TIME_AUTO -2
/**
* Describes a variable created via the `set` command.
*/

View file

@ -12,7 +12,9 @@ struct cmd_results *output_cmd_max_render_time(int argc, char **argv) {
int max_render_time;
if (!strcmp(*argv, "off")) {
max_render_time = 0;
max_render_time = MAX_RENDER_TIME_OFF;
} else if (!strcmp(*argv, "auto")) {
max_render_time = MAX_RENDER_TIME_AUTO;
} else {
char *end;
max_render_time = strtol(*argv, &end, 10);

View file

@ -571,6 +571,10 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
sway_log(SWAY_DEBUG, "Set %s max render time to %d",
oc->name, oc->max_render_time);
output->max_render_time = oc->max_render_time;
} else if (oc && oc->max_render_time == MAX_RENDER_TIME_AUTO) {
sway_log(SWAY_DEBUG, "Set %s max render time to auto",
oc->name);
output->max_render_time = -1;
}
// Reconfigure all devices, since input config may have been applied before
@ -608,7 +612,7 @@ static void default_output_config(struct output_config *oc,
struct sway_output *output = wlr_output->data;
oc->subpixel = output->detected_subpixel;
oc->transform = WL_OUTPUT_TRANSFORM_NORMAL;
oc->max_render_time = 0;
oc->max_render_time = MAX_RENDER_TIME_OFF;
}
static struct output_config *get_output_config(char *identifier,