rename FocusList to client_node_t

This commit is contained in:
Julien Danjou 2008-01-12 23:10:59 +01:00
parent 556c7bed0f
commit c82542ddb1
2 changed files with 26 additions and 26 deletions

View File

@ -201,14 +201,14 @@ struct Client
DO_SLIST(Client, client, p_delete); DO_SLIST(Client, client, p_delete);
typedef struct FocusList FocusList; typedef struct client_node_t client_node_t;
struct FocusList struct client_node_t
{ {
Client *client; Client *client;
FocusList *next; client_node_t *next;
}; };
DO_SLIST(FocusList, focus, p_delete); DO_SLIST(client_node_t, client_node, p_delete);
/** Tag type */ /** Tag type */
typedef struct Tag Tag; typedef struct Tag Tag;
@ -327,8 +327,8 @@ struct AwesomeConf
Client *clients; Client *clients;
/** Path to config file */ /** Path to config file */
char *configpath; char *configpath;
/** Selected clients on this tag */ /** Selected clients history */
FocusList *focus; client_node_t *focus;
/** Link between tags and clients */ /** Link between tags and clients */
TagClientLink *tclink; TagClientLink *tclink;
/** Command line passed to awesome */ /** Command line passed to awesome */

40
focus.c
View File

@ -26,14 +26,14 @@
extern AwesomeConf globalconf; extern AwesomeConf globalconf;
static FocusList * static client_node_t *
focus_get_node_by_client(Client *c) focus_get_node_by_client(Client *c)
{ {
FocusList *fl; client_node_t *node;
for(fl = globalconf.focus; fl; fl = fl->next) for(node = globalconf.focus; node; node = node->next)
if(fl->client == c) if(node->client == c)
return fl; return node;
return NULL; return NULL;
} }
@ -41,46 +41,46 @@ focus_get_node_by_client(Client *c)
void void
focus_add_client(Client *c) focus_add_client(Client *c)
{ {
FocusList *new_fh; client_node_t *node;
/* if we don't find this node, create a new one */ /* if we don't find this node, create a new one */
if(!(new_fh = focus_get_node_by_client(c))) if(!(node = focus_get_node_by_client(c)))
{ {
new_fh = p_new(FocusList, 1); node = p_new(client_node_t, 1);
new_fh->client = c; node->client = c;
} }
else /* if we've got a node, detach it */ else /* if we've got a node, detach it */
focus_list_detach(&globalconf.focus, new_fh); client_node_list_detach(&globalconf.focus, node);
focus_list_push(&globalconf.focus, new_fh); client_node_list_push(&globalconf.focus, node);
} }
void void
focus_delete_client(Client *c) focus_delete_client(Client *c)
{ {
FocusList *target = focus_get_node_by_client(c); client_node_t *node = focus_get_node_by_client(c);
if(target) if(node)
{ {
focus_list_detach(&globalconf.focus, target); client_node_list_detach(&globalconf.focus, node);
p_delete(&target); p_delete(&node);
} }
} }
static Client * static Client *
focus_get_latest_client_for_tags(Tag **t, int nindex) focus_get_latest_client_for_tags(Tag **t, int nindex)
{ {
FocusList *fl; client_node_t *node;
Tag **tags; Tag **tags;
int i = 0; int i = 0;
for(fl = globalconf.focus; fl; fl = fl->next) for(node = globalconf.focus; node; node = node->next)
if(fl->client && !fl->client->skip) if(node->client && !node->client->skip)
for(tags = t; *tags; tags++) for(tags = t; *tags; tags++)
if(is_client_tagged(fl->client, *tags)) if(is_client_tagged(node->client, *tags))
{ {
if(i == nindex) if(i == nindex)
return fl->client; return node->client;
else else
i--; i--;
} }