new stuff

This commit is contained in:
Anselm R. Garbe 2006-07-11 11:27:56 +02:00
parent 3a69c5173c
commit 8a8b7956b6
5 changed files with 25 additions and 32 deletions

View File

@ -14,7 +14,7 @@ update_client_name(Client *c)
{ {
XTextProperty name; XTextProperty name;
int n; int n;
char **list = 0; char **list = NULL;
name.nitems = 0; name.nitems = 0;
c->name[0] = 0; c->name[0] = 0;

6
draw.c
View File

@ -116,7 +116,7 @@ loadfont(Display *dpy, Fnt *font, const char *fontstr)
char **missing, *def; char **missing, *def;
int n; int n;
missing = 0; missing = NULL;
def = "?"; def = "?";
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
if(font->set) if(font->set)
@ -128,7 +128,7 @@ loadfont(Display *dpy, Fnt *font, const char *fontstr)
XFreeStringList(missing); XFreeStringList(missing);
if(font->set) { if(font->set) {
XFreeFontSet(dpy, font->set); XFreeFontSet(dpy, font->set);
font->set = 0; font->set = NULL;
} }
} }
if(font->set) { if(font->set) {
@ -151,7 +151,7 @@ loadfont(Display *dpy, Fnt *font, const char *fontstr)
else { else {
if(font->xfont) if(font->xfont)
XFreeFont(dpy, font->xfont); XFreeFont(dpy, font->xfont);
font->xfont = 0; font->xfont = NULL;
font->xfont = XLoadQueryFont(dpy, fontstr); font->xfont = XLoadQueryFont(dpy, fontstr);
if (!font->xfont) if (!font->xfont)
font->xfont = XLoadQueryFont(dpy, "fixed"); font->xfont = XLoadQueryFont(dpy, "fixed");

24
menu.c
View File

@ -34,15 +34,15 @@ static Window win;
static XRectangle rect; static XRectangle rect;
static Bool done = False; static Bool done = False;
static Item *allitem = 0; /* first of all items */ static Item *allitem = NULL; /* first of all items */
static Item *item = 0; /* first of pattern matching items */ static Item *item = NULL; /* first of pattern matching items */
static Item *sel = 0; static Item *sel = NULL;
static Item *nextoff = 0; static Item *nextoff = NULL;
static Item *prevoff = 0; static Item *prevoff = NULL;
static Item *curroff = 0; static Item *curroff = NULL;
static int screen; static int screen;
static char *title = 0; static char *title = NULL;
static char text[4096]; static char text[4096];
static int ret = 0; static int ret = 0;
static int nitem = 0; static int nitem = 0;
@ -107,7 +107,7 @@ update_items(char *pattern)
else else
cmdw = twidth; cmdw = twidth;
item = j = 0; item = j = NULL;
nitem = 0; nitem = 0;
for(i = allitem; i; i=i->next) for(i = allitem; i; i=i->next)
@ -117,7 +117,7 @@ update_items(char *pattern)
else else
j->right = i; j->right = i;
i->left = j; i->left = j;
i->right = 0; i->right = NULL;
j = i; j = i;
nitem++; nitem++;
} }
@ -129,7 +129,7 @@ update_items(char *pattern)
else else
j->right = i; j->right = i;
i->left = j; i->left = j;
i->right = 0; i->right = NULL;
j = i; j = i;
nitem++; nitem++;
} }
@ -319,7 +319,7 @@ kpress(XKeyEvent * e)
static char * static char *
read_allitems() read_allitems()
{ {
static char *maxname = 0; static char *maxname = NULL;
char *p, buf[1024]; char *p, buf[1024];
unsigned int len = 0, max = 0; unsigned int len = 0, max = 0;
Item *i, *new; Item *i, *new;
@ -336,7 +336,7 @@ read_allitems()
} }
new = emalloc(sizeof(Item)); new = emalloc(sizeof(Item));
new->next = new->left = new->right = 0; new->next = new->left = new->right = NULL;
new->text = p; new->text = p;
if(!i) if(!i)
allitem = new; allitem = new;

10
wm.c
View File

@ -20,8 +20,9 @@ Atom wm_atom[WMLast], net_atom[NetLast];
Cursor cursor[CurLast]; Cursor cursor[CurLast];
XRectangle rect, barrect; XRectangle rect, barrect;
Bool running = True; Bool running = True;
Client *client = NULL;
char *bartext; char *bartext, tag[256];
int screen, sel_screen; int screen, sel_screen;
unsigned int lock_mask, numlock_mask; 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, status = XGetWindowProperty(dpy, w, a, 0L, l, False, t, &real, &format,
&res, &extra, prop); &res, &extra, prop);
if(status != Success || *prop == 0) { if(status != Success || *prop == NULL) {
return 0; return 0;
} }
if(res == 0) { if(res == 0)
free((void *) *prop); free((void *) *prop);
}
return res; return res;
} }
@ -264,7 +264,7 @@ main(int argc, char *argv[])
barrect.width, barrect.height, 0, DefaultDepth(dpy, screen), barrect.width, barrect.height, 0, DefaultDepth(dpy, screen),
CopyFromParent, DefaultVisual(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
bartext = 0; bartext = NULL;
XDefineCursor(dpy, barwin, cursor[CurNormal]); XDefineCursor(dpy, barwin, cursor[CurNormal]);
XMapRaised(dpy, barwin); XMapRaised(dpy, barwin);
draw_bar(); draw_bar();

15
wm.h
View File

@ -20,11 +20,10 @@ enum { CurNormal, CurResize, CurMove, CurInput, CurLast };
enum { RFloat, RGrid, RLast }; enum { RFloat, RGrid, RLast };
typedef struct Client Client; typedef struct Client Client;
typedef struct Tag Tag;
struct Client { struct Client {
Tag *tag;
char name[256]; char name[256];
char tag[256];
int proto; int proto;
unsigned int border; unsigned int border;
Bool fixedsize; Bool fixedsize;
@ -37,27 +36,21 @@ struct Client {
Client *snext; Client *snext;
}; };
struct Tag {
char name[256];
Client *stack;
XRectangle r;
Tag *next;
Tag *cnext;
};
extern Display *dpy; extern Display *dpy;
extern Window root, barwin; extern Window root, barwin;
extern Atom wm_atom[WMLast], net_atom[NetLast]; extern Atom wm_atom[WMLast], net_atom[NetLast];
extern Cursor cursor[CurLast]; extern Cursor cursor[CurLast];
extern XRectangle rect, barrect; extern XRectangle rect, barrect;
extern Bool running; extern Bool running;
extern Bool grid;
extern void (*handler[LASTEvent]) (XEvent *); extern void (*handler[LASTEvent]) (XEvent *);
extern int screen, sel_screen; extern int screen, sel_screen;
extern unsigned int lock_mask, numlock_mask; extern unsigned int lock_mask, numlock_mask;
extern char *bartext; extern char *bartext, tag[256];
extern Brush brush; extern Brush brush;
extern Client *client;
/* bar.c */ /* bar.c */
extern void draw_bar(); extern void draw_bar();