summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--client.c2
-rw-r--r--draw.c6
-rw-r--r--menu.c24
-rw-r--r--wm.c10
-rw-r--r--wm.h15
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)
14{ 14{
15 XTextProperty name; 15 XTextProperty name;
16 int n; 16 int n;
17 char **list = 0; 17 char **list = NULL;
18 18
19 name.nitems = 0; 19 name.nitems = 0;
20 c->name[0] = 0; 20 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)
116 char **missing, *def; 116 char **missing, *def;
117 int n; 117 int n;
118 118
119 missing = 0; 119 missing = NULL;
120 def = "?"; 120 def = "?";
121 setlocale(LC_ALL, ""); 121 setlocale(LC_ALL, "");
122 if(font->set) 122 if(font->set)
@@ -128,7 +128,7 @@ loadfont(Display *dpy, Fnt *font, const char *fontstr)
128 XFreeStringList(missing); 128 XFreeStringList(missing);
129 if(font->set) { 129 if(font->set) {
130 XFreeFontSet(dpy, font->set); 130 XFreeFontSet(dpy, font->set);
131 font->set = 0; 131 font->set = NULL;
132 } 132 }
133 } 133 }
134 if(font->set) { 134 if(font->set) {
@@ -151,7 +151,7 @@ loadfont(Display *dpy, Fnt *font, const char *fontstr)
151 else { 151 else {
152 if(font->xfont) 152 if(font->xfont)
153 XFreeFont(dpy, font->xfont); 153 XFreeFont(dpy, font->xfont);
154 font->xfont = 0; 154 font->xfont = NULL;
155 font->xfont = XLoadQueryFont(dpy, fontstr); 155 font->xfont = XLoadQueryFont(dpy, fontstr);
156 if (!font->xfont) 156 if (!font->xfont)
157 font->xfont = XLoadQueryFont(dpy, "fixed"); 157 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;
34static XRectangle rect; 34static XRectangle rect;
35static Bool done = False; 35static Bool done = False;
36 36
37static Item *allitem = 0; /* first of all items */ 37static Item *allitem = NULL; /* first of all items */
38static Item *item = 0; /* first of pattern matching items */ 38static Item *item = NULL; /* first of pattern matching items */
39static Item *sel = 0; 39static Item *sel = NULL;
40static Item *nextoff = 0; 40static Item *nextoff = NULL;
41static Item *prevoff = 0; 41static Item *prevoff = NULL;
42static Item *curroff = 0; 42static Item *curroff = NULL;
43 43
44static int screen; 44static int screen;
45static char *title = 0; 45static char *title = NULL;
46static char text[4096]; 46static char text[4096];
47static int ret = 0; 47static int ret = 0;
48static int nitem = 0; 48static int nitem = 0;
@@ -107,7 +107,7 @@ update_items(char *pattern)
107 else 107 else
108 cmdw = twidth; 108 cmdw = twidth;
109 109
110 item = j = 0; 110 item = j = NULL;
111 nitem = 0; 111 nitem = 0;
112 112
113 for(i = allitem; i; i=i->next) 113 for(i = allitem; i; i=i->next)
@@ -117,7 +117,7 @@ update_items(char *pattern)
117 else 117 else
118 j->right = i; 118 j->right = i;
119 i->left = j; 119 i->left = j;
120 i->right = 0; 120 i->right = NULL;
121 j = i; 121 j = i;
122 nitem++; 122 nitem++;
123 } 123 }
@@ -129,7 +129,7 @@ update_items(char *pattern)
129 else 129 else
130 j->right = i; 130 j->right = i;
131 i->left = j; 131 i->left = j;
132 i->right = 0; 132 i->right = NULL;
133 j = i; 133 j = i;
134 nitem++; 134 nitem++;
135 } 135 }
@@ -319,7 +319,7 @@ kpress(XKeyEvent * e)
319static char * 319static char *
320read_allitems() 320read_allitems()
321{ 321{
322 static char *maxname = 0; 322 static char *maxname = NULL;
323 char *p, buf[1024]; 323 char *p, buf[1024];
324 unsigned int len = 0, max = 0; 324 unsigned int len = 0, max = 0;
325 Item *i, *new; 325 Item *i, *new;
@@ -336,7 +336,7 @@ read_allitems()
336 } 336 }
337 337
338 new = emalloc(sizeof(Item)); 338 new = emalloc(sizeof(Item));
339 new->next = new->left = new->right = 0; 339 new->next = new->left = new->right = NULL;
340 new->text = p; 340 new->text = p;
341 if(!i) 341 if(!i)
342 allitem = new; 342 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];
20Cursor cursor[CurLast]; 20Cursor cursor[CurLast];
21XRectangle rect, barrect; 21XRectangle rect, barrect;
22Bool running = True; 22Bool running = True;
23Client *client = NULL;
23 24
24char *bartext; 25char *bartext, tag[256];
25int screen, sel_screen; 26int screen, sel_screen;
26unsigned int lock_mask, numlock_mask; 27unsigned int lock_mask, numlock_mask;
27 28
@@ -74,12 +75,11 @@ win_property(Window w, Atom a, Atom t, long l, unsigned char **prop)
74 status = XGetWindowProperty(dpy, w, a, 0L, l, False, t, &real, &format, 75 status = XGetWindowProperty(dpy, w, a, 0L, l, False, t, &real, &format,
75 &res, &extra, prop); 76 &res, &extra, prop);
76 77
77 if(status != Success || *prop == 0) { 78 if(status != Success || *prop == NULL) {
78 return 0; 79 return 0;
79 } 80 }
80 if(res == 0) { 81 if(res == 0)
81 free((void *) *prop); 82 free((void *) *prop);
82 }
83 return res; 83 return res;
84} 84}
85 85
@@ -264,7 +264,7 @@ main(int argc, char *argv[])
264 barrect.width, barrect.height, 0, DefaultDepth(dpy, screen), 264 barrect.width, barrect.height, 0, DefaultDepth(dpy, screen),
265 CopyFromParent, DefaultVisual(dpy, screen), 265 CopyFromParent, DefaultVisual(dpy, screen),
266 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); 266 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
267 bartext = 0; 267 bartext = NULL;
268 XDefineCursor(dpy, barwin, cursor[CurNormal]); 268 XDefineCursor(dpy, barwin, cursor[CurNormal]);
269 XMapRaised(dpy, barwin); 269 XMapRaised(dpy, barwin);
270 draw_bar(); 270 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 };
20enum { RFloat, RGrid, RLast }; 20enum { RFloat, RGrid, RLast };
21 21
22typedef struct Client Client; 22typedef struct Client Client;
23typedef struct Tag Tag;
24 23
25struct Client { 24struct Client {
26 Tag *tag;
27 char name[256]; 25 char name[256];
26 char tag[256];
28 int proto; 27 int proto;
29 unsigned int border; 28 unsigned int border;
30 Bool fixedsize; 29 Bool fixedsize;
@@ -37,27 +36,21 @@ struct Client {
37 Client *snext; 36 Client *snext;
38}; 37};
39 38
40struct Tag {
41 char name[256];
42 Client *stack;
43 XRectangle r;
44 Tag *next;
45 Tag *cnext;
46};
47
48extern Display *dpy; 39extern Display *dpy;
49extern Window root, barwin; 40extern Window root, barwin;
50extern Atom wm_atom[WMLast], net_atom[NetLast]; 41extern Atom wm_atom[WMLast], net_atom[NetLast];
51extern Cursor cursor[CurLast]; 42extern Cursor cursor[CurLast];
52extern XRectangle rect, barrect; 43extern XRectangle rect, barrect;
53extern Bool running; 44extern Bool running;
45extern Bool grid;
54extern void (*handler[LASTEvent]) (XEvent *); 46extern void (*handler[LASTEvent]) (XEvent *);
55 47
56extern int screen, sel_screen; 48extern int screen, sel_screen;
57extern unsigned int lock_mask, numlock_mask; 49extern unsigned int lock_mask, numlock_mask;
58extern char *bartext; 50extern char *bartext, tag[256];
59 51
60extern Brush brush; 52extern Brush brush;
53extern Client *client;
61 54
62/* bar.c */ 55/* bar.c */
63extern void draw_bar(); 56extern void draw_bar();