summaryrefslogtreecommitdiffhomepage
path: root/patch/shiftboth.c
blob: 5c7c916618a952166ce0595d8ab9d97f184738f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void
shiftboth(const Arg *arg)
{
	Arg shifted;
	#if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
	shifted.ui = selmon->tagset[selmon->seltags];
	#else
	shifted.ui = selmon->tagset[selmon->seltags];
	#endif // SCRATCHPADS_PATCH

	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)));
	#if SCRATCHPADS_PATCH && !RENAMED_SCRATCHPADS_PATCH
	shifted.ui &= ~SPTAGMASK;
	#endif // SCRATCHPADS_PATCH

	tag(&shifted);
	view(&shifted);
}