mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-04 13:29:56 -05:00
opt: optimize focusmon
This commit is contained in:
parent
32453bf9d5
commit
26dc1995d5
1 changed files with 7 additions and 5 deletions
12
maomao.c
12
maomao.c
|
|
@ -3173,18 +3173,20 @@ void focusclient(Client *c, int lift) {
|
||||||
client_activate_surface(client_surface(c), 1);
|
client_activate_surface(client_surface(c), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void // 0.5
|
void focusmon(const Arg *arg) {
|
||||||
focusmon(const Arg *arg) {
|
Client *c;
|
||||||
int i = 0, nmons = wl_list_length(&mons);
|
int i = 0, nmons = wl_list_length(&mons);
|
||||||
if (nmons) {
|
if (nmons) {
|
||||||
do /* don't switch to disabled mons */
|
do /* don't switch to disabled mons */
|
||||||
selmon = dirtomon(arg->i);
|
selmon = dirtomon(arg->i);
|
||||||
while (!selmon->wlr_output->enabled && i++ < nmons);
|
while (!selmon->wlr_output->enabled && i++ < nmons);
|
||||||
if (!selmon->wlr_output->enabled)
|
|
||||||
selmon = NULL;
|
|
||||||
}
|
}
|
||||||
warp_cursor_to_selmon(selmon);
|
warp_cursor_to_selmon(selmon);
|
||||||
focusclient(focustop(selmon), 1);
|
c = focustop(selmon);
|
||||||
|
if(!c)
|
||||||
|
selmon->sel = NULL;
|
||||||
|
else
|
||||||
|
focusclient(c, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void // 17
|
void // 17
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue