screen: merge tag_client_with_current_selected() code
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
dda116fea0
commit
91b2926d8d
18
screen.c
18
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)
|
||||
|
|
15
tag.c
15
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
|
||||
|
|
1
tag.h
1
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 *);
|
||||
|
|
Loading…
Reference in New Issue