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;
int n;
char **list = 0;
char **list = NULL;
name.nitems = 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;
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");

24
menu.c
View File

@ -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;

10
wm.c
View File

@ -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();

15
wm.h
View File

@ -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();