rev |
line source |
garbeam@0
|
1 /*
|
garbeam@0
|
2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
|
garbeam@0
|
3 * See LICENSE file for license details.
|
garbeam@0
|
4 */
|
garbeam@0
|
5
|
garbeam@32
|
6 #include <X11/Xlib.h>
|
garbeam@2
|
7
|
arg@125
|
8 /* CUSTOMIZE */
|
garbeam@0
|
9
|
arg@130
|
10 #define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
|
arg@130
|
11 #define BGCOLOR "#0a2c2d"
|
arg@130
|
12 #define FGCOLOR "#ddeeee"
|
arg@130
|
13 #define BORDERCOLOR "#176164"
|
arg@130
|
14 #define MODKEY Mod1Mask /* Mod4Mask */
|
garbeam@78
|
15 /*
|
arg@130
|
16 #define BGCOLOR "#666699"
|
arg@130
|
17 #define FGCOLOR "#eeeeee"
|
arg@130
|
18 #define BORDERCOLOR "#9999CC"
|
garbeam@78
|
19 */
|
arg@130
|
20 #define MASTERW 52 /* percent */
|
garbeam@51
|
21 #define WM_PROTOCOL_DELWIN 1
|
garbeam@13
|
22
|
garbeam@32
|
23 /* tags */
|
arg@130
|
24 enum { Tfnord, Tdev, Tnet, Twork, Tmisc, TLast };
|
garbeam@32
|
25
|
arg@125
|
26 /* END CUSTOMIZE */
|
garbeam@32
|
27
|
arg@143
|
28 /* mask shorthands, used in event.c and client.c */
|
arg@143
|
29 #define ButtonMask (ButtonPressMask | ButtonReleaseMask)
|
arg@143
|
30 #define MouseMask (ButtonMask | PointerMotionMask)
|
arg@143
|
31
|
garbeam@51
|
32 typedef union Arg Arg;
|
arg@105
|
33 typedef struct Client Client;
|
garbeam@34
|
34 typedef struct DC DC;
|
garbeam@32
|
35 typedef struct Fnt Fnt;
|
garbeam@49
|
36
|
garbeam@49
|
37 union Arg {
|
garbeam@49
|
38 const char **argv;
|
garbeam@49
|
39 int i;
|
garbeam@49
|
40 };
|
garbeam@18
|
41
|
garbeam@5
|
42 /* atoms */
|
garbeam@84
|
43 enum { NetSupported, NetWMName, NetLast };
|
garbeam@13
|
44 enum { WMProtocols, WMDelete, WMLast };
|
garbeam@0
|
45
|
garbeam@5
|
46 /* cursor */
|
garbeam@84
|
47 enum { CurNormal, CurResize, CurMove, CurLast };
|
garbeam@0
|
48
|
arg@143
|
49 /* windowcorners */
|
arg@143
|
50 typedef enum { TopLeft, TopRight, BotLeft, BotRight } Corner;
|
arg@99
|
51
|
garbeam@32
|
52 struct Fnt {
|
garbeam@32
|
53 int ascent;
|
garbeam@32
|
54 int descent;
|
garbeam@32
|
55 int height;
|
garbeam@84
|
56 XFontSet set;
|
garbeam@84
|
57 XFontStruct *xfont;
|
garbeam@32
|
58 };
|
garbeam@32
|
59
|
garbeam@34
|
60 struct DC { /* draw context */
|
garbeam@32
|
61 int x, y, w, h;
|
garbeam@32
|
62 unsigned long bg;
|
garbeam@32
|
63 unsigned long fg;
|
garbeam@32
|
64 unsigned long border;
|
garbeam@84
|
65 Drawable drawable;
|
garbeam@84
|
66 Fnt font;
|
garbeam@84
|
67 GC gc;
|
garbeam@32
|
68 };
|
garbeam@32
|
69
|
garbeam@0
|
70 struct Client {
|
garbeam@31
|
71 char name[256];
|
garbeam@31
|
72 char *tags[TLast];
|
garbeam@13
|
73 int proto;
|
arg@115
|
74 int x, y, w, h;
|
arg@115
|
75 int tx, ty, tw, th; /* title */
|
garbeam@20
|
76 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
garbeam@29
|
77 int grav;
|
garbeam@29
|
78 unsigned int border;
|
garbeam@20
|
79 long flags;
|
garbeam@80
|
80 Bool isfloat;
|
arg@124
|
81 Bool ismax;
|
garbeam@84
|
82 Client *next;
|
arg@127
|
83 Client *prev;
|
garbeam@0
|
84 Window win;
|
garbeam@0
|
85 Window title;
|
garbeam@0
|
86 };
|
garbeam@0
|
87
|
garbeam@84
|
88 extern char *tags[TLast], stext[1024];
|
garbeam@84
|
89 extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
|
garbeam@53
|
90 extern void (*handler[LASTEvent])(XEvent *);
|
garbeam@53
|
91 extern void (*arrange)(Arg *);
|
garbeam@84
|
92 extern Atom wmatom[WMLast], netatom[NetLast];
|
garbeam@84
|
93 extern Bool running, issel;
|
garbeam@84
|
94 extern Client *clients, *sel;
|
garbeam@84
|
95 extern Cursor cursor[CurLast];
|
garbeam@84
|
96 extern DC dc;
|
garbeam@84
|
97 extern Display *dpy;
|
garbeam@84
|
98 extern Window root, barwin;
|
garbeam@3
|
99
|
garbeam@5
|
100 /* client.c */
|
garbeam@75
|
101 extern void ban(Client *c);
|
garbeam@76
|
102 extern void focus(Client *c);
|
garbeam@76
|
103 extern void focusnext(Arg *arg);
|
garbeam@76
|
104 extern void focusprev(Arg *arg);
|
garbeam@76
|
105 extern Client *getclient(Window w);
|
garbeam@76
|
106 extern Client *getctitle(Window w);
|
garbeam@76
|
107 extern void gravitate(Client *c, Bool invert);
|
garbeam@76
|
108 extern void higher(Client *c);
|
garbeam@76
|
109 extern void killclient(Arg *arg);
|
garbeam@76
|
110 extern void lower(Client *c);
|
garbeam@10
|
111 extern void manage(Window w, XWindowAttributes *wa);
|
arg@129
|
112 extern void resize(Client *c, Bool sizehints, Corner sticky);
|
garbeam@74
|
113 extern void setsize(Client *c);
|
garbeam@76
|
114 extern void settitle(Client *c);
|
arg@124
|
115 extern void togglemax(Arg *arg);
|
garbeam@76
|
116 extern void unmanage(Client *c);
|
garbeam@75
|
117 extern void zoom(Arg *arg);
|
garbeam@13
|
118
|
garbeam@33
|
119 /* draw.c */
|
garbeam@75
|
120 extern void drawall();
|
garbeam@74
|
121 extern void drawstatus();
|
garbeam@74
|
122 extern void drawtitle(Client *c);
|
garbeam@74
|
123 extern unsigned long getcolor(const char *colstr);
|
garbeam@74
|
124 extern void setfont(const char *fontstr);
|
garbeam@43
|
125 extern unsigned int textw(char *text);
|
garbeam@33
|
126
|
garbeam@75
|
127 /* event.c */
|
garbeam@73
|
128 extern void grabkeys();
|
garbeam@18
|
129
|
garbeam@43
|
130 /* main.c */
|
garbeam@76
|
131 extern int getproto(Window w);
|
garbeam@75
|
132 extern void quit(Arg *arg);
|
garbeam@76
|
133 extern void sendevent(Window w, Atom a, long value);
|
garbeam@75
|
134 extern int xerror(Display *dsply, XErrorEvent *ee);
|
garbeam@43
|
135
|
garbeam@75
|
136 /* tag.c */
|
garbeam@76
|
137 extern void appendtag(Arg *arg);
|
garbeam@75
|
138 extern void dofloat(Arg *arg);
|
garbeam@75
|
139 extern void dotile(Arg *arg);
|
arg@142
|
140 extern Client *getnext(Client *c);
|
arg@127
|
141 extern Client *getprev(Client *c);
|
garbeam@76
|
142 extern void replacetag(Arg *arg);
|
garbeam@76
|
143 extern void settags(Client *c);
|
arg@124
|
144 extern void togglemode(Arg *arg);
|
garbeam@73
|
145 extern void view(Arg *arg);
|
arg@144
|
146 extern void viewnext(Arg *arg);
|
arg@144
|
147 extern void viewprev(Arg *arg);
|
garbeam@73
|
148
|
garbeam@32
|
149 /* util.c */
|
garbeam@76
|
150 extern void *emallocz(unsigned int size);
|
garbeam@75
|
151 extern void eprint(const char *errstr, ...);
|
garbeam@49
|
152 extern void spawn(Arg *arg);
|