feat: adaptive_sync support

This commit is contained in:
DreamMaoMao 2025-09-18 11:51:19 +08:00
parent 13e90496ef
commit 481a76eb36
3 changed files with 34 additions and 6 deletions

View file

@ -302,6 +302,7 @@ typedef struct {
int single_scratchpad;
int xwayland_persistence;
int syncobj_enable;
int adaptive_sync;
struct xkb_rule_names xkb_rules;
} Config;
@ -1012,6 +1013,8 @@ void parse_config_line(Config *config, const char *line) {
config->xwayland_persistence = atoi(value);
} else if (strcmp(key, "syncobj_enable") == 0) {
config->syncobj_enable = atoi(value);
} else if (strcmp(key, "adaptive_sync") == 0) {
config->adaptive_sync = atoi(value);
} else if (strcmp(key, "no_border_when_single") == 0) {
config->no_border_when_single = atoi(value);
} else if (strcmp(key, "no_radius_when_single") == 0) {
@ -2339,6 +2342,7 @@ void override_config(void) {
// 杂项设置
xwayland_persistence = CLAMP_INT(config.xwayland_persistence, 0, 1);
syncobj_enable = CLAMP_INT(config.syncobj_enable, 0, 1);
adaptive_sync = CLAMP_INT(config.adaptive_sync, 0, 1);
axis_bind_apply_timeout =
CLAMP_INT(config.axis_bind_apply_timeout, 0, 1000);
focus_on_activate = CLAMP_INT(config.focus_on_activate, 0, 1);
@ -2501,6 +2505,7 @@ void set_value_default() {
config.single_scratchpad = single_scratchpad;
config.xwayland_persistence = xwayland_persistence;
config.syncobj_enable = syncobj_enable;
config.adaptive_sync = adaptive_sync;
config.no_border_when_single = no_border_when_single;
config.no_radius_when_single = no_radius_when_single;
config.snap_distance = snap_distance;
@ -2755,6 +2760,10 @@ void reapply_monitor_rules(void) {
}
}
if (adaptive_sync) {
enable_adaptive_sync(m, &state);
}
wlr_output_commit_state(m->wlr_output, &state);
wlr_output_state_finish(&state);
updatemons(NULL, NULL);