diff options
Diffstat (limited to 'dwm.h')
| -rw-r--r-- | dwm.h | 136 |
1 files changed, 136 insertions, 0 deletions
| @@ -0,0 +1,136 @@ | |||
| 1 | /* | ||
| 2 | * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com> | ||
| 3 | * See LICENSE file for license details. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <X11/Xlib.h> | ||
| 7 | |||
| 8 | /********** CUSTOMIZE **********/ | ||
| 9 | |||
| 10 | #define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*" | ||
| 11 | #define BGCOLOR "DarkSlateGrey" | ||
| 12 | #define FGCOLOR "LightSteelBlue" | ||
| 13 | #define BORDERCOLOR "SlateGray" | ||
| 14 | #define WM_PROTOCOL_DELWIN 1 | ||
| 15 | |||
| 16 | /* tags */ | ||
| 17 | enum { Tscratch, Tdev, Tirc, Twww, Twork, TLast }; | ||
| 18 | |||
| 19 | /********** CUSTOMIZE **********/ | ||
| 20 | |||
| 21 | typedef struct DC DC; | ||
| 22 | typedef struct Client Client; | ||
| 23 | typedef struct Fnt Fnt; | ||
| 24 | typedef struct Key Key; | ||
| 25 | |||
| 26 | /* atoms */ | ||
| 27 | enum { WMProtocols, WMDelete, WMLast }; | ||
| 28 | enum { NetSupported, NetWMName, NetLast }; | ||
| 29 | |||
| 30 | /* cursor */ | ||
| 31 | enum { CurNormal, CurResize, CurMove, CurInput, CurLast }; | ||
| 32 | |||
| 33 | struct Fnt { | ||
| 34 | XFontStruct *xfont; | ||
| 35 | XFontSet set; | ||
| 36 | int ascent; | ||
| 37 | int descent; | ||
| 38 | int height; | ||
| 39 | }; | ||
| 40 | |||
| 41 | struct DC { /* draw context */ | ||
| 42 | GC gc; | ||
| 43 | Drawable drawable; | ||
| 44 | int x, y, w, h; | ||
| 45 | Fnt font; | ||
| 46 | unsigned long bg; | ||
| 47 | unsigned long fg; | ||
| 48 | unsigned long border; | ||
| 49 | }; | ||
| 50 | |||
| 51 | struct Client { | ||
| 52 | char name[256]; | ||
| 53 | char *tags[TLast]; | ||
| 54 | int proto; | ||
| 55 | int x, y, w, h; | ||
| 56 | int tx, ty, tw, th; | ||
| 57 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; | ||
| 58 | int grav; | ||
| 59 | unsigned int border; | ||
| 60 | long flags; | ||
| 61 | Window win; | ||
| 62 | Window trans; | ||
| 63 | Window title; | ||
| 64 | Client *next; | ||
| 65 | Client *snext; | ||
| 66 | }; | ||
| 67 | |||
| 68 | struct Key { | ||
| 69 | unsigned long mod; | ||
| 70 | KeySym keysym; | ||
| 71 | void (*func)(void *aux); | ||
| 72 | void *aux; | ||
| 73 | }; | ||
| 74 | |||
| 75 | extern Display *dpy; | ||
| 76 | extern Window root; | ||
| 77 | extern Atom wm_atom[WMLast], net_atom[NetLast]; | ||
| 78 | extern Cursor cursor[CurLast]; | ||
| 79 | extern Bool running, issel; | ||
| 80 | extern void (*handler[LASTEvent]) (XEvent *); | ||
| 81 | |||
| 82 | extern int tsel, screen, sx, sy, sw, sh, th; | ||
| 83 | extern char stext[1024], *tags[TLast]; | ||
| 84 | |||
| 85 | extern DC dc; | ||
| 86 | extern Client *clients, *stack; | ||
| 87 | |||
| 88 | /* client.c */ | ||
| 89 | extern void manage(Window w, XWindowAttributes *wa); | ||
| 90 | extern void unmanage(Client *c); | ||
| 91 | extern Client *getclient(Window w); | ||
| 92 | extern void focus(Client *c); | ||
| 93 | extern void update_name(Client *c); | ||
| 94 | extern void draw_client(Client *c); | ||
| 95 | extern void resize(Client *c); | ||
| 96 | extern void update_size(Client *c); | ||
| 97 | extern Client *gettitle(Window w); | ||
| 98 | extern void craise(Client *c); | ||
| 99 | extern void lower(Client *c); | ||
| 100 | extern void ckill(void *aux); | ||
| 101 | extern void sel(void *aux); | ||
| 102 | extern void max(void *aux); | ||
| 103 | extern void toggle(void *aux); | ||
| 104 | extern void gravitate(Client *c, Bool invert); | ||
| 105 | |||
| 106 | /* draw.c */ | ||
| 107 | extern void draw(Bool border, const char *text); | ||
| 108 | extern unsigned long initcolor(const char *colstr); | ||
| 109 | extern void initfont(const char *fontstr); | ||
| 110 | extern unsigned int textnw(char *text, unsigned int len); | ||
| 111 | extern unsigned int textw(char *text); | ||
| 112 | extern unsigned int texth(void); | ||
| 113 | |||
| 114 | /* event.c */ | ||
| 115 | extern void discard_events(long even_mask); | ||
| 116 | |||
| 117 | /* dev.c */ | ||
| 118 | extern void update_keys(void); | ||
| 119 | extern void keypress(XEvent *e); | ||
| 120 | extern void mresize(Client *c); | ||
| 121 | extern void mmove(Client *c); | ||
| 122 | |||
| 123 | /* main.c */ | ||
| 124 | extern int error_handler(Display *dsply, XErrorEvent *e); | ||
| 125 | extern void send_message(Window w, Atom a, long value); | ||
| 126 | extern int win_proto(Window w); | ||
| 127 | extern void quit(void *aux); | ||
| 128 | |||
| 129 | /* util.c */ | ||
| 130 | extern void error(const char *errstr, ...); | ||
| 131 | extern void *emallocz(unsigned int size); | ||
| 132 | extern void *emalloc(unsigned int size); | ||
| 133 | extern void *erealloc(void *ptr, unsigned int size); | ||
| 134 | extern char *estrdup(const char *str); | ||
| 135 | extern void spawn(char *argv[]); | ||
| 136 | extern void swap(void **p1, void **p2); | ||
