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
|
garbeam@32
|
8 /********** CUSTOMIZE **********/
|
garbeam@0
|
9
|
garbeam@51
|
10 #define FONT "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*"
|
garbeam@51
|
11 #define BGCOLOR "#666699"
|
garbeam@59
|
12 #define FGCOLOR "#eeeeee"
|
garbeam@51
|
13 #define BORDERCOLOR "#9999CC"
|
garbeam@51
|
14 #define MASTERW 52 /* percent */
|
garbeam@51
|
15 #define WM_PROTOCOL_DELWIN 1
|
garbeam@13
|
16
|
garbeam@32
|
17 /* tags */
|
garbeam@59
|
18 enum { Tscratch, Tdev, Twww, Twork, TLast };
|
garbeam@32
|
19
|
garbeam@32
|
20 /********** CUSTOMIZE **********/
|
garbeam@32
|
21
|
garbeam@51
|
22 typedef union Arg Arg;
|
garbeam@34
|
23 typedef struct DC DC;
|
garbeam@18
|
24 typedef struct Client Client;
|
garbeam@32
|
25 typedef struct Fnt Fnt;
|
garbeam@18
|
26 typedef struct Key Key;
|
garbeam@51
|
27 typedef struct Rule Rule;
|
garbeam@49
|
28
|
garbeam@49
|
29 union Arg {
|
garbeam@49
|
30 const char **argv;
|
garbeam@49
|
31 int i;
|
garbeam@49
|
32 };
|
garbeam@18
|
33
|
garbeam@5
|
34 /* atoms */
|
garbeam@13
|
35 enum { WMProtocols, WMDelete, WMLast };
|
garbeam@0
|
36 enum { NetSupported, NetWMName, NetLast };
|
garbeam@0
|
37
|
garbeam@5
|
38 /* cursor */
|
garbeam@0
|
39 enum { CurNormal, CurResize, CurMove, CurInput, CurLast };
|
garbeam@0
|
40
|
garbeam@32
|
41 struct Fnt {
|
garbeam@32
|
42 XFontStruct *xfont;
|
garbeam@32
|
43 XFontSet set;
|
garbeam@32
|
44 int ascent;
|
garbeam@32
|
45 int descent;
|
garbeam@32
|
46 int height;
|
garbeam@32
|
47 };
|
garbeam@32
|
48
|
garbeam@34
|
49 struct DC { /* draw context */
|
garbeam@32
|
50 GC gc;
|
garbeam@32
|
51 Drawable drawable;
|
garbeam@32
|
52 int x, y, w, h;
|
garbeam@32
|
53 Fnt font;
|
garbeam@32
|
54 unsigned long bg;
|
garbeam@32
|
55 unsigned long fg;
|
garbeam@32
|
56 unsigned long border;
|
garbeam@32
|
57 };
|
garbeam@32
|
58
|
garbeam@0
|
59 struct Client {
|
garbeam@31
|
60 char name[256];
|
garbeam@31
|
61 char *tags[TLast];
|
garbeam@13
|
62 int proto;
|
garbeam@20
|
63 int x, y, w, h;
|
garbeam@22
|
64 int tx, ty, tw, th;
|
garbeam@20
|
65 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
garbeam@29
|
66 int grav;
|
garbeam@29
|
67 unsigned int border;
|
garbeam@20
|
68 long flags;
|
garbeam@53
|
69 Bool floating;
|
garbeam@0
|
70 Window win;
|
garbeam@0
|
71 Window title;
|
garbeam@0
|
72 Client *next;
|
garbeam@50
|
73 Client *revert;
|
garbeam@0
|
74 };
|
garbeam@0
|
75
|
garbeam@51
|
76 struct Rule {
|
garbeam@51
|
77 const char *class;
|
garbeam@51
|
78 const char *instance;
|
garbeam@51
|
79 char *tags[TLast];
|
garbeam@53
|
80 Bool floating;
|
garbeam@51
|
81 };
|
garbeam@51
|
82
|
garbeam@8
|
83 struct Key {
|
garbeam@8
|
84 unsigned long mod;
|
garbeam@8
|
85 KeySym keysym;
|
garbeam@49
|
86 void (*func)(Arg *arg);
|
garbeam@49
|
87 Arg arg;
|
garbeam@8
|
88 };
|
garbeam@8
|
89
|
garbeam@0
|
90 extern Display *dpy;
|
garbeam@57
|
91 extern Window root, barwin;
|
garbeam@13
|
92 extern Atom wm_atom[WMLast], net_atom[NetLast];
|
garbeam@0
|
93 extern Cursor cursor[CurLast];
|
garbeam@31
|
94 extern Bool running, issel;
|
garbeam@53
|
95 extern void (*handler[LASTEvent])(XEvent *);
|
garbeam@53
|
96 extern void (*arrange)(Arg *);
|
garbeam@73
|
97 extern Key key[];
|
garbeam@0
|
98
|
garbeam@57
|
99 extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
|
garbeam@57
|
100 extern char *tags[TLast], stext[1024];
|
garbeam@3
|
101
|
garbeam@34
|
102 extern DC dc;
|
garbeam@50
|
103 extern Client *clients, *sel;
|
garbeam@3
|
104
|
garbeam@5
|
105 /* client.c */
|
garbeam@10
|
106 extern void manage(Window w, XWindowAttributes *wa);
|
garbeam@13
|
107 extern void unmanage(Client *c);
|
garbeam@13
|
108 extern Client *getclient(Window w);
|
garbeam@13
|
109 extern void focus(Client *c);
|
garbeam@13
|
110 extern void update_name(Client *c);
|
garbeam@52
|
111 extern void resize(Client *c, Bool inc);
|
garbeam@20
|
112 extern void update_size(Client *c);
|
garbeam@23
|
113 extern Client *gettitle(Window w);
|
garbeam@32
|
114 extern void craise(Client *c);
|
garbeam@26
|
115 extern void lower(Client *c);
|
garbeam@29
|
116 extern void gravitate(Client *c, Bool invert);
|
garbeam@73
|
117 extern void ban_client(Client *c);
|
garbeam@73
|
118 extern Client *next(Client *c);
|
garbeam@13
|
119
|
garbeam@33
|
120 /* draw.c */
|
garbeam@73
|
121 extern void draw_bar();
|
garbeam@73
|
122 extern void draw_client(Client *c);
|
garbeam@66
|
123 extern void drawtext(const char *text, Bool invert, Bool border);
|
garbeam@43
|
124 extern unsigned long initcolor(const char *colstr);
|
garbeam@43
|
125 extern void initfont(const char *fontstr);
|
garbeam@43
|
126 extern unsigned int textnw(char *text, unsigned int len);
|
garbeam@43
|
127 extern unsigned int textw(char *text);
|
garbeam@43
|
128 extern unsigned int texth(void);
|
garbeam@33
|
129
|
garbeam@73
|
130 /* key.c */
|
garbeam@73
|
131 extern void grabkeys();
|
garbeam@9
|
132 extern void keypress(XEvent *e);
|
garbeam@18
|
133
|
garbeam@43
|
134 /* main.c */
|
garbeam@43
|
135 extern int error_handler(Display *dsply, XErrorEvent *e);
|
garbeam@43
|
136 extern void send_message(Window w, Atom a, long value);
|
garbeam@43
|
137 extern int win_proto(Window w);
|
garbeam@49
|
138 extern void quit(Arg *arg);
|
garbeam@43
|
139
|
garbeam@73
|
140 /* screen.c */
|
garbeam@73
|
141 extern void floating(Arg *arg);
|
garbeam@73
|
142 extern void tiling(Arg *arg);
|
garbeam@73
|
143 extern void view(Arg *arg);
|
garbeam@73
|
144
|
garbeam@32
|
145 /* util.c */
|
garbeam@33
|
146 extern void error(const char *errstr, ...);
|
garbeam@32
|
147 extern void *emallocz(unsigned int size);
|
garbeam@49
|
148 extern void spawn(Arg *arg);
|