fix: fix fullscreen tearing only

This commit is contained in:
DreamMaoMao 2026-06-24 07:47:46 +08:00
parent c0384bd11d
commit 085d65c219

View file

@ -946,6 +946,7 @@ static void global_draw_group_bar(Client *c, int32_t x, int32_t y,
static void client_reparent_group(Client *c); static void client_reparent_group(Client *c);
static void client_change_mon(Client *c, Monitor *m); static void client_change_mon(Client *c, Monitor *m);
static void check_vrr_enable(Client *c);
#include "data/static_keymap.h" #include "data/static_keymap.h"
#include "dispatch/bind_declare.h" #include "dispatch/bind_declare.h"
@ -3908,6 +3909,7 @@ void focusclient(Client *c, int32_t lift) {
c->isfocusing = true; c->isfocusing = true;
check_keep_idle_inhibit(c); check_keep_idle_inhibit(c);
check_vrr_enable(c);
if (last_focus_client && !last_focus_client->iskilling && if (last_focus_client && !last_focus_client->iskilling &&
last_focus_client != c) { last_focus_client != c) {
@ -5726,6 +5728,7 @@ void setfullscreen(Client *c, int32_t fullscreen,
} }
client_reparent_group(c); client_reparent_group(c);
check_vrr_enable(c);
if (rearrange) if (rearrange)
arrange(c->mon, false, false); arrange(c->mon, false, false);
@ -6514,19 +6517,27 @@ void check_keep_idle_inhibit(Client *c) {
if (c && c->idleinhibit_when_focus && keep_idle_inhibit_source) { if (c && c->idleinhibit_when_focus && keep_idle_inhibit_source) {
wl_event_source_timer_update(keep_idle_inhibit_source, 1000); wl_event_source_timer_update(keep_idle_inhibit_source, 1000);
} }
}
if (c && c->mon && c->vrr_only_fullscreen && c->isfullscreen && void check_vrr_enable(Client *c) {
!c->mon->is_vrr_opening) {
struct wlr_output_state state = {0}; if (!c || !c->mon)
return;
struct wlr_output_state state = {0};
if (c->vrr_only_fullscreen && c->isfullscreen && !c->mon->is_vrr_opening) {
enable_adaptive_sync(c->mon, &state); enable_adaptive_sync(c->mon, &state);
} else if (c && c->mon && (!c->vrr_only_fullscreen || !c->isfullscreen)) { wlr_output_commit_state(c->mon->wlr_output, &state);
if (!c->mon->is_vrr_opening && c->mon->vrr_global_enable) { return;
struct wlr_output_state state = {0}; }
enable_adaptive_sync(c->mon, &state);
} else if (c->mon->is_vrr_opening && !c->mon->vrr_global_enable) { if (!c->mon->is_vrr_opening && c->mon->vrr_global_enable) {
struct wlr_output_state state = {0}; enable_adaptive_sync(c->mon, &state);
disable_adaptive_sync(c->mon, &state); wlr_output_commit_state(c->mon->wlr_output, &state);
} } else if (c->mon->is_vrr_opening && !c->mon->vrr_global_enable) {
disable_adaptive_sync(c->mon, &state);
wlr_output_commit_state(c->mon->wlr_output, &state);
} }
} }