diff --git a/screen.c b/screen.c index 9c856334..cbfd7ee3 100644 --- a/screen.c +++ b/screen.c @@ -128,17 +128,21 @@ screen_virttophys(int screen) void screen_client_moveto(client_t *c, int new_screen, bool doresize) { - int old_screen = c->screen; - tag_array_t *tags = &globalconf.screens[old_screen].tags; + int i, old_screen = c->screen; + tag_array_t *old_tags = &globalconf.screens[old_screen].tags, + *new_tags = &globalconf.screens[new_screen].tags; area_t from, to; - for(int i = 0; i < tags->len; i++) - untag_client(c, tags->tab[i]); - c->screen = new_screen; - /* tag client with new screen tags */ - tag_client_with_current_selected(c); + /* remove old tags */ + for(i = 0; i < old_tags->len; i++) + untag_client(c, old_tags->tab[i]); + + /* add new tags */ + for(i = 0; i < new_tags->len; i++) + if(new_tags->tab[i]->selected) + tag_client(c, new_tags->tab[i]); /* resize the windows if it's floating */ if(doresize && old_screen != c->screen) diff --git a/tag.c b/tag.c index 4cdc3200..cfee67f7 100644 --- a/tag.c +++ b/tag.c @@ -149,21 +149,6 @@ is_client_tagged(client_t *c, tag_t *t) return false; } -/** Tag the client with the currently selected (visible) tags. - * \param c the client - */ -void -tag_client_with_current_selected(client_t *c) -{ - tag_array_t *tags = &globalconf.screens[c->screen].tags; - - for(int i = 0; i < tags->len; i++) - if(tags->tab[i]->selected) - tag_client(c, tags->tab[i]); - else - untag_client(c, tags->tab[i]); -} - /** Get the current tags for the specified screen. * Returned pointer must be p_delete'd after. * \param screen screen id diff --git a/tag.h b/tag.h index fe533cb1..796c94b4 100644 --- a/tag.h +++ b/tag.h @@ -43,7 +43,6 @@ tag_t **tags_get_current(int); void tag_client(client_t *, tag_t *); void untag_client(client_t *, tag_t *); bool is_client_tagged(client_t *, tag_t *); -void tag_client_with_current_selected(client_t *); void tag_view_only_byindex(int, int); void tag_append_to_screen(tag_t *, int); int luaA_tag_userdata_new(lua_State *, tag_t *);