Client: Add focusontag option in Client structure to save focused client on every tag

This commit is contained in:
Martin Duquesnoy 2010-08-02 17:26:43 +02:00
parent 4a1ab8ef79
commit 132f7d1da4
4 changed files with 21 additions and 2 deletions

View File

@ -340,6 +340,7 @@ client_above(Client *c)
void
client_focus(Client *c)
{
Client *cc;
Window w;
int d;
@ -365,6 +366,14 @@ client_focus(Client *c)
c->colors.frame = conf.client.borderfocus;
c->colors.fg = conf.titlebar.fg_focus;
c->colors.resizecorner = conf.client.resizecorner_focus;
/* Set focusontag option */
for(cc = clients; cc; cc = cc->next)
if(cc->focusontag == c->tag)
cc->focusontag = -1;
c->focusontag = seltag[selscreen];
if(TBARH - BORDH && c->titlebar->stipple)
c->titlebar->stipple_color = conf.titlebar.stipple.colors.focus;
frame_update(c);
@ -689,6 +698,7 @@ client_manage(Window w, XWindowAttributes *wa, Bool ar)
c->ogeo.height = c->geo.height = wa->height;
c->free_geo = c->geo;
c->tag = seltag[c->screen];
c->focusontag = -1;
c->layer = (sel && sel->layer > 0) ? sel->layer : 1;

View File

@ -102,6 +102,8 @@ mouse_move_tag_client(Client *c)
arrange(c->screen, True);
}
client_focus_next(c);
return;
}

View File

@ -184,6 +184,7 @@ struct Client
char *title;
/* Tag num */
uint tag;
int focusontag;
/* Screen */
int screen;
/* Layer */

View File

@ -105,11 +105,17 @@ tag_set(int tag)
tags[selscreen][tag].request_update = False;
}
/* To focus the first client in the new tag */
/* To focus selected client of the via focusontag option */
for(c = clients; c; c = c->next)
if(c->tag == seltag[selscreen] && c->screen == selscreen)
if(c->focusontag == tag && c->screen == selscreen)
break;
/* No focusontag option found on any client, try to find the first of the tag */
if(!c)
for(c = clients; c; c = c->next)
if(c->tag == seltag[selscreen] && c->screen == selscreen)
break;
client_focus((c) ? c : NULL);
return;