dwm-flexipatch/patch/shiftview.c

20 lines
615 B
C
Raw Normal View History

2020-01-29 13:22:24 +00:00
void
shiftview(const Arg *arg)
{
Arg shifted;
2022-06-20 12:00:09 +00:00
#if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
unsigned int seltagset = selmon->tagset[selmon->seltags] & ~SPTAGMASK;
#else
unsigned int seltagset = selmon->tagset[selmon->seltags];
#endif // SCRATCHPADS_PATCH
2020-05-03 14:09:05 +00:00
if (arg->i > 0) // left circular shift
2022-05-08 19:43:57 +00:00
shifted.ui = (seltagset << arg->i) | (seltagset >> (NUMTAGS - arg->i));
2020-01-29 13:22:24 +00:00
else // right circular shift
2022-05-08 19:43:57 +00:00
shifted.ui = (seltagset >> -arg->i) | (seltagset << (NUMTAGS + arg->i));
2022-06-20 12:00:09 +00:00
#if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
2022-05-08 19:43:57 +00:00
shifted.ui &= ~SPTAGMASK;
#endif // SCRATCHPADS_PATCH
2020-01-29 13:22:24 +00:00
view(&shifted);
2020-05-03 14:09:05 +00:00
}