focusadjacenttags + scratchpad compatibility issue ref. #236

This commit is contained in:
bakkeby 2022-02-20 13:24:52 +01:00
parent 96820b2d51
commit 55592623f5

View File

@ -1,8 +1,9 @@
void void
tagtoleft(const Arg *arg) tagtoleft(const Arg *arg)
{ {
unsigned int MASK = (1 << NUMTAGS) - 1;
if (selmon->sel != NULL if (selmon->sel != NULL
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 && __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1
&& selmon->tagset[selmon->seltags] > 1) { && selmon->tagset[selmon->seltags] > 1) {
selmon->sel->tags >>= 1; selmon->sel->tags >>= 1;
focus(NULL); focus(NULL);
@ -13,9 +14,10 @@ tagtoleft(const Arg *arg)
void void
tagtoright(const Arg *arg) tagtoright(const Arg *arg)
{ {
unsigned int MASK = (1 << NUMTAGS) - 1;
if (selmon->sel != NULL if (selmon->sel != NULL
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 && __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) { && selmon->tagset[selmon->seltags] & (MASK >> 1)) {
selmon->sel->tags <<= 1; selmon->sel->tags <<= 1;
focus(NULL); focus(NULL);
arrange(selmon); arrange(selmon);
@ -25,7 +27,8 @@ tagtoright(const Arg *arg)
void void
viewtoleft(const Arg *arg) viewtoleft(const Arg *arg)
{ {
if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 unsigned int MASK = (1 << NUMTAGS) - 1;
if (__builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1
&& selmon->tagset[selmon->seltags] > 1) { && selmon->tagset[selmon->seltags] > 1) {
view(&((Arg) { .ui = selmon->tagset[selmon->seltags] >> 1 })); view(&((Arg) { .ui = selmon->tagset[selmon->seltags] >> 1 }));
} }
@ -34,8 +37,9 @@ viewtoleft(const Arg *arg)
void void
viewtoright(const Arg *arg) viewtoright(const Arg *arg)
{ {
if (__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 unsigned int MASK = (1 << NUMTAGS) - 1;
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) { if (__builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1
&& selmon->tagset[selmon->seltags] & (MASK >> 1)) {
view(&((Arg) { .ui = selmon->tagset[selmon->seltags] << 1 })); view(&((Arg) { .ui = selmon->tagset[selmon->seltags] << 1 }));
} }
} }
@ -43,8 +47,9 @@ viewtoright(const Arg *arg)
void void
tagandviewtoleft(const Arg *arg) tagandviewtoleft(const Arg *arg)
{ {
unsigned int MASK = (1 << NUMTAGS) - 1;
if (selmon->sel != NULL if (selmon->sel != NULL
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 && __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1
&& selmon->tagset[selmon->seltags] > 1) { && selmon->tagset[selmon->seltags] > 1) {
selmon->sel->tags >>= 1; selmon->sel->tags >>= 1;
view(&((Arg) { .ui = selmon->tagset[selmon->seltags] >> 1 })); view(&((Arg) { .ui = selmon->tagset[selmon->seltags] >> 1 }));
@ -54,9 +59,10 @@ tagandviewtoleft(const Arg *arg)
void void
tagandviewtoright(const Arg *arg) tagandviewtoright(const Arg *arg)
{ {
unsigned int MASK = (1 << NUMTAGS) - 1;
if (selmon->sel != NULL if (selmon->sel != NULL
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1 && __builtin_popcount(selmon->tagset[selmon->seltags] & MASK) == 1
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) { && selmon->tagset[selmon->seltags] & (MASK >> 1)) {
selmon->sel->tags <<= 1; selmon->sel->tags <<= 1;
view(&((Arg) { .ui = selmon->tagset[selmon->seltags] << 1 })); view(&((Arg) { .ui = selmon->tagset[selmon->seltags] << 1 }));
} }