Skip to content

Commit 44c271e

Browse files
committed
opt: optimize border color set when change monitor
1 parent 2258574 commit 44c271e

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/dispatch/bind_define.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ int toggle_trackpad_enable(const Arg *arg) {
171171
}
172172

173173
int focusmon(const Arg *arg) {
174-
Client *c = NULL, *old_selmon_sel = NULL;
174+
Client *c = NULL;
175175
Monitor *m = NULL;
176176

177177
if (arg->i != UNDIR) {
@@ -192,7 +192,6 @@ int focusmon(const Arg *arg) {
192192
if (!m || !m->wlr_output->enabled || m == selmon)
193193
return 0;
194194

195-
old_selmon_sel = selmon->sel;
196195
selmon = m;
197196
if (warpcursor) {
198197
warp_cursor_to_selmon(selmon);
@@ -205,9 +204,6 @@ int focusmon(const Arg *arg) {
205204
} else
206205
focusclient(c, 1);
207206

208-
if (old_selmon_sel) {
209-
client_set_unfocused_opacity_animation(old_selmon_sel);
210-
}
211207
return 0;
212208
}
213209

src/mango.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3166,6 +3166,7 @@ void destroykeyboardgroup(struct wl_listener *listener, void *data) {
31663166
void focusclient(Client *c, int lift) {
31673167

31683168
Client *last_focus_client = NULL;
3169+
Monitor *um = NULL;
31693170

31703171
struct wlr_surface *old_keyboard_focus_surface =
31713172
seat->keyboard_state.focused_surface;
@@ -3211,6 +3212,13 @@ void focusclient(Client *c, int lift) {
32113212
client_set_unfocused_opacity_animation(last_focus_client);
32123213
}
32133214

3215+
wl_list_for_each(um, &mons, link) {
3216+
if (um->wlr_output->enabled && um != selmon && um->sel &&
3217+
!um->sel->iskilling) {
3218+
client_set_unfocused_opacity_animation(um->sel);
3219+
}
3220+
}
3221+
32143222
client_set_focused_opacity_animation(c);
32153223

32163224
// decide whether need to re-arrange

0 commit comments

Comments
 (0)