aewl

view dwm.h @ 453:f30f937f9e52

small fix
author Anselm R. Garbe <arg@10kloc.org>
date Mon, 11 Sep 2006 08:58:58 +0200
parents 026aba558fdf
children ffb462fb7903
line source
1 /*
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
3 * See LICENSE file for license details.
4 */
6 #include "config.h"
7 #include <X11/Xlib.h>
9 /* mask shorthands, used in event.c and client.c */
10 #define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
11 #define MOUSEMASK (BUTTONMASK | PointerMotionMask)
12 #define PROTODELWIN 1
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 */
19 typedef enum {
20 TopLeft, TopRight, BotLeft, BotRight
21 } Corner; /* window corners */
23 typedef union {
24 const char *cmd;
25 int i;
26 } Arg; /* argument type */
28 typedef struct {
29 int ascent;
30 int descent;
31 int height;
32 XFontSet set;
33 XFontStruct *xfont;
34 } Fnt;
36 typedef struct {
37 int x, y, w, h;
38 unsigned long norm[ColLast];
39 unsigned long sel[ColLast];
40 unsigned long status[ColLast];
41 Drawable drawable;
42 Fnt font;
43 GC gc;
44 } DC; /* draw context */
46 typedef struct Client Client;
47 struct Client {
48 char name[256];
49 int proto;
50 int x, y, w, h;
51 int tx, ty, tw, th; /* title window geometry */
52 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
53 int grav;
54 long flags;
55 unsigned int border, weight;
56 Bool isfloat;
57 Bool *tags;
58 Client *next;
59 Client *prev;
60 Client *snext;
61 Window win;
62 Window twin;
63 };
65 extern const char *tags[]; /* all tags */
66 extern char stext[1024]; /* status text */
67 extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */
68 extern int mw, screen, sx, sy, sw, sh; /* screen geometry, master width */
69 extern unsigned int ntags, numlockmask; /* number of tags, and dynamic lock mask */
70 extern void (*handler[LASTEvent])(XEvent *); /* event handler */
71 extern void (*arrange)(Arg *); /* arrange function, indicates mode */
72 extern Atom wmatom[WMLast], netatom[NetLast];
73 extern Bool running, issel, maximized, *seltag; /* seltag is array of Bool */
74 extern Client *clients, *sel, *stack; /* Client containers */
75 extern Cursor cursor[CurLast];
76 extern DC dc; /* draw context for everything */
77 extern Display *dpy;
78 extern Window root, barwin;
80 /* client.c */
81 extern void ban(Client *c); /* ban client from screen */
82 extern void focus(Client *c); /* focus c, c may be NULL */
83 extern Client *getclient(Window w); /* return client of w */
84 extern Client *getctitle(Window w); /* return client of title window */
85 extern void gravitate(Client *c, Bool invert); /* gravitate c */
86 extern void killclient(Arg *arg); /* kill c nicely */
87 extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
88 extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/
89 extern void setsize(Client *c); /* set the size structs of c */
90 extern void settitle(Client *c); /* set the name of c */
91 extern void togglemax(Arg *arg); /* (un)maximize c */
92 extern void unmanage(Client *c); /* destroy c */
94 /* draw.c */
95 extern void drawall(); /* draw all visible client titles and the bar */
96 extern void drawstatus(); /* draw the bar */
97 extern void drawtitle(Client *c); /* draw title of c */
98 extern unsigned long getcolor(const char *colstr); /* return color of colstr */
99 extern void setfont(const char *fontstr); /* set the font for DC */
100 extern unsigned int textw(const char *text); /* return the text width of text */
102 /* event.c */
103 extern void grabkeys(); /* grab all keys defined in config.h */
104 extern void procevent(); /* process pending X events */
106 /* main.c */
107 extern int getproto(Window w); /* return protocol mask of WMProtocols property of w */
108 extern void quit(Arg *arg); /* quit dwm nicely */
109 extern void sendevent(Window w, Atom a, long value); /* send synthetic event to w */
110 extern int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */
112 /* tag.c */
113 extern void initrregs(); /* initialize regexps of rules defined in config.h */
114 extern Client *getnext(Client *c); /* returns next visible client */
115 extern Client *getprev(Client *c); /* returns previous visible client */
116 extern void settags(Client *c, Client *trans); /* updates tags of c */
117 extern void tag(Arg *arg); /* tags c accordingly to arg's index */
118 extern void toggletag(Arg *arg); /* toggles c tags accordingly to arg's index */
120 /* util.c */
121 extern void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */
122 extern void eprint(const char *errstr, ...); /* prints error string and exits with return code 1 */
123 extern void *erealloc(void *ptr, unsigned int size); /* reallocates memory, exits on error */
124 extern void spawn(Arg *arg); /* forks a new subprocess accordingly to arg's cmd */
126 /* view.c */
127 extern void detach(Client *c); /* detaches c from global client list */
128 extern void dofloat(Arg *arg); /* arranges all windows in a floating way, arg is ignored */
129 extern void dotile(Arg *arg); /* arranges all windows in a tiled way, arg is ignored */
130 extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */
131 extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */
132 extern Bool isvisible(Client *c); /* returns True if client is visible */
133 extern void resizecol(Arg *arg); /* resizes the master width accordingly to arg's index value */
134 extern void restack(); /* restores z layers of all clients */
135 extern void togglemode(Arg *arg); /* toggles global arrange mode (between dotile and dofloat) */
136 extern void toggleview(Arg *arg); /* makes the tag accordingly to arg's index (in)visible */
137 extern void view(Arg *arg); /* makes the tag accordingly to arg's index visible */
138 extern void viewall(Arg *arg); /* makes all tags visible, arg is ignored */
139 extern void zoom(Arg *arg); /* zooms the focused client to master column, arg is ignored */