opt: optimize border color set when change monitor

This commit is contained in:
DreamMaoMao
2025-12-03 21:07:45 +08:00
parent 2258574e25
commit 44c271ee52
2 changed files with 9 additions and 5 deletions

View File

@@ -171,7 +171,7 @@ int toggle_trackpad_enable(const Arg *arg) {
}
int focusmon(const Arg *arg) {
Client *c = NULL, *old_selmon_sel = NULL;
Client *c = NULL;
Monitor *m = NULL;
if (arg->i != UNDIR) {
@@ -192,7 +192,6 @@ int focusmon(const Arg *arg) {
if (!m || !m->wlr_output->enabled || m == selmon)
return 0;
old_selmon_sel = selmon->sel;
selmon = m;
if (warpcursor) {
warp_cursor_to_selmon(selmon);
@@ -205,9 +204,6 @@ int focusmon(const Arg *arg) {
} else
focusclient(c, 1);
if (old_selmon_sel) {
client_set_unfocused_opacity_animation(old_selmon_sel);
}
return 0;
}

View File

@@ -3166,6 +3166,7 @@ void destroykeyboardgroup(struct wl_listener *listener, void *data) {
void focusclient(Client *c, int lift) {
Client *last_focus_client = NULL;
Monitor *um = NULL;
struct wlr_surface *old_keyboard_focus_surface =
seat->keyboard_state.focused_surface;
@@ -3211,6 +3212,13 @@ void focusclient(Client *c, int lift) {
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) {
client_set_unfocused_opacity_animation(um->sel);
}
}
client_set_focused_opacity_animation(c);
// decide whether need to re-arrange