Client/Tag: Fix focus problems with tag_transfert

This commit is contained in:
Martin Duquesnoy 2010-08-02 16:27:30 +02:00
parent 61015e2567
commit 4a1ab8ef79
3 changed files with 25 additions and 13 deletions

View File

@ -1091,13 +1091,34 @@ client_unhide(Client *c)
return;
}
/** Select next or previous client to don't lose focus
* \param c Client pointer
*/
void
client_focus_next(Client *c)
{
Client *c_next = NULL;
for(c_next = clients;
c_next && c_next != c->prev
&& c_next->tag != c->tag
&& c_next->screen != c->screen;
c_next = c_next->next);
if(c_next && c_next->tag == seltag[selscreen]
&& c_next->screen == selscreen)
client_focus(c_next);
return;
}
/** Unmanage a client
* \param c Client pointer
*/
void
client_unmanage(Client *c)
{
Client *c_next = NULL;
Bool b = False;
int i;
@ -1134,16 +1155,7 @@ client_unmanage(Client *c)
XFree(c->title);
/* To focus the previous client */
for(c_next = clients;
c_next && c_next != c->prev
&& c_next->tag != c->tag
&& c_next->screen != c->screen;
c_next = c_next->next);
if(c_next && c_next->tag == seltag[selscreen]
&& c_next->screen == selscreen)
client_focus(c_next);
client_focus_next(c);
free(c);

View File

@ -137,8 +137,7 @@ tag_transfert(Client *c, int tag)
arrange(c->screen, True);
if(c == sel && c->tag != tag)
client_focus(NULL);
client_focus_next(c);
client_update_attributes(c);

View File

@ -185,6 +185,7 @@ void client_size_hints(Client *c);
void client_swap(Client *c1, Client *c2);
void client_raise(Client *c);
void client_unhide(Client *c);
void client_focus_next(Client *c);
void client_unmanage(Client *c);
void client_unmap(Client *c);
void client_set_rules(Client *c);