dwm-flexipatch/patch/shiftviewclients.c

53 lines
1.3 KiB
C
Raw Normal View History

2020-05-05 17:54:02 +00:00
void
shiftviewclients(const Arg *arg)
{
Arg shifted;
Client *c;
unsigned int tagmask = 0;
#if TAGSYNC_PATCH
Monitor *origselmon = selmon;
for (selmon = mons; selmon; selmon = selmon->next)
#endif // TAGSYNC_PATCH
for (c = selmon->clients; c; c = c->next) {
#if SCRATCHPADS_PATCH
if (!(c->tags & SPTAGMASK))
tagmask = tagmask | c->tags;
#elif SCRATCHPAD_ALT_1_PATCH
if (!(c->tags & SCRATCHPAD_MASK))
tagmask = tagmask | c->tags;
#else
2020-05-05 17:54:02 +00:00
tagmask = tagmask | c->tags;
#endif // SCRATCHPADS_PATCH
}
#if TAGSYNC_PATCH
selmon = origselmon;
#endif // TAGSYNC_PATCH
2020-05-05 17:54:02 +00:00
#if SCRATCHPADS_PATCH
shifted.ui = selmon->tagset[selmon->seltags] & ~SPTAGMASK;
#else
2020-05-05 17:54:02 +00:00
shifted.ui = selmon->tagset[selmon->seltags];
#endif // SCRATCHPADS_PATCH
if (arg->i > 0) { // left circular shift
2020-05-05 17:54:02 +00:00
do {
shifted.ui = (shifted.ui << arg->i)
| (shifted.ui >> (NUMTAGS - arg->i));
#if SCRATCHPADS_PATCH
shifted.ui &= ~SPTAGMASK;
#endif // SCRATCHPADS_PATCH
2020-05-05 17:54:02 +00:00
} while (tagmask && !(shifted.ui & tagmask));
} else { // right circular shift
2020-05-05 17:54:02 +00:00
do {
shifted.ui = (shifted.ui >> (- arg->i)
| shifted.ui << (NUMTAGS + arg->i));
#if SCRATCHPADS_PATCH
shifted.ui &= ~SPTAGMASK;
#endif // SCRATCHPADS_PATCH
2020-05-05 17:54:02 +00:00
} while (tagmask && !(shifted.ui & tagmask));
}
2020-05-05 17:54:02 +00:00
view(&shifted);
}