mirror of
https://github.com/swaywm/sway.git
synced 2026-04-21 06:46:22 -04:00
sway/config/output: Add max_render_time=auto option
This commit is contained in:
parent
ccf1cc7c2d
commit
ff14df6db3
3 changed files with 11 additions and 2 deletions
|
|
@ -21,6 +21,9 @@
|
||||||
|
|
||||||
// TODO: Refactor this shit
|
// TODO: Refactor this shit
|
||||||
|
|
||||||
|
#define MAX_RENDER_TIME_OFF 0
|
||||||
|
#define MAX_RENDER_TIME_AUTO -2
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes a variable created via the `set` command.
|
* Describes a variable created via the `set` command.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,9 @@ struct cmd_results *output_cmd_max_render_time(int argc, char **argv) {
|
||||||
|
|
||||||
int max_render_time;
|
int max_render_time;
|
||||||
if (!strcmp(*argv, "off")) {
|
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 {
|
} else {
|
||||||
char *end;
|
char *end;
|
||||||
max_render_time = strtol(*argv, &end, 10);
|
max_render_time = strtol(*argv, &end, 10);
|
||||||
|
|
|
||||||
|
|
@ -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",
|
sway_log(SWAY_DEBUG, "Set %s max render time to %d",
|
||||||
oc->name, oc->max_render_time);
|
oc->name, oc->max_render_time);
|
||||||
output->max_render_time = 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
|
// 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;
|
struct sway_output *output = wlr_output->data;
|
||||||
oc->subpixel = output->detected_subpixel;
|
oc->subpixel = output->detected_subpixel;
|
||||||
oc->transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
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,
|
static struct output_config *get_output_config(char *identifier,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue