screen: merge tag_client_with_current_selected() code

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-27 23:00:20 +02:00
parent dda116fea0
commit 91b2926d8d
3 changed files with 11 additions and 23 deletions

View File

@ -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)

15
tag.c
View File

@ -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

1
tag.h
View File

@ -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 *);