mirror of
https://github.com/mintycube/dotfiles.git
synced 2024-10-22 14:05:41 +02:00
27 lines
641 B
C
27 lines
641 B
C
static Arg
|
|
shift(const Arg *arg, int clients)
|
|
{
|
|
Arg shifted;
|
|
Client *c;
|
|
unsigned int tagmask = 0;
|
|
|
|
shifted.ui = selmon->tagset[selmon->seltags] & ~SPTAGMASK;
|
|
|
|
for (c = selmon->clients; c && clients; c = c->next) {
|
|
if (c == selmon->sel)
|
|
continue;
|
|
if (!(c->tags & SPTAGMASK))
|
|
tagmask |= c->tags;
|
|
}
|
|
|
|
do {
|
|
if (arg->i > 0) // left circular shift
|
|
shifted.ui = (shifted.ui << arg->i) | (shifted.ui >> (NUMTAGS - arg->i));
|
|
else // right circular shift
|
|
shifted.ui = (shifted.ui >> -arg->i) | (shifted.ui << (NUMTAGS + arg->i));
|
|
shifted.ui &= ~SPTAGMASK;
|
|
} while (tagmask && !(shifted.ui & tagmask));
|
|
|
|
return shifted;
|
|
}
|