diff --git a/patch/shiftview.c b/patch/shiftview.c index 423d74b..b9c811a 100644 --- a/patch/shiftview.c +++ b/patch/shiftview.c @@ -8,12 +8,12 @@ shiftview(const Arg *arg) 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)); + shifted.ui = (seltagset << arg->i) | (seltagset >> (NUMTAGS - arg->i)); else // right circular shift - shifted.ui = seltagset >> -arg->i - | seltagset << (NUMTAGS + arg->i); + shifted.ui = (seltagset >> -arg->i) | (seltagset << (NUMTAGS + arg->i)); + #if SCRATCHPADS_PATCH + shifted.ui &= ~SPTAGMASK; + #endif // SCRATCHPADS_PATCH view(&shifted); } - diff --git a/patch/shiftview.h b/patch/shiftview.h index 1d7fd1f..7bf3a14 100644 --- a/patch/shiftview.h +++ b/patch/shiftview.h @@ -1,2 +1 @@ static void shiftview(const Arg *arg); - diff --git a/patch/shiftviewclients.c b/patch/shiftviewclients.c index b805b51..adeaab7 100644 --- a/patch/shiftviewclients.c +++ b/patch/shiftviewclients.c @@ -29,23 +29,18 @@ shiftviewclients(const Arg *arg) #else shifted.ui = selmon->tagset[selmon->seltags]; #endif // SCRATCHPADS_PATCH - if (arg->i > 0) { // left circular shift - do { + + do { + if (arg->i > 0) // left circular shift shifted.ui = (shifted.ui << arg->i) | (shifted.ui >> (NUMTAGS - arg->i)); - #if SCRATCHPADS_PATCH - shifted.ui &= ~SPTAGMASK; - #endif // SCRATCHPADS_PATCH - } while (tagmask && !(shifted.ui & tagmask)); - } else { // right circular shift - do { - shifted.ui = (shifted.ui >> (- arg->i) - | shifted.ui << (NUMTAGS + arg->i)); - #if SCRATCHPADS_PATCH - shifted.ui &= ~SPTAGMASK; - #endif // SCRATCHPADS_PATCH - } while (tagmask && !(shifted.ui & tagmask)); - } + else // right circular shift + shifted.ui = (shifted.ui >> -arg->i) + | (shifted.ui << (NUMTAGS + arg->i)); + #if SCRATCHPADS_PATCH + shifted.ui &= ~SPTAGMASK; + #endif // SCRATCHPADS_PATCH + } while (tagmask && !(shifted.ui & tagmask)); view(&shifted); } diff --git a/patch/shiftviewclients.h b/patch/shiftviewclients.h index 49aeb51..2f652cd 100644 --- a/patch/shiftviewclients.h +++ b/patch/shiftviewclients.h @@ -1,2 +1 @@ static void shiftviewclients(const Arg *arg); -