Fix previous tag toggle on last tag

This commit is contained in:
Martin Duquesnoy 2012-02-04 21:02:22 +01:00
parent 5cd3297e1f
commit bb2b3e02bb
2 changed files with 11 additions and 10 deletions

View File

@ -308,10 +308,15 @@ status_parse(struct status_ctx *ctx)
sq->geo.x = ctx->barwin->geo.w - right - sq->geo.w; \ sq->geo.x = ctx->barwin->geo.w - right - sq->geo.w; \
right += sq->geo.w; \ right += sq->geo.w; \
} }
#define STORE_MOUSEBIND() \ #define STORE_MOUSEBIND() \
if(!SLIST_EMPTY(&sq->mousebinds)) \ if(!SLIST_EMPTY(&sq->mousebinds)) \
SLIST_FOREACH(m, &sq->mousebinds, snext) \ SLIST_FOREACH(m, &sq->mousebinds, snext) \
m->area = sq->geo; m->area = sq->geo;
#define NOALIGN_Y() \
if(sq->align != NoAlign) \
sq->geo.y = (ctx->barwin->geo.h >> 1) - (sq->geo.h >> 1);
static void static void
status_apply_list(struct status_ctx *ctx) status_apply_list(struct status_ctx *ctx)
{ {
@ -347,20 +352,18 @@ status_apply_list(struct status_ctx *ctx)
/* Rectangle */ /* Rectangle */
case 'R': case 'R':
if(sq->align != NoAlign) NOALIGN_Y();
sq->geo.y = (ctx->barwin->geo.h >> 1) - (sq->geo.h >> 1);
STATUS_ALIGN(sq->align); STATUS_ALIGN(sq->align);
draw_rect(ctx->barwin->dr, &sq->geo, sq->color); draw_rect(ctx->barwin->dr, &sq->geo, sq->color);
STORE_MOUSEBIND(); STORE_MOUSEBIND();
break; break;
/* Progress */ /* Progress */
case 'p': case 'p':
if(sq->align != NoAlign) NOALIGN_Y();
sq->geo.y = (ctx->barwin->geo.h >> 1) - (sq->geo.h >> 1);
STATUS_ALIGN(sq->align); STATUS_ALIGN(sq->align);
draw_rect(ctx->barwin->dr, &sq->geo, sq->color); draw_rect(ctx->barwin->dr, &sq->geo, sq->color);
@ -380,9 +383,7 @@ status_apply_list(struct status_ctx *ctx)
/* Graph */ /* Graph */
case 'g': case 'g':
if(sq->align != NoAlign) NOALIGN_Y();
sq->geo.y = (ctx->barwin->geo.h >> 1) - (sq->geo.h >> 1);
STATUS_ALIGN(sq->align); STATUS_ALIGN(sq->align);
draw_rect(ctx->barwin->dr, &sq->geo, sq->color); draw_rect(ctx->barwin->dr, &sq->geo, sq->color);

View File

@ -46,7 +46,7 @@ tag_new(struct screen *s, char *name)
void void
tag_screen(struct screen *s, struct tag *t) tag_screen(struct screen *s, struct tag *t)
{ {
if(t == s->seltag && TAILQ_NEXT(t, next)) if(t == s->seltag && TAILQ_NEXT(TAILQ_FIRST(&s->tags), next))
t = t->prev; t = t->prev;
if(!t) if(!t)