mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-10-29 05:40:21 -04:00
opt: optimize code struct
This commit is contained in:
parent
53b8fa4597
commit
78990f66ff
3 changed files with 20 additions and 17 deletions
|
|
@ -175,29 +175,15 @@ void focusmon(const Arg *arg) {
|
||||||
void // 17
|
void // 17
|
||||||
focusstack(const Arg *arg) {
|
focusstack(const Arg *arg) {
|
||||||
/* Focus the next or previous client (in tiling order) on selmon */
|
/* Focus the next or previous client (in tiling order) on selmon */
|
||||||
Client *c, *sel = focustop(selmon);
|
Client *sel = focustop(selmon);
|
||||||
Client *tc = NULL;
|
Client *tc = NULL;
|
||||||
|
|
||||||
if (!sel || sel->isfullscreen)
|
if (!sel || sel->isfullscreen)
|
||||||
return;
|
return;
|
||||||
if (arg->i > 0) {
|
if (arg->i > 0) {
|
||||||
wl_list_for_each(c, &sel->link, link) {
|
tc = get_next_stack_client(sel, false);
|
||||||
if (&c->link == &clients || c->isunglobal)
|
|
||||||
continue; /* wrap past the sentinel node */
|
|
||||||
if (VISIBLEON(c, selmon)) {
|
|
||||||
tc = c;
|
|
||||||
break; /* found it */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
wl_list_for_each_reverse(c, &sel->link, link) {
|
tc = get_next_stack_client(sel, true);
|
||||||
if (&c->link == &clients)
|
|
||||||
continue; /* wrap past the sentinel node */
|
|
||||||
if (VISIBLEON(c, selmon) || c->isunglobal) {
|
|
||||||
tc = c;
|
|
||||||
break; /* found it */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* If only one client is visible on selmon, then c == sel */
|
/* If only one client is visible on selmon, then c == sel */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -335,3 +335,19 @@ focustop(Monitor *m) {
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Client *get_next_stack_client(Client *c, bool reverse) {
|
||||||
|
Client *next = NULL;
|
||||||
|
if (reverse) {
|
||||||
|
wl_list_for_each_reverse(next, &c->link, link) {
|
||||||
|
if (VISIBLEON(next, c->mon) && next != c)
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
wl_list_for_each(next, &c->link, link) {
|
||||||
|
if (VISIBLEON(next, c->mon) && next != c)
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -700,6 +700,7 @@ static bool switch_scratchpad_client_state(Client *c);
|
||||||
static bool check_trackpad_disabled(struct wlr_pointer *pointer);
|
static bool check_trackpad_disabled(struct wlr_pointer *pointer);
|
||||||
static unsigned int get_tag_status(unsigned int tag, Monitor *m);
|
static unsigned int get_tag_status(unsigned int tag, Monitor *m);
|
||||||
static void enable_adaptive_sync(Monitor *m, struct wlr_output_state *state);
|
static void enable_adaptive_sync(Monitor *m, struct wlr_output_state *state);
|
||||||
|
static Client *get_next_stack_client(Client *c, bool reverse);
|
||||||
|
|
||||||
#include "data/static_keymap.h"
|
#include "data/static_keymap.h"
|
||||||
#include "dispatch/bind_declare.h"
|
#include "dispatch/bind_declare.h"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue