diff options
Diffstat (limited to '')
| -rw-r--r-- | dwm.h | 190 |
1 files changed, 0 insertions, 190 deletions
| @@ -1,190 +0,0 @@ | |||
| 1 | /* See LICENSE file for copyright and license details. */ | ||
| 2 | |||
| 3 | /* enums */ | ||
| 4 | enum { BarTop, BarBot, BarOff }; /* bar position */ | ||
| 5 | enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ | ||
| 6 | enum { ColBorder, ColFG, ColBG, ColLast }; /* color */ | ||
| 7 | enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ | ||
| 8 | enum { WMProtocols, WMDelete, WMName, WMState, WMLast };/* default atoms */ | ||
| 9 | |||
| 10 | /* typedefs */ | ||
| 11 | typedef struct Client Client; | ||
| 12 | struct Client { | ||
| 13 | char name[256]; | ||
| 14 | int x, y, w, h; | ||
| 15 | int rx, ry, rw, rh; /* revert geometry */ | ||
| 16 | int basew, baseh, incw, inch, maxw, maxh, minw, minh; | ||
| 17 | int minax, maxax, minay, maxay; | ||
| 18 | long flags; | ||
| 19 | unsigned int border, oldborder; | ||
| 20 | Bool isbanned, isfixed, ismax, isfloating, wasfloating; | ||
| 21 | Bool *tags; | ||
| 22 | Client *next; | ||
| 23 | Client *prev; | ||
| 24 | Client *snext; | ||
| 25 | Window win; | ||
| 26 | }; | ||
| 27 | |||
| 28 | typedef struct { | ||
| 29 | int x, y, w, h; | ||
| 30 | unsigned long norm[ColLast]; | ||
| 31 | unsigned long sel[ColLast]; | ||
| 32 | Drawable drawable; | ||
| 33 | GC gc; | ||
| 34 | struct { | ||
| 35 | int ascent; | ||
| 36 | int descent; | ||
| 37 | int height; | ||
| 38 | XFontSet set; | ||
| 39 | XFontStruct *xfont; | ||
| 40 | } font; | ||
| 41 | } DC; /* draw context */ | ||
| 42 | |||
| 43 | typedef struct { | ||
| 44 | unsigned long mod; | ||
| 45 | KeySym keysym; | ||
| 46 | void (*func)(const char *arg); | ||
| 47 | const char *arg; | ||
| 48 | } Key; | ||
| 49 | |||
| 50 | typedef struct { | ||
| 51 | const char *symbol; | ||
| 52 | void (*arrange)(void); | ||
| 53 | } Layout; | ||
| 54 | |||
| 55 | typedef struct { | ||
| 56 | const char *prop; | ||
| 57 | const char *tags; | ||
| 58 | Bool isfloating; | ||
| 59 | } Rule; | ||
| 60 | |||
| 61 | typedef struct { | ||
| 62 | regex_t *propregex; | ||
| 63 | regex_t *tagregex; | ||
| 64 | } Regs; | ||
| 65 | |||
| 66 | /* functions */ | ||
| 67 | void applyrules(Client *c); | ||
| 68 | void arrange(void); | ||
| 69 | void attach(Client *c); | ||
| 70 | void attachstack(Client *c); | ||
| 71 | void ban(Client *c); | ||
| 72 | void buttonpress(XEvent *e); | ||
| 73 | void checkotherwm(void); | ||
| 74 | void cleanup(void); | ||
| 75 | void compileregs(void); | ||
| 76 | void configure(Client *c); | ||
| 77 | void configurenotify(XEvent *e); | ||
| 78 | void configurerequest(XEvent *e); | ||
| 79 | void destroynotify(XEvent *e); | ||
| 80 | void detach(Client *c); | ||
| 81 | void detachstack(Client *c); | ||
| 82 | void drawbar(void); | ||
| 83 | void drawsquare(Bool filled, Bool empty, unsigned long col[ColLast]); | ||
| 84 | void drawtext(const char *text, unsigned long col[ColLast]); | ||
| 85 | void *emallocz(unsigned int size); | ||
| 86 | void enternotify(XEvent *e); | ||
| 87 | void eprint(const char *errstr, ...); | ||
| 88 | void expose(XEvent *e); | ||
| 89 | void floating(void); /* default floating layout */ | ||
| 90 | void focus(Client *c); | ||
| 91 | void focusnext(const char *arg); | ||
| 92 | void focusprev(const char *arg); | ||
| 93 | Client *getclient(Window w); | ||
| 94 | unsigned long getcolor(const char *colstr); | ||
| 95 | long getstate(Window w); | ||
| 96 | Bool gettextprop(Window w, Atom atom, char *text, unsigned int size); | ||
| 97 | void grabbuttons(Client *c, Bool focused); | ||
| 98 | unsigned int idxoftag(const char *tag); | ||
| 99 | void initfont(const char *fontstr); | ||
| 100 | Bool isarrange(void (*func)()); | ||
| 101 | Bool isoccupied(unsigned int t); | ||
| 102 | Bool isprotodel(Client *c); | ||
| 103 | Bool isvisible(Client *c); | ||
| 104 | void keypress(XEvent *e); | ||
| 105 | void killclient(const char *arg); | ||
| 106 | void leavenotify(XEvent *e); | ||
| 107 | void manage(Window w, XWindowAttributes *wa); | ||
| 108 | void mappingnotify(XEvent *e); | ||
| 109 | void maprequest(XEvent *e); | ||
| 110 | void movemouse(Client *c); | ||
| 111 | Client *nexttiled(Client *c); | ||
| 112 | void propertynotify(XEvent *e); | ||
| 113 | void quit(const char *arg); | ||
| 114 | void resize(Client *c, int x, int y, int w, int h, Bool sizehints); | ||
| 115 | void resizemouse(Client *c); | ||
| 116 | void restack(void); | ||
| 117 | void run(void); | ||
| 118 | void scan(void); | ||
| 119 | void setclientstate(Client *c, long state); | ||
| 120 | void setlayout(const char *arg); | ||
| 121 | void setmwfact(const char *arg); | ||
| 122 | void setup(void); | ||
| 123 | void spawn(const char *arg); | ||
| 124 | void tag(const char *arg); | ||
| 125 | unsigned int textnw(const char *text, unsigned int len); | ||
| 126 | unsigned int textw(const char *text); | ||
| 127 | void tile(void); | ||
| 128 | void togglebar(const char *arg); | ||
| 129 | void togglefloating(const char *arg); | ||
| 130 | void togglemax(const char *arg); | ||
| 131 | void toggletag(const char *arg); | ||
| 132 | void toggleview(const char *arg); | ||
| 133 | void unban(Client *c); | ||
| 134 | void unmanage(Client *c); | ||
| 135 | void unmapnotify(XEvent *e); | ||
| 136 | void updatebarpos(void); | ||
| 137 | void updatesizehints(Client *c); | ||
| 138 | void updatetitle(Client *c); | ||
| 139 | void view(const char *arg); | ||
| 140 | void viewprevtag(const char *arg); /* views previous selected tags */ | ||
| 141 | int xerror(Display *dpy, XErrorEvent *ee); | ||
| 142 | int xerrordummy(Display *dsply, XErrorEvent *ee); | ||
| 143 | int xerrorstart(Display *dsply, XErrorEvent *ee); | ||
| 144 | void zoom(const char *arg); | ||
| 145 | |||
| 146 | /* variables */ | ||
| 147 | char stext[256]; | ||
| 148 | double mwfact; | ||
| 149 | int screen, sx, sy, sw, sh, wax, way, waw, wah; | ||
| 150 | int (*xerrorxlib)(Display *, XErrorEvent *); | ||
| 151 | unsigned int bh, bpos; | ||
| 152 | unsigned int blw = 0; | ||
| 153 | unsigned int ltidx = 0; /* default */ | ||
| 154 | unsigned int nlayouts = 0; | ||
| 155 | unsigned int nrules = 0; | ||
| 156 | unsigned int numlockmask = 0; | ||
| 157 | void (*handler[LASTEvent]) (XEvent *) = { | ||
| 158 | [ButtonPress] = buttonpress, | ||
| 159 | [ConfigureRequest] = configurerequest, | ||
| 160 | [ConfigureNotify] = configurenotify, | ||
| 161 | [DestroyNotify] = destroynotify, | ||
| 162 | [EnterNotify] = enternotify, | ||
| 163 | [LeaveNotify] = leavenotify, | ||
| 164 | [Expose] = expose, | ||
| 165 | [KeyPress] = keypress, | ||
| 166 | [MappingNotify] = mappingnotify, | ||
| 167 | [MapRequest] = maprequest, | ||
| 168 | [PropertyNotify] = propertynotify, | ||
| 169 | [UnmapNotify] = unmapnotify | ||
| 170 | }; | ||
| 171 | Atom wmatom[WMLast], netatom[NetLast]; | ||
| 172 | Bool otherwm, readin; | ||
| 173 | Bool running = True; | ||
| 174 | Bool selscreen = True; | ||
| 175 | Client *clients = NULL; | ||
| 176 | Client *sel = NULL; | ||
| 177 | Client *stack = NULL; | ||
| 178 | Cursor cursor[CurLast]; | ||
| 179 | Display *dpy; | ||
| 180 | DC dc = {0}; | ||
| 181 | Window barwin, root; | ||
| 182 | Regs *regs = NULL; | ||
| 183 | |||
| 184 | /* configuration, allows nested code to access above variables */ | ||
| 185 | #include "config.h" | ||
| 186 | |||
| 187 | /* statically define the number of tags. */ | ||
| 188 | unsigned int ntags = sizeof tags / sizeof tags[0]; | ||
| 189 | Bool seltags[sizeof tags / sizeof tags[0]] = {[0] = True}; | ||
| 190 | Bool prevtags[sizeof tags / sizeof tags[0]] = {[0] = True}; | ||
