diff --git a/include/sway/config.h b/include/sway/config.h index 68c068462..446c24e71 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -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. */ diff --git a/sway/commands/output/max_render_time.c b/sway/commands/output/max_render_time.c index 2d3cebe30..d45611468 100644 --- a/sway/commands/output/max_render_time.c +++ b/sway/commands/output/max_render_time.c @@ -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); diff --git a/sway/config/output.c b/sway/config/output.c index 9c7082d07..5e07482ff 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -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,