tag: check that tag is not already attached before attaching (FS#509)

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-04-26 15:13:41 +02:00
parent c2dc991903
commit 566e40638b
1 changed files with 7 additions and 2 deletions

9
tag.c
View File

@ -65,12 +65,17 @@ tag_view(tag_t *tag, bool view)
void
tag_append_to_screen(screen_t *s)
{
tag_t *tag = luaL_checkudata(globalconf.L, -1, "tag");
/* can't attach a tag twice */
if(tag->screen)
return;
int screen_index = screen_array_indexof(&globalconf.screens, s);
int phys_screen = screen_virttophys(screen_index);
tag_t *tag = tag_ref(globalconf.L);
tag->screen = s;
tag_array_append(&s->tags, tag);
tag_array_append(&s->tags, tag_ref(globalconf.L));
ewmh_update_net_numbers_of_desktop(phys_screen);
ewmh_update_net_desktop_names(phys_screen);
ewmh_update_workarea(phys_screen);