bug fix: correctly check if tag is occupied by checking screen number

This commit is contained in:
Julien Danjou 2007-09-16 16:58:44 +02:00
parent b3848afd88
commit 14107bb49f
1 changed files with 7 additions and 5 deletions

View File

@ -27,17 +27,19 @@
extern Client *clients, *sel, *stack; /* global client list and stack */ extern Client *clients, *sel, *stack; /* global client list and stack */
/** Check if at least a client is tagged with tag number t /** Check if at least a client is tagged with tag number t and is on screen
* screen
* \param t tag number * \param t tag number
* \param screen screen number
* \return True or False * \return True or False
*/ */
static Bool static Bool
isoccupied(unsigned int t) isoccupied(unsigned int t, int screen)
{ {
Client *c; Client *c;
for(c = clients; c; c = c->next) for(c = clients; c; c = c->next)
if(c->tags[t]) if(c->tags[t] && c->screen == screen)
return True; return True;
return False; return False;
} }
@ -53,12 +55,12 @@ drawstatusbar(Display *disp, int screen, DC *drawcontext, awesome_config * aweso
if(awesomeconf->selected_tags[i]) if(awesomeconf->selected_tags[i])
{ {
drawtext(disp, *drawcontext, awesomeconf->statusbar.drawable, awesomeconf->tags[i], drawcontext->sel); drawtext(disp, *drawcontext, awesomeconf->statusbar.drawable, awesomeconf->tags[i], drawcontext->sel);
drawsquare(sel && sel->tags[i], isoccupied(i), drawcontext->sel, disp, *drawcontext, &awesomeconf->statusbar); drawsquare(sel && sel->tags[i], isoccupied(i, screen), drawcontext->sel, disp, *drawcontext, &awesomeconf->statusbar);
} }
else else
{ {
drawtext(disp, *drawcontext, awesomeconf->statusbar.drawable, awesomeconf->tags[i], drawcontext->norm); drawtext(disp, *drawcontext, awesomeconf->statusbar.drawable, awesomeconf->tags[i], drawcontext->norm);
drawsquare(sel && sel->tags[i], isoccupied(i), drawcontext->norm, disp, *drawcontext, &awesomeconf->statusbar); drawsquare(sel && sel->tags[i], isoccupied(i, screen), drawcontext->norm, disp, *drawcontext, &awesomeconf->statusbar);
} }
drawcontext->x += drawcontext->w; drawcontext->x += drawcontext->w;
} }