mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-03 06:46:38 -04:00
feat: focusstack no wrap
This commit is contained in:
parent
eb51499ec7
commit
372899c361
4 changed files with 23 additions and 10 deletions
|
|
@ -938,6 +938,7 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
|||
if (strcmp(func_name, "focusstack") == 0) {
|
||||
func = focusstack;
|
||||
(*arg).i = parse_circle_direction(arg_value);
|
||||
(*arg).i2 = atoi(arg_value2);
|
||||
} else if (strcmp(func_name, "focusdir") == 0) {
|
||||
func = focusdir;
|
||||
(*arg).i = parse_direction(arg_value);
|
||||
|
|
@ -955,6 +956,7 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
|
|||
} else if (strcmp(func_name, "exchange_stack_client") == 0) {
|
||||
func = exchange_stack_client;
|
||||
(*arg).i = parse_circle_direction(arg_value);
|
||||
(*arg).i2 = atoi(arg_value2);
|
||||
} else if (strcmp(func_name, "toggleglobal") == 0) {
|
||||
func = toggleglobal;
|
||||
} else if (strcmp(func_name, "toggleoverview") == 0) {
|
||||
|
|
|
|||
|
|
@ -122,12 +122,14 @@ int32_t exchange_stack_client(const Arg *arg) {
|
|||
|
||||
Client *c = selmon->sel;
|
||||
Client *tc = NULL;
|
||||
bool nowrap = arg->i2;
|
||||
|
||||
if (!c || c->isfloating || c->isfullscreen || c->ismaximizescreen)
|
||||
return 0;
|
||||
if (arg->i == NEXT) {
|
||||
tc = get_next_stack_client(c, false);
|
||||
tc = get_next_stack_client(c, false, nowrap);
|
||||
} else {
|
||||
tc = get_next_stack_client(c, true);
|
||||
tc = get_next_stack_client(c, true, nowrap);
|
||||
}
|
||||
if (tc)
|
||||
exchange_two_client(c, tc);
|
||||
|
|
@ -244,13 +246,14 @@ int32_t focusstack(const Arg *arg) {
|
|||
/* Focus the next or previous client (in tiling order) on selmon */
|
||||
Client *sel = focustop(selmon);
|
||||
Client *tc = NULL;
|
||||
bool nowrap = arg->i2;
|
||||
|
||||
if (!sel)
|
||||
return 0;
|
||||
if (arg->i == NEXT) {
|
||||
tc = get_next_stack_client(sel, false);
|
||||
tc = get_next_stack_client(sel, false, nowrap);
|
||||
} else {
|
||||
tc = get_next_stack_client(sel, true);
|
||||
tc = get_next_stack_client(sel, true, nowrap);
|
||||
}
|
||||
/* If only one client is visible on selmon, then c == sel */
|
||||
|
||||
|
|
|
|||
|
|
@ -475,15 +475,19 @@ Client *focustop(Monitor *m) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Client *get_next_stack_client(Client *c, bool reverse) {
|
||||
Client *get_next_stack_client(Client *c, bool reverse, bool nowrap) {
|
||||
if (!c || !c->mon)
|
||||
return NULL;
|
||||
|
||||
Client *next = NULL;
|
||||
if (reverse) {
|
||||
wl_list_for_each_reverse(next, &c->link, link) {
|
||||
if (&next->link == &clients)
|
||||
continue; /* wrap past the sentinel node */
|
||||
if (&next->link == &clients) {
|
||||
if (nowrap)
|
||||
return NULL;
|
||||
else
|
||||
continue; /* wrap past the sentinel node */
|
||||
}
|
||||
|
||||
if (next->isunglobal)
|
||||
continue;
|
||||
|
|
@ -493,8 +497,12 @@ Client *get_next_stack_client(Client *c, bool reverse) {
|
|||
}
|
||||
} else {
|
||||
wl_list_for_each(next, &c->link, link) {
|
||||
if (&next->link == &clients)
|
||||
continue; /* wrap past the sentinel node */
|
||||
if (&next->link == &clients) {
|
||||
if (nowrap)
|
||||
return NULL;
|
||||
else
|
||||
continue; /* wrap past the sentinel node */
|
||||
}
|
||||
|
||||
if (next->isunglobal)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -779,7 +779,7 @@ static bool switch_scratchpad_client_state(Client *c);
|
|||
static bool check_trackpad_disabled(struct wlr_pointer *pointer);
|
||||
static uint32_t get_tag_status(uint32_t tag, Monitor *m);
|
||||
static void enable_adaptive_sync(Monitor *m, struct wlr_output_state *state);
|
||||
static Client *get_next_stack_client(Client *c, bool reverse);
|
||||
static Client *get_next_stack_client(Client *c, bool reverse, bool nowrap);
|
||||
static void set_float_malposition(Client *tc);
|
||||
static void set_size_per(Monitor *m, Client *c);
|
||||
static void resize_tile_client(Client *grabc, bool isdrag, int32_t offsetx,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue