From 3216eb4d41fb3f9eac78112122fa844aba66e4fb Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sun, 30 Dec 2007 15:08:38 +0100 Subject: [PATCH] documente some functions and simplify client_saveprops() proto --- client.c | 29 +++++++++++++++++++++++++---- client.h | 2 +- tag.c | 6 +++--- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/client.c b/client.c index b33c97f9a..a856d1b4d 100644 --- a/client.c +++ b/client.c @@ -148,6 +148,12 @@ get_client_bywin(Client *list, Window w) return c; } + +/** Get a client by its name + * \param list Client list + * \param name name to search + * \return first matching client + */ Client * get_client_byname(Client *list, char *name) { @@ -160,6 +166,9 @@ get_client_byname(Client *list, char *name) return NULL; } +/** Update client name attribute with its title + * \param c the client + */ void client_updatetitle(Client *c) { @@ -369,7 +378,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen) c->isfloating = (rettrans == Success) || c->isfixed; /* save new props */ - client_saveprops(c, c->screen); + client_saveprops(c); /* attach to the stack */ client_attach(c); @@ -385,6 +394,15 @@ client_manage(Window w, XWindowAttributes *wa, int screen) arrange(screen); } +/** Resize client window + * \param c client to resize + * \param x x coord + * \param y y coord + * \param w width + * \param h height + * \param sizehints respect size hints + * \param volatile_coords register coords in rx/ry/rw/rh + */ void client_resize(Client *c, int x, int y, int w, int h, Bool sizehints, Bool volatile_coords) @@ -478,19 +496,22 @@ client_resize(Client *c, int x, int y, int w, int h, } } +/** Save client properties as an X property + * \param c client + */ void -client_saveprops(Client * c, int screen) +client_saveprops(Client *c) { int i = 0, ntags = 0; char *prop; Tag *tag; - for(tag = globalconf.screens[screen].tags; tag; tag = tag->next) + for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next) ntags++; prop = p_new(char, ntags + 2); - for(tag = globalconf.screens[screen].tags; tag; tag = tag->next, i++) + for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next, i++) prop[i] = is_client_tagged(c, tag) ? '1' : '0'; if(i <= ntags) diff --git a/client.h b/client.h index b756859e8..803327253 100644 --- a/client.h +++ b/client.h @@ -38,7 +38,7 @@ void client_unmanage(Client *, long); void client_updatewmhints(Client *); void client_updatesizehints(Client *); void client_updatetitle(Client *); -void client_saveprops(Client *, int); +void client_saveprops(Client *); void client_kill(Client *); UICB_PROTO(uicb_client_kill); diff --git a/tag.c b/tag.c index 2908567f3..b3cbc9dc0 100644 --- a/tag.c +++ b/tag.c @@ -193,7 +193,7 @@ uicb_client_tag(int screen, char *arg) for(tag = globalconf.screens[screen].tags; tag; tag = tag->next) tag_client(sel, tag); - client_saveprops(sel, screen); + client_saveprops(sel); arrange(screen); } @@ -217,7 +217,7 @@ uicb_client_togglefloating(int screen, char *arg __attribute__ ((unused))) else client_resize(sel, sel->x, sel->y, sel->w, sel->h, True, True); - client_saveprops(sel, screen); + client_saveprops(sel); arrange(screen); } @@ -263,7 +263,7 @@ uicb_client_toggletag(int screen, char *arg) else untag_client(sel, tag); - client_saveprops(sel, screen); + client_saveprops(sel); arrange(screen); }