dwm-meillo

diff dwm.h @ 452:026aba558fdf

added some comments
author Anselm R. Garbe <arg@10kloc.org>
date Mon, 11 Sep 2006 07:40:41 +0200
parents a2e587651c79
children f30f937f9e52
line diff
     1.1 --- a/dwm.h	Fri Sep 08 08:32:08 2006 +0200
     1.2 +++ b/dwm.h	Mon Sep 11 07:40:41 2006 +0200
     1.3 @@ -11,23 +11,19 @@
     1.4  #define MOUSEMASK		(BUTTONMASK | PointerMotionMask)
     1.5  #define PROTODELWIN		1
     1.6  
     1.7 +enum { NetSupported, NetWMName, NetLast };		/* EWMH atoms */
     1.8 +enum { WMProtocols, WMDelete, WMLast };			/* default atoms */
     1.9 +enum { CurNormal, CurResize, CurMove, CurLast };	/* cursor */
    1.10 +enum { ColFG, ColBG, ColLast };				/* color */
    1.11 +
    1.12 +typedef enum {
    1.13 +	TopLeft, TopRight, BotLeft, BotRight
    1.14 +} Corner; /* window corners */
    1.15 +
    1.16  typedef union {
    1.17  	const char *cmd;
    1.18  	int i;
    1.19 -} Arg;
    1.20 -
    1.21 -/* atoms */
    1.22 -enum { NetSupported, NetWMName, NetLast };
    1.23 -enum { WMProtocols, WMDelete, WMLast };
    1.24 -
    1.25 -/* cursor */
    1.26 -enum { CurNormal, CurResize, CurMove, CurLast };
    1.27 -
    1.28 -/* color */
    1.29 -enum { ColFG, ColBG, ColLast };
    1.30 -
    1.31 -/* window corners */
    1.32 -typedef enum { TopLeft, TopRight, BotLeft, BotRight } Corner;
    1.33 +} Arg; /* argument type */
    1.34  
    1.35  typedef struct {
    1.36  	int ascent;
    1.37 @@ -37,7 +33,7 @@
    1.38  	XFontStruct *xfont;
    1.39  } Fnt;
    1.40  
    1.41 -typedef struct { /* draw context */
    1.42 +typedef struct {
    1.43  	int x, y, w, h;
    1.44  	unsigned long norm[ColLast];
    1.45  	unsigned long sel[ColLast];
    1.46 @@ -45,7 +41,7 @@
    1.47  	Drawable drawable;
    1.48  	Fnt font;
    1.49  	GC gc;
    1.50 -} DC;
    1.51 +} DC; /* draw context */
    1.52  
    1.53  typedef struct Client Client;
    1.54  struct Client {
    1.55 @@ -66,77 +62,78 @@
    1.56  	Window twin;
    1.57  };
    1.58  
    1.59 -extern const char *tags[];
    1.60 -extern char stext[1024];
    1.61 -extern int bx, by, bw, bh, bmw, mw, screen, sx, sy, sw, sh;
    1.62 -extern unsigned int ntags, numlockmask;
    1.63 -extern void (*handler[LASTEvent])(XEvent *);
    1.64 -extern void (*arrange)(Arg *);
    1.65 +extern const char *tags[];			/* all tags */
    1.66 +extern char stext[1024];			/* status text */
    1.67 +extern int bx, by, bw, bh, bmw;			/* bar geometry, bar mode label width */
    1.68 +extern int mw, screen, sx, sy, sw, sh;		/* screen geometry, master width */
    1.69 +extern unsigned int ntags, numlockmask;		/* number of tags, and dynamic lock mask */
    1.70 +extern void (*handler[LASTEvent])(XEvent *);	/* event handler */
    1.71 +extern void (*arrange)(Arg *);			/* arrange function, indicates mode  */
    1.72  extern Atom wmatom[WMLast], netatom[NetLast];
    1.73 -extern Bool running, issel, maximized, *seltag;
    1.74 -extern Client *clients, *sel, *stack;
    1.75 +extern Bool running, issel, maximized, *seltag;	/* seltag is array of Bool */
    1.76 +extern Client *clients, *sel, *stack;		/* Client containers */
    1.77  extern Cursor cursor[CurLast];
    1.78 -extern DC dc;
    1.79 +extern DC dc;					/* draw context for everything */
    1.80  extern Display *dpy;
    1.81  extern Window root, barwin;
    1.82  
    1.83  /* client.c */
    1.84 -extern void ban(Client *c);
    1.85 -extern void focus(Client *c);
    1.86 -extern Client *getclient(Window w);
    1.87 -extern Client *getctitle(Window w);
    1.88 -extern void gravitate(Client *c, Bool invert);
    1.89 -extern void killclient(Arg *arg);
    1.90 -extern void manage(Window w, XWindowAttributes *wa);
    1.91 -extern void resize(Client *c, Bool sizehints, Corner sticky);
    1.92 -extern void setsize(Client *c);
    1.93 -extern void settitle(Client *c);
    1.94 -extern void togglemax(Arg *arg);
    1.95 -extern void unmanage(Client *c);
    1.96 +extern void ban(Client *c);			/* ban client from screen */
    1.97 +extern void focus(Client *c);			/* focus c, c may be NULL */
    1.98 +extern Client *getclient(Window w);		/* return client of w */
    1.99 +extern Client *getctitle(Window w);		/* return client of title window */
   1.100 +extern void gravitate(Client *c, Bool invert);	/* gravitate c */
   1.101 +extern void killclient(Arg *arg);		/* kill c nicely */
   1.102 +extern void manage(Window w, XWindowAttributes *wa);	/* manage new client */
   1.103 +extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/
   1.104 +extern void setsize(Client *c);			/* set the size structs of c */
   1.105 +extern void settitle(Client *c);		/* set the name of c */
   1.106 +extern void togglemax(Arg *arg);		/* (un)maximize c */
   1.107 +extern void unmanage(Client *c);		/* destroy c */
   1.108  
   1.109  /* draw.c */
   1.110 -extern void drawall();
   1.111 -extern void drawstatus();
   1.112 -extern void drawtitle(Client *c);
   1.113 -extern unsigned long getcolor(const char *colstr);
   1.114 -extern void setfont(const char *fontstr);
   1.115 -extern unsigned int textw(const char *text);
   1.116 +extern void drawall();				/* draw all visible client titles and the bar */
   1.117 +extern void drawstatus();			/* draw the bar */
   1.118 +extern void drawtitle(Client *c);		/* draw title of c */
   1.119 +extern unsigned long getcolor(const char *colstr);	/* return color of colstr */
   1.120 +extern void setfont(const char *fontstr);	/* set the font for DC */
   1.121 +extern unsigned int textw(const char *text);	/* return the text width of text */
   1.122  
   1.123  /* event.c */
   1.124 -extern void grabkeys();
   1.125 -extern void procevent();
   1.126 +extern void grabkeys();				/* grab all keys defined in config.h */
   1.127 +extern void procevent();			/* process pending X events */
   1.128  
   1.129  /* main.c */
   1.130 -extern int getproto(Window w);
   1.131 -extern void quit(Arg *arg);
   1.132 -extern void sendevent(Window w, Atom a, long value);
   1.133 -extern int xerror(Display *dsply, XErrorEvent *ee);
   1.134 +extern int getproto(Window w);			/* return protocol mask of WMProtocols property of w */
   1.135 +extern void quit(Arg *arg);			/* quit dwm nicely */
   1.136 +extern void sendevent(Window w, Atom a, long value);	/* send synthetic event to w */
   1.137 +extern int xerror(Display *dsply, XErrorEvent *ee);	/* dwm's X error handler */
   1.138  
   1.139  /* tag.c */
   1.140 -extern void initrregs();
   1.141 -extern Client *getnext(Client *c);
   1.142 -extern Client *getprev(Client *c);
   1.143 -extern void settags(Client *c, Client *trans);
   1.144 -extern void tag(Arg *arg);
   1.145 -extern void toggletag(Arg *arg);
   1.146 +extern void initrregs();			/* initialize regexps of rules defined in config.h */
   1.147 +extern Client *getnext(Client *c);		/* returns next visible client */
   1.148 +extern Client *getprev(Client *c);		/* returns previous visible client */
   1.149 +extern void settags(Client *c, Client *trans);	/* updates tags of c */
   1.150 +extern void tag(Arg *arg);			/* tags c accordingly to arg's index */
   1.151 +extern void toggletag(Arg *arg);		/* toggles c tags accordingly to arg's index */
   1.152  
   1.153  /* util.c */
   1.154 -extern void *emallocz(unsigned int size);
   1.155 -extern void eprint(const char *errstr, ...);
   1.156 -extern void *erealloc(void *ptr, unsigned int size);
   1.157 -extern void spawn(Arg *arg);
   1.158 +extern void *emallocz(unsigned int size);	/* allocates zero-initialized memory, exits on error */
   1.159 +extern void eprint(const char *errstr, ...);	/* prints error string and exits with return code 1 */
   1.160 +extern void *erealloc(void *ptr, unsigned int size);	/* reallocates memory, exits on error */
   1.161 +extern void spawn(Arg *arg)			/* forks a new subprocess accordingly to arg's cmd */
   1.162  
   1.163  /* view.c */
   1.164 -extern void detach(Client *c);
   1.165 -extern void dofloat(Arg *arg);
   1.166 -extern void dotile(Arg *arg);
   1.167 -extern void focusnext(Arg *arg);
   1.168 -extern void focusprev(Arg *arg);
   1.169 -extern Bool isvisible(Client *c);
   1.170 -extern void resizecol(Arg *arg);
   1.171 -extern void restack();
   1.172 -extern void togglemode(Arg *arg);
   1.173 -extern void toggleview(Arg *arg);
   1.174 -extern void view(Arg *arg);
   1.175 -extern void viewall(Arg *arg);
   1.176 -extern void zoom(Arg *arg);
   1.177 +extern void detach(Client *c);			/* detaches c from global client list */
   1.178 +extern void dofloat(Arg *arg);			/* arranges all windows in a floating way, arg is ignored */
   1.179 +extern void dotile(Arg *arg);			/* arranges all windows in a tiled way, arg is ignored */
   1.180 +extern void focusnext(Arg *arg);		/* focuses next visible client, arg is ignored  */
   1.181 +extern void focusprev(Arg *arg);		/* focuses previous visible client, arg is ignored */
   1.182 +extern Bool isvisible(Client *c);		/* returns True if client is visible */
   1.183 +extern void resizecol(Arg *arg);		/* resizes the master width accordingly to arg's index value */
   1.184 +extern void restack();				/* restores z layers of all clients */
   1.185 +extern void togglemode(Arg *arg);		/* toggles global arrange mode (between dotile and dofloat) */
   1.186 +extern void toggleview(Arg *arg);		/* makes the tag accordingly to arg's index (in)visible */
   1.187 +extern void view(Arg *arg);			/* makes the tag accordingly to arg's index visible */
   1.188 +extern void viewall(Arg *arg);			/* makes all tags visible, arg is ignored */
   1.189 +extern void zoom(Arg *arg);			/* zooms the focused client to master column, arg is ignored */