opt: disable vrr when focus empty tag if not global enable vrr

This commit is contained in:
DreamMaoMao 2026-06-24 12:16:42 +08:00
parent 041a06e659
commit 5639b0728a
2 changed files with 18 additions and 9 deletions

View file

@ -265,9 +265,4 @@ void client_set_group_mon(Client *c, Monitor *m) {
client_change_mon(cur, m);
cur = cur->group_next;
}
}
void handle_client_focus_change(Client *c) {
check_keep_idle_inhibit(c);
check_vrr_enable(c);
}

View file

@ -4009,7 +4009,8 @@ void focusclient(Client *c, int32_t lift) {
selmon->sel = c;
c->isfocusing = true;
handle_client_focus_change(c);
check_keep_idle_inhibit(c);
check_vrr_enable(c);
if (last_focus_client && !last_focus_client->iskilling &&
last_focus_client != c) {
@ -4091,6 +4092,7 @@ void focusclient(Client *c, int32_t lift) {
// clear text input focus state
dwl_im_relay_set_focus(dwl_input_method_relay, NULL);
wlr_seat_keyboard_notify_clear_focus(seat);
check_vrr_enable(c);
if (active_constraint) {
cursorconstrain(NULL);
}
@ -6667,12 +6669,24 @@ void check_keep_idle_inhibit(Client *c) {
void check_vrr_enable(Client *c) {
if (!c || !c->mon)
struct wlr_output_state state = {0};
Monitor *m = c && c->mon ? c->mon : selmon;
if (!m)
return;
struct wlr_output_state state = {0};
if (!c && m && !m->iscleanuping && m->is_vrr_opening &&
!m->vrr_global_enable) {
disable_adaptive_sync(m, &state);
wlr_output_commit_state(m->wlr_output, &state);
return;
}
if (c->vrr_only_fullscreen && c->isfullscreen && !c->mon->is_vrr_opening) {
if (!c)
return;
if (VISIBLEON(c, c->mon) && c->vrr_only_fullscreen && c->isfullscreen &&
!c->mon->is_vrr_opening) {
enable_adaptive_sync(c->mon, &state);
wlr_output_commit_state(c->mon->wlr_output, &state);
return;