diff options
| author | Anselm R. Garbe <arg@10kloc.org> | 2006-09-11 07:40:41 +0200 |
|---|---|---|
| committer | Anselm R. Garbe <arg@10kloc.org> | 2006-09-11 07:40:41 +0200 |
| commit | 281f0981a6edd51417f9bb427cc870370748e43f (patch) | |
| tree | 60541d186743c7d71c3a16ec1aa9008d86dc678a /dwm.h | |
| parent | Added tag 1.5 for changeset 728c9089b079721b43c3347124639a29baa22a97 (diff) | |
| download | dwm-281f0981a6edd51417f9bb427cc870370748e43f.tar.gz dwm-281f0981a6edd51417f9bb427cc870370748e43f.zip | |
added some comments
Diffstat (limited to '')
| -rw-r--r-- | dwm.h | 141 |
1 files changed, 69 insertions, 72 deletions
| @@ -11,23 +11,19 @@ | |||
| 11 | #define MOUSEMASK (BUTTONMASK | PointerMotionMask) | 11 | #define MOUSEMASK (BUTTONMASK | PointerMotionMask) |
| 12 | #define PROTODELWIN 1 | 12 | #define PROTODELWIN 1 |
| 13 | 13 | ||
| 14 | enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ | ||
| 15 | enum { WMProtocols, WMDelete, WMLast }; /* default atoms */ | ||
| 16 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ | ||
| 17 | enum { ColFG, ColBG, ColLast }; /* color */ | ||
| 18 | |||
| 19 | typedef enum { | ||
| 20 | TopLeft, TopRight, BotLeft, BotRight | ||
| 21 | } Corner; /* window corners */ | ||
| 22 | |||
| 14 | typedef union { | 23 | typedef union { |
| 15 | const char *cmd; | 24 | const char *cmd; |
| 16 | int i; | 25 | int i; |
| 17 | } Arg; | 26 | } Arg; /* argument type */ |
| 18 | |||
| 19 | /* atoms */ | ||
| 20 | enum { NetSupported, NetWMName, NetLast }; | ||
| 21 | enum { WMProtocols, WMDelete, WMLast }; | ||
| 22 | |||
| 23 | /* cursor */ | ||
| 24 | enum { CurNormal, CurResize, CurMove, CurLast }; | ||
| 25 | |||
| 26 | /* color */ | ||
| 27 | enum { ColFG, ColBG, ColLast }; | ||
| 28 | |||
| 29 | /* window corners */ | ||
| 30 | typedef enum { TopLeft, TopRight, BotLeft, BotRight } Corner; | ||
| 31 | 27 | ||
| 32 | typedef struct { | 28 | typedef struct { |
| 33 | int ascent; | 29 | int ascent; |
| @@ -37,7 +33,7 @@ typedef struct { | |||
| 37 | XFontStruct *xfont; | 33 | XFontStruct *xfont; |
| 38 | } Fnt; | 34 | } Fnt; |
| 39 | 35 | ||
| 40 | typedef struct { /* draw context */ | 36 | typedef struct { |
| 41 | int x, y, w, h; | 37 | int x, y, w, h; |
| 42 | unsigned long norm[ColLast]; | 38 | unsigned long norm[ColLast]; |
| 43 | unsigned long sel[ColLast]; | 39 | unsigned long sel[ColLast]; |
| @@ -45,7 +41,7 @@ typedef struct { /* draw context */ | |||
| 45 | Drawable drawable; | 41 | Drawable drawable; |
| 46 | Fnt font; | 42 | Fnt font; |
| 47 | GC gc; | 43 | GC gc; |
| 48 | } DC; | 44 | } DC; /* draw context */ |
| 49 | 45 | ||
| 50 | typedef struct Client Client; | 46 | typedef struct Client Client; |
| 51 | struct Client { | 47 | struct Client { |
| @@ -66,77 +62,78 @@ struct Client { | |||
| 66 | Window twin; | 62 | Window twin; |
| 67 | }; | 63 | }; |
| 68 | 64 | ||
| 69 | extern const char *tags[]; | 65 | extern const char *tags[]; /* all tags */ |
| 70 | extern char stext[1024]; | 66 | extern char stext[1024]; /* status text */ |
| 71 | extern int bx, by, bw, bh, bmw, mw, screen, sx, sy, sw, sh; | 67 | extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */ |
| 72 | extern unsigned int ntags, numlockmask; | 68 | extern int mw, screen, sx, sy, sw, sh; /* screen geometry, master width */ |
| 73 | extern void (*handler[LASTEvent])(XEvent *); | 69 | extern unsigned int ntags, numlockmask; /* number of tags, and dynamic lock mask */ |
| 74 | extern void (*arrange)(Arg *); | 70 | extern void (*handler[LASTEvent])(XEvent *); /* event handler */ |
| 71 | extern void (*arrange)(Arg *); /* arrange function, indicates mode */ | ||
| 75 | extern Atom wmatom[WMLast], netatom[NetLast]; | 72 | extern Atom wmatom[WMLast], netatom[NetLast]; |
| 76 | extern Bool running, issel, maximized, *seltag; | 73 | extern Bool running, issel, maximized, *seltag; /* seltag is array of Bool */ |
| 77 | extern Client *clients, *sel, *stack; | 74 | extern Client *clients, *sel, *stack; /* Client containers */ |
| 78 | extern Cursor cursor[CurLast]; | 75 | extern Cursor cursor[CurLast]; |
| 79 | extern DC dc; | 76 | extern DC dc; /* draw context for everything */ |
| 80 | extern Display *dpy; | 77 | extern Display *dpy; |
| 81 | extern Window root, barwin; | 78 | extern Window root, barwin; |
| 82 | 79 | ||
| 83 | /* client.c */ | 80 | /* client.c */ |
| 84 | extern void ban(Client *c); | 81 | extern void ban(Client *c); /* ban client from screen */ |
| 85 | extern void focus(Client *c); | 82 | extern void focus(Client *c); /* focus c, c may be NULL */ |
| 86 | extern Client *getclient(Window w); | 83 | extern Client *getclient(Window w); /* return client of w */ |
| 87 | extern Client *getctitle(Window w); | 84 | extern Client *getctitle(Window w); /* return client of title window */ |
| 88 | extern void gravitate(Client *c, Bool invert); | 85 | extern void gravitate(Client *c, Bool invert); /* gravitate c */ |
| 89 | extern void killclient(Arg *arg); | 86 | extern void killclient(Arg *arg); /* kill c nicely */ |
| 90 | extern void manage(Window w, XWindowAttributes *wa); | 87 | extern void manage(Window w, XWindowAttributes *wa); /* manage new client */ |
| 91 | extern void resize(Client *c, Bool sizehints, Corner sticky); | 88 | extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/ |
| 92 | extern void setsize(Client *c); | 89 | extern void setsize(Client *c); /* set the size structs of c */ |
| 93 | extern void settitle(Client *c); | 90 | extern void settitle(Client *c); /* set the name of c */ |
| 94 | extern void togglemax(Arg *arg); | 91 | extern void togglemax(Arg *arg); /* (un)maximize c */ |
| 95 | extern void unmanage(Client *c); | 92 | extern void unmanage(Client *c); /* destroy c */ |
| 96 | 93 | ||
| 97 | /* draw.c */ | 94 | /* draw.c */ |
| 98 | extern void drawall(); | 95 | extern void drawall(); /* draw all visible client titles and the bar */ |
| 99 | extern void drawstatus(); | 96 | extern void drawstatus(); /* draw the bar */ |
| 100 | extern void drawtitle(Client *c); | 97 | extern void drawtitle(Client *c); /* draw title of c */ |
| 101 | extern unsigned long getcolor(const char *colstr); | 98 | extern unsigned long getcolor(const char *colstr); /* return color of colstr */ |
| 102 | extern void setfont(const char *fontstr); | 99 | extern void setfont(const char *fontstr); /* set the font for DC */ |
| 103 | extern unsigned int textw(const char *text); | 100 | extern unsigned int textw(const char *text); /* return the text width of text */ |
| 104 | 101 | ||
| 105 | /* event.c */ | 102 | /* event.c */ |
| 106 | extern void grabkeys(); | 103 | extern void grabkeys(); /* grab all keys defined in config.h */ |
| 107 | extern void procevent(); | 104 | extern void procevent(); /* process pending X events */ |
| 108 | 105 | ||
| 109 | /* main.c */ | 106 | /* main.c */ |
| 110 | extern int getproto(Window w); | 107 | extern int getproto(Window w); /* return protocol mask of WMProtocols property of w */ |
| 111 | extern void quit(Arg *arg); | 108 | extern void quit(Arg *arg); /* quit dwm nicely */ |
| 112 | extern void sendevent(Window w, Atom a, long value); | 109 | extern void sendevent(Window w, Atom a, long value); /* send synthetic event to w */ |
| 113 | extern int xerror(Display *dsply, XErrorEvent *ee); | 110 | extern int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */ |
| 114 | 111 | ||
| 115 | /* tag.c */ | 112 | /* tag.c */ |
| 116 | extern void initrregs(); | 113 | extern void initrregs(); /* initialize regexps of rules defined in config.h */ |
| 117 | extern Client *getnext(Client *c); | 114 | extern Client *getnext(Client *c); /* returns next visible client */ |
| 118 | extern Client *getprev(Client *c); | 115 | extern Client *getprev(Client *c); /* returns previous visible client */ |
| 119 | extern void settags(Client *c, Client *trans); | 116 | extern void settags(Client *c, Client *trans); /* updates tags of c */ |
| 120 | extern void tag(Arg *arg); | 117 | extern void tag(Arg *arg); /* tags c accordingly to arg's index */ |
| 121 | extern void toggletag(Arg *arg); | 118 | extern void toggletag(Arg *arg); /* toggles c tags accordingly to arg's index */ |
| 122 | 119 | ||
| 123 | /* util.c */ | 120 | /* util.c */ |
| 124 | extern void *emallocz(unsigned int size); | 121 | extern void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */ |
| 125 | extern void eprint(const char *errstr, ...); | 122 | extern void eprint(const char *errstr, ...); /* prints error string and exits with return code 1 */ |
| 126 | extern void *erealloc(void *ptr, unsigned int size); | 123 | extern void *erealloc(void *ptr, unsigned int size); /* reallocates memory, exits on error */ |
| 127 | extern void spawn(Arg *arg); | 124 | extern void spawn(Arg *arg) /* forks a new subprocess accordingly to arg's cmd */ |
| 128 | 125 | ||
| 129 | /* view.c */ | 126 | /* view.c */ |
| 130 | extern void detach(Client *c); | 127 | extern void detach(Client *c); /* detaches c from global client list */ |
| 131 | extern void dofloat(Arg *arg); | 128 | extern void dofloat(Arg *arg); /* arranges all windows in a floating way, arg is ignored */ |
| 132 | extern void dotile(Arg *arg); | 129 | extern void dotile(Arg *arg); /* arranges all windows in a tiled way, arg is ignored */ |
| 133 | extern void focusnext(Arg *arg); | 130 | extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */ |
| 134 | extern void focusprev(Arg *arg); | 131 | extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */ |
| 135 | extern Bool isvisible(Client *c); | 132 | extern Bool isvisible(Client *c); /* returns True if client is visible */ |
| 136 | extern void resizecol(Arg *arg); | 133 | extern void resizecol(Arg *arg); /* resizes the master width accordingly to arg's index value */ |
| 137 | extern void restack(); | 134 | extern void restack(); /* restores z layers of all clients */ |
| 138 | extern void togglemode(Arg *arg); | 135 | extern void togglemode(Arg *arg); /* toggles global arrange mode (between dotile and dofloat) */ |
| 139 | extern void toggleview(Arg *arg); | 136 | extern void toggleview(Arg *arg); /* makes the tag accordingly to arg's index (in)visible */ |
| 140 | extern void view(Arg *arg); | 137 | extern void view(Arg *arg); /* makes the tag accordingly to arg's index visible */ |
| 141 | extern void viewall(Arg *arg); | 138 | extern void viewall(Arg *arg); /* makes all tags visible, arg is ignored */ |
| 142 | extern void zoom(Arg *arg); | 139 | extern void zoom(Arg *arg); /* zooms the focused client to master column, arg is ignored */ |
