opt: optimize focus change when change monitor

This commit is contained in:
DreamMaoMao
2025-12-04 09:58:16 +08:00
parent 1b739a1c7e
commit e602605fa4
2 changed files with 10 additions and 8 deletions

View File

@@ -201,6 +201,7 @@ int focusmon(const Arg *arg) {
selmon->sel = NULL; selmon->sel = NULL;
wlr_seat_pointer_notify_clear_focus(seat); wlr_seat_pointer_notify_clear_focus(seat);
wlr_seat_keyboard_notify_clear_focus(seat); wlr_seat_keyboard_notify_clear_focus(seat);
focusclient(NULL, 0);
} else } else
focusclient(c, 1); focusclient(c, 1);

View File

@@ -3215,14 +3215,6 @@ void focusclient(Client *c, int lift) {
client_set_unfocused_opacity_animation(last_focus_client); client_set_unfocused_opacity_animation(last_focus_client);
} }
wl_list_for_each(um, &mons, link) {
if (um->wlr_output->enabled && um != selmon && um->sel &&
!um->sel->iskilling && um->sel->isfocusing) {
um->sel->isfocusing = false;
client_set_unfocused_opacity_animation(um->sel);
}
}
client_set_focused_opacity_animation(c); client_set_focused_opacity_animation(c);
// decide whether need to re-arrange // decide whether need to re-arrange
@@ -3242,6 +3234,15 @@ void focusclient(Client *c, int lift) {
c->isurgent = 0; c->isurgent = 0;
} }
// update other monitor focus disappear
wl_list_for_each(um, &mons, link) {
if (um->wlr_output->enabled && um != selmon && um->sel &&
!um->sel->iskilling && um->sel->isfocusing) {
um->sel->isfocusing = false;
client_set_unfocused_opacity_animation(um->sel);
}
}
if (c && !c->iskilling && c->foreign_toplevel) if (c && !c->iskilling && c->foreign_toplevel)
wlr_foreign_toplevel_handle_v1_set_activated(c->foreign_toplevel, true); wlr_foreign_toplevel_handle_v1_set_activated(c->foreign_toplevel, true);