From 8a8b7956b6de80decbfd3bff6d2ad6e5bb69b2bd Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Tue, 11 Jul 2006 11:27:56 +0200 Subject: new stuff --- client.c | 2 +- draw.c | 6 +++--- menu.c | 24 ++++++++++++------------ wm.c | 10 +++++----- wm.h | 15 ++++----------- 5 files changed, 25 insertions(+), 32 deletions(-) diff --git a/client.c b/client.c index a5141ea..1e693f7 100644 --- a/client.c +++ b/client.c @@ -14,7 +14,7 @@ update_client_name(Client *c) { XTextProperty name; int n; - char **list = 0; + char **list = NULL; name.nitems = 0; c->name[0] = 0; diff --git a/draw.c b/draw.c index b89c365..a3c526e 100644 --- a/draw.c +++ b/draw.c @@ -116,7 +116,7 @@ loadfont(Display *dpy, Fnt *font, const char *fontstr) char **missing, *def; int n; - missing = 0; + missing = NULL; def = "?"; setlocale(LC_ALL, ""); if(font->set) @@ -128,7 +128,7 @@ loadfont(Display *dpy, Fnt *font, const char *fontstr) XFreeStringList(missing); if(font->set) { XFreeFontSet(dpy, font->set); - font->set = 0; + font->set = NULL; } } if(font->set) { @@ -151,7 +151,7 @@ loadfont(Display *dpy, Fnt *font, const char *fontstr) else { if(font->xfont) XFreeFont(dpy, font->xfont); - font->xfont = 0; + font->xfont = NULL; font->xfont = XLoadQueryFont(dpy, fontstr); if (!font->xfont) font->xfont = XLoadQueryFont(dpy, "fixed"); diff --git a/menu.c b/menu.c index d2e50ec..6d8843e 100644 --- a/menu.c +++ b/menu.c @@ -34,15 +34,15 @@ static Window win; static XRectangle rect; static Bool done = False; -static Item *allitem = 0; /* first of all items */ -static Item *item = 0; /* first of pattern matching items */ -static Item *sel = 0; -static Item *nextoff = 0; -static Item *prevoff = 0; -static Item *curroff = 0; +static Item *allitem = NULL; /* first of all items */ +static Item *item = NULL; /* first of pattern matching items */ +static Item *sel = NULL; +static Item *nextoff = NULL; +static Item *prevoff = NULL; +static Item *curroff = NULL; static int screen; -static char *title = 0; +static char *title = NULL; static char text[4096]; static int ret = 0; static int nitem = 0; @@ -107,7 +107,7 @@ update_items(char *pattern) else cmdw = twidth; - item = j = 0; + item = j = NULL; nitem = 0; for(i = allitem; i; i=i->next) @@ -117,7 +117,7 @@ update_items(char *pattern) else j->right = i; i->left = j; - i->right = 0; + i->right = NULL; j = i; nitem++; } @@ -129,7 +129,7 @@ update_items(char *pattern) else j->right = i; i->left = j; - i->right = 0; + i->right = NULL; j = i; nitem++; } @@ -319,7 +319,7 @@ kpress(XKeyEvent * e) static char * read_allitems() { - static char *maxname = 0; + static char *maxname = NULL; char *p, buf[1024]; unsigned int len = 0, max = 0; Item *i, *new; @@ -336,7 +336,7 @@ read_allitems() } new = emalloc(sizeof(Item)); - new->next = new->left = new->right = 0; + new->next = new->left = new->right = NULL; new->text = p; if(!i) allitem = new; diff --git a/wm.c b/wm.c index 843aaac..a4caf64 100644 --- a/wm.c +++ b/wm.c @@ -20,8 +20,9 @@ Atom wm_atom[WMLast], net_atom[NetLast]; Cursor cursor[CurLast]; XRectangle rect, barrect; Bool running = True; +Client *client = NULL; -char *bartext; +char *bartext, tag[256]; int screen, sel_screen; unsigned int lock_mask, numlock_mask; @@ -74,12 +75,11 @@ win_property(Window w, Atom a, Atom t, long l, unsigned char **prop) status = XGetWindowProperty(dpy, w, a, 0L, l, False, t, &real, &format, &res, &extra, prop); - if(status != Success || *prop == 0) { + if(status != Success || *prop == NULL) { return 0; } - if(res == 0) { + if(res == 0) free((void *) *prop); - } return res; } @@ -264,7 +264,7 @@ main(int argc, char *argv[]) barrect.width, barrect.height, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); - bartext = 0; + bartext = NULL; XDefineCursor(dpy, barwin, cursor[CurNormal]); XMapRaised(dpy, barwin); draw_bar(); diff --git a/wm.h b/wm.h index c4d65ea..01bbee4 100644 --- a/wm.h +++ b/wm.h @@ -20,11 +20,10 @@ enum { CurNormal, CurResize, CurMove, CurInput, CurLast }; enum { RFloat, RGrid, RLast }; typedef struct Client Client; -typedef struct Tag Tag; struct Client { - Tag *tag; char name[256]; + char tag[256]; int proto; unsigned int border; Bool fixedsize; @@ -37,27 +36,21 @@ struct Client { Client *snext; }; -struct Tag { - char name[256]; - Client *stack; - XRectangle r; - Tag *next; - Tag *cnext; -}; - extern Display *dpy; extern Window root, barwin; extern Atom wm_atom[WMLast], net_atom[NetLast]; extern Cursor cursor[CurLast]; extern XRectangle rect, barrect; extern Bool running; +extern Bool grid; extern void (*handler[LASTEvent]) (XEvent *); extern int screen, sel_screen; extern unsigned int lock_mask, numlock_mask; -extern char *bartext; +extern char *bartext, tag[256]; extern Brush brush; +extern Client *client; /* bar.c */ extern void draw_bar(); -- cgit 1.4.1-2-gfad0