mirror of https://github.com/0intro/wmii
prevent i from getting MAX_INT in update_view_bars
This commit is contained in:
parent
b816a09ffc
commit
e05860576b
19
cmd/wm/bar.c
19
cmd/wm/bar.c
|
@ -200,19 +200,24 @@ bar_of_name(const char *name)
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Bar *
|
||||||
|
next_unused_bar()
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
for(i = 0; (i < bar.size) && bar.data[i]->intern; i++)
|
||||||
|
if(!view_of_name(bar.data[i]->name))
|
||||||
|
return bar.data[i];
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
update_view_bars()
|
update_view_bars()
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
Bar *b = nil;
|
Bar *b = nil;
|
||||||
|
|
||||||
for(i = 0; (i < bar.size) && bar.data[i]->intern; i++) {
|
while((b = next_unused_bar()))
|
||||||
b = bar.data[i];
|
destroy_bar(b);
|
||||||
if(!view_of_name(b->name)) {
|
|
||||||
destroy_bar(b);
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(i = 0; i < view.size; i++) {
|
for(i = 0; i < view.size; i++) {
|
||||||
b = create_bar(view.data[i]->name, True);
|
b = create_bar(view.data[i]->name, True);
|
||||||
cext_strlcpy(b->data, view.data[i]->name, sizeof(b->data));
|
cext_strlcpy(b->data, view.data[i]->name, sizeof(b->data));
|
||||||
|
|
Loading…
Reference in New Issue