summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--client.c6
-rw-r--r--dwm.h141
2 files changed, 72 insertions, 75 deletions
diff --git a/client.c b/client.c
index 6524c06..b6caa93 100644
--- a/client.c
+++ b/client.c
@@ -19,11 +19,11 @@ detachstack(Client *c)
19} 19}
20 20
21static void 21static void
22grabbuttons(Client *c, Bool focus) 22grabbuttons(Client *c, Bool focused)
23{ 23{
24 XUngrabButton(dpy, AnyButton, AnyModifier, c->win); 24 XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
25 25
26 if(focus) { 26 if(focused) {
27 XGrabButton(dpy, Button1, MODKEY, c->win, False, BUTTONMASK, 27 XGrabButton(dpy, Button1, MODKEY, c->win, False, BUTTONMASK,
28 GrabModeAsync, GrabModeSync, None, None); 28 GrabModeAsync, GrabModeSync, None, None);
29 XGrabButton(dpy, Button1, MODKEY | LockMask, c->win, False, BUTTONMASK, 29 XGrabButton(dpy, Button1, MODKEY | LockMask, c->win, False, BUTTONMASK,
@@ -304,7 +304,7 @@ resize(Client *c, Bool sizehints, Corner sticky)
304 wc.border_width = 0; 304 wc.border_width = 0;
305 else 305 else
306 wc.border_width = 1; 306 wc.border_width = 1;
307 XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); 307 XConfigureWindow(dpy, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc);
308 XSync(dpy, False); 308 XSync(dpy, False);
309} 309}
310 310
diff --git a/dwm.h b/dwm.h
index dd536b8..e416a1a 100644
--- a/dwm.h
+++ b/dwm.h
@@ -11,23 +11,19 @@
11#define MOUSEMASK (BUTTONMASK | PointerMotionMask) 11#define MOUSEMASK (BUTTONMASK | PointerMotionMask)
12#define PROTODELWIN 1 12#define PROTODELWIN 1
13 13
14enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
15enum { WMProtocols, WMDelete, WMLast }; /* default atoms */
16enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
17enum { ColFG, ColBG, ColLast }; /* color */
18
19typedef enum {
20 TopLeft, TopRight, BotLeft, BotRight
21} Corner; /* window corners */
22
14typedef union { 23typedef union {
15 const char *cmd; 24 const char *cmd;
16 int i; 25 int i;
17} Arg; 26} Arg; /* argument type */
18
19/* atoms */
20enum { NetSupported, NetWMName, NetLast };
21enum { WMProtocols, WMDelete, WMLast };
22
23/* cursor */
24enum { CurNormal, CurResize, CurMove, CurLast };
25
26/* color */
27enum { ColFG, ColBG, ColLast };
28
29/* window corners */
30typedef enum { TopLeft, TopRight, BotLeft, BotRight } Corner;
31 27
32typedef struct { 28typedef 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
40typedef struct { /* draw context */ 36typedef 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
50typedef struct Client Client; 46typedef struct Client Client;
51struct Client { 47struct Client {
@@ -66,77 +62,78 @@ struct Client {
66 Window twin; 62 Window twin;
67}; 63};
68 64
69extern const char *tags[]; 65extern const char *tags[]; /* all tags */
70extern char stext[1024]; 66extern char stext[1024]; /* status text */
71extern int bx, by, bw, bh, bmw, mw, screen, sx, sy, sw, sh; 67extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */
72extern unsigned int ntags, numlockmask; 68extern int mw, screen, sx, sy, sw, sh; /* screen geometry, master width */
73extern void (*handler[LASTEvent])(XEvent *); 69extern unsigned int ntags, numlockmask; /* number of tags, and dynamic lock mask */
74extern void (*arrange)(Arg *); 70extern void (*handler[LASTEvent])(XEvent *); /* event handler */
71extern void (*arrange)(Arg *); /* arrange function, indicates mode */
75extern Atom wmatom[WMLast], netatom[NetLast]; 72extern Atom wmatom[WMLast], netatom[NetLast];
76extern Bool running, issel, maximized, *seltag; 73extern Bool running, issel, maximized, *seltag; /* seltag is array of Bool */
77extern Client *clients, *sel, *stack; 74extern Client *clients, *sel, *stack; /* Client containers */
78extern Cursor cursor[CurLast]; 75extern Cursor cursor[CurLast];
79extern DC dc; 76extern DC dc; /* draw context for everything */
80extern Display *dpy; 77extern Display *dpy;
81extern Window root, barwin; 78extern Window root, barwin;
82 79
83/* client.c */ 80/* client.c */
84extern void ban(Client *c); 81extern void ban(Client *c); /* ban client from screen */
85extern void focus(Client *c); 82extern void focus(Client *c); /* focus c, c may be NULL */
86extern Client *getclient(Window w); 83extern Client *getclient(Window w); /* return client of w */
87extern Client *getctitle(Window w); 84extern Client *getctitle(Window w); /* return client of title window */
88extern void gravitate(Client *c, Bool invert); 85extern void gravitate(Client *c, Bool invert); /* gravitate c */
89extern void killclient(Arg *arg); 86extern void killclient(Arg *arg); /* kill c nicely */
90extern void manage(Window w, XWindowAttributes *wa); 87extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
91extern void resize(Client *c, Bool sizehints, Corner sticky); 88extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/
92extern void setsize(Client *c); 89extern void setsize(Client *c); /* set the size structs of c */
93extern void settitle(Client *c); 90extern void settitle(Client *c); /* set the name of c */
94extern void togglemax(Arg *arg); 91extern void togglemax(Arg *arg); /* (un)maximize c */
95extern void unmanage(Client *c); 92extern void unmanage(Client *c); /* destroy c */
96 93
97/* draw.c */ 94/* draw.c */
98extern void drawall(); 95extern void drawall(); /* draw all visible client titles and the bar */
99extern void drawstatus(); 96extern void drawstatus(); /* draw the bar */
100extern void drawtitle(Client *c); 97extern void drawtitle(Client *c); /* draw title of c */
101extern unsigned long getcolor(const char *colstr); 98extern unsigned long getcolor(const char *colstr); /* return color of colstr */
102extern void setfont(const char *fontstr); 99extern void setfont(const char *fontstr); /* set the font for DC */
103extern unsigned int textw(const char *text); 100extern unsigned int textw(const char *text); /* return the text width of text */
104 101
105/* event.c */ 102/* event.c */
106extern void grabkeys(); 103extern void grabkeys(); /* grab all keys defined in config.h */
107extern void procevent(); 104extern void procevent(); /* process pending X events */
108 105
109/* main.c */ 106/* main.c */
110extern int getproto(Window w); 107extern int getproto(Window w); /* return protocol mask of WMProtocols property of w */
111extern void quit(Arg *arg); 108extern void quit(Arg *arg); /* quit dwm nicely */
112extern void sendevent(Window w, Atom a, long value); 109extern void sendevent(Window w, Atom a, long value); /* send synthetic event to w */
113extern int xerror(Display *dsply, XErrorEvent *ee); 110extern int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */
114 111
115/* tag.c */ 112/* tag.c */
116extern void initrregs(); 113extern void initrregs(); /* initialize regexps of rules defined in config.h */
117extern Client *getnext(Client *c); 114extern Client *getnext(Client *c); /* returns next visible client */
118extern Client *getprev(Client *c); 115extern Client *getprev(Client *c); /* returns previous visible client */
119extern void settags(Client *c, Client *trans); 116extern void settags(Client *c, Client *trans); /* updates tags of c */
120extern void tag(Arg *arg); 117extern void tag(Arg *arg); /* tags c accordingly to arg's index */
121extern void toggletag(Arg *arg); 118extern void toggletag(Arg *arg); /* toggles c tags accordingly to arg's index */
122 119
123/* util.c */ 120/* util.c */
124extern void *emallocz(unsigned int size); 121extern void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */
125extern void eprint(const char *errstr, ...); 122extern void eprint(const char *errstr, ...); /* prints error string and exits with return code 1 */
126extern void *erealloc(void *ptr, unsigned int size); 123extern void *erealloc(void *ptr, unsigned int size); /* reallocates memory, exits on error */
127extern void spawn(Arg *arg); 124extern void spawn(Arg *arg) /* forks a new subprocess accordingly to arg's cmd */
128 125
129/* view.c */ 126/* view.c */
130extern void detach(Client *c); 127extern void detach(Client *c); /* detaches c from global client list */
131extern void dofloat(Arg *arg); 128extern void dofloat(Arg *arg); /* arranges all windows in a floating way, arg is ignored */
132extern void dotile(Arg *arg); 129extern void dotile(Arg *arg); /* arranges all windows in a tiled way, arg is ignored */
133extern void focusnext(Arg *arg); 130extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */
134extern void focusprev(Arg *arg); 131extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */
135extern Bool isvisible(Client *c); 132extern Bool isvisible(Client *c); /* returns True if client is visible */
136extern void resizecol(Arg *arg); 133extern void resizecol(Arg *arg); /* resizes the master width accordingly to arg's index value */
137extern void restack(); 134extern void restack(); /* restores z layers of all clients */
138extern void togglemode(Arg *arg); 135extern void togglemode(Arg *arg); /* toggles global arrange mode (between dotile and dofloat) */
139extern void toggleview(Arg *arg); 136extern void toggleview(Arg *arg); /* makes the tag accordingly to arg's index (in)visible */
140extern void view(Arg *arg); 137extern void view(Arg *arg); /* makes the tag accordingly to arg's index visible */
141extern void viewall(Arg *arg); 138extern void viewall(Arg *arg); /* makes all tags visible, arg is ignored */
142extern void zoom(Arg *arg); 139extern void zoom(Arg *arg); /* zooms the focused client to master column, arg is ignored */