summaryrefslogtreecommitdiff
path: root/patch/shiftview.c
blob: 423d74b38b3ef549792fe02949e9a263989aa76b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
void
shiftview(const Arg *arg)
{
	Arg shifted;
	#if SCRATCHPADS_PATCH
	unsigned int seltagset = selmon->tagset[selmon->seltags] & ~SPTAGMASK;
	#else
	unsigned int seltagset = selmon->tagset[selmon->seltags];
	#endif // SCRATCHPADS_PATCH
	if (arg->i > 0) // left circular shift
		shifted.ui = (seltagset << arg->i)
		   | (seltagset >> (NUMTAGS - arg->i));
	else // right circular shift
		shifted.ui = seltagset >> -arg->i
		   | seltagset << (NUMTAGS + arg->i);

	view(&shifted);
}