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
|
arg@166
|
6 #include "config.h"
|
garbeam@32
|
7 #include <X11/Xlib.h>
|
garbeam@32
|
8
|
arg@143
|
9 /* mask shorthands, used in event.c and client.c */
|
arg@150
|
10 #define BUTTONMASK (ButtonPressMask | ButtonReleaseMask)
|
arg@150
|
11 #define MOUSEMASK (BUTTONMASK | PointerMotionMask)
|
arg@157
|
12 #define PROTODELWIN 1
|
arg@143
|
13
|
garbeam@51
|
14 typedef union Arg Arg;
|
arg@105
|
15 typedef struct Client Client;
|
garbeam@34
|
16 typedef struct DC DC;
|
garbeam@32
|
17 typedef struct Fnt Fnt;
|
garbeam@49
|
18
|
garbeam@49
|
19 union Arg {
|
arg@189
|
20 const char *cmd;
|
garbeam@49
|
21 int i;
|
garbeam@49
|
22 };
|
garbeam@18
|
23
|
garbeam@5
|
24 /* atoms */
|
arg@230
|
25 enum { NetSupported, NetWMName, NetLast };
|
garbeam@13
|
26 enum { WMProtocols, WMDelete, WMLast };
|
garbeam@0
|
27
|
garbeam@5
|
28 /* cursor */
|
garbeam@84
|
29 enum { CurNormal, CurResize, CurMove, CurLast };
|
garbeam@0
|
30
|
arg@143
|
31 /* windowcorners */
|
arg@143
|
32 typedef enum { TopLeft, TopRight, BotLeft, BotRight } Corner;
|
arg@99
|
33
|
garbeam@32
|
34 struct Fnt {
|
garbeam@32
|
35 int ascent;
|
garbeam@32
|
36 int descent;
|
garbeam@32
|
37 int height;
|
garbeam@84
|
38 XFontSet set;
|
garbeam@84
|
39 XFontStruct *xfont;
|
garbeam@32
|
40 };
|
garbeam@32
|
41
|
garbeam@34
|
42 struct DC { /* draw context */
|
garbeam@32
|
43 int x, y, w, h;
|
garbeam@32
|
44 unsigned long bg;
|
garbeam@32
|
45 unsigned long fg;
|
arg@237
|
46 unsigned long border;
|
garbeam@84
|
47 Drawable drawable;
|
garbeam@84
|
48 Fnt font;
|
garbeam@84
|
49 GC gc;
|
garbeam@32
|
50 };
|
garbeam@32
|
51
|
garbeam@0
|
52 struct Client {
|
garbeam@31
|
53 char name[256];
|
garbeam@13
|
54 int proto;
|
arg@115
|
55 int x, y, w, h;
|
arg@115
|
56 int tx, ty, tw, th; /* title */
|
garbeam@20
|
57 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
garbeam@29
|
58 int grav;
|
arg@164
|
59 long flags;
|
garbeam@29
|
60 unsigned int border;
|
garbeam@80
|
61 Bool isfloat;
|
arg@124
|
62 Bool ismax;
|
arg@178
|
63 Bool *tags;
|
garbeam@84
|
64 Client *next;
|
arg@127
|
65 Client *prev;
|
garbeam@0
|
66 Window win;
|
garbeam@0
|
67 Window title;
|
garbeam@0
|
68 };
|
garbeam@0
|
69
|
arg@178
|
70 extern const char *tags[];
|
arg@173
|
71 extern char stext[1024];
|
arg@261
|
72 extern int screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
|
arg@291
|
73 extern unsigned int ntags, numlockmask;
|
garbeam@53
|
74 extern void (*handler[LASTEvent])(XEvent *);
|
garbeam@53
|
75 extern void (*arrange)(Arg *);
|
garbeam@84
|
76 extern Atom wmatom[WMLast], netatom[NetLast];
|
arg@262
|
77 extern Bool running, issel, *seltag;
|
garbeam@84
|
78 extern Client *clients, *sel;
|
garbeam@84
|
79 extern Cursor cursor[CurLast];
|
garbeam@84
|
80 extern DC dc;
|
garbeam@84
|
81 extern Display *dpy;
|
garbeam@84
|
82 extern Window root, barwin;
|
garbeam@3
|
83
|
garbeam@5
|
84 /* client.c */
|
garbeam@75
|
85 extern void ban(Client *c);
|
garbeam@76
|
86 extern void focus(Client *c);
|
garbeam@76
|
87 extern Client *getclient(Window w);
|
garbeam@76
|
88 extern Client *getctitle(Window w);
|
garbeam@76
|
89 extern void gravitate(Client *c, Bool invert);
|
garbeam@76
|
90 extern void killclient(Arg *arg);
|
garbeam@10
|
91 extern void manage(Window w, XWindowAttributes *wa);
|
arg@129
|
92 extern void resize(Client *c, Bool sizehints, Corner sticky);
|
garbeam@74
|
93 extern void setsize(Client *c);
|
garbeam@76
|
94 extern void settitle(Client *c);
|
arg@124
|
95 extern void togglemax(Arg *arg);
|
garbeam@76
|
96 extern void unmanage(Client *c);
|
garbeam@13
|
97
|
garbeam@33
|
98 /* draw.c */
|
garbeam@75
|
99 extern void drawall();
|
garbeam@74
|
100 extern void drawstatus();
|
garbeam@74
|
101 extern void drawtitle(Client *c);
|
garbeam@74
|
102 extern unsigned long getcolor(const char *colstr);
|
garbeam@74
|
103 extern void setfont(const char *fontstr);
|
arg@173
|
104 extern unsigned int textw(const char *text);
|
garbeam@33
|
105
|
garbeam@75
|
106 /* event.c */
|
garbeam@73
|
107 extern void grabkeys();
|
arg@292
|
108 extern void procevent();
|
garbeam@18
|
109
|
garbeam@43
|
110 /* main.c */
|
garbeam@76
|
111 extern int getproto(Window w);
|
garbeam@75
|
112 extern void quit(Arg *arg);
|
garbeam@76
|
113 extern void sendevent(Window w, Atom a, long value);
|
garbeam@75
|
114 extern int xerror(Display *dsply, XErrorEvent *ee);
|
garbeam@43
|
115
|
garbeam@75
|
116 /* tag.c */
|
arg@191
|
117 extern void initrregs();
|
arg@142
|
118 extern Client *getnext(Client *c);
|
arg@127
|
119 extern Client *getprev(Client *c);
|
garbeam@76
|
120 extern void settags(Client *c);
|
arg@284
|
121 extern void tag(Arg *arg);
|
arg@284
|
122 extern void toggletag(Arg *arg);
|
garbeam@73
|
123
|
garbeam@32
|
124 /* util.c */
|
garbeam@76
|
125 extern void *emallocz(unsigned int size);
|
garbeam@75
|
126 extern void eprint(const char *errstr, ...);
|
arg@270
|
127 extern void *erealloc(void *ptr, unsigned int size);
|
garbeam@49
|
128 extern void spawn(Arg *arg);
|
arg@327
|
129
|
arg@327
|
130 /* view.c */
|
arg@327
|
131 extern void dofloat(Arg *arg);
|
arg@327
|
132 extern void dotile(Arg *arg);
|
arg@327
|
133 extern void focusnext(Arg *arg);
|
arg@327
|
134 extern void focusprev(Arg *arg);
|
arg@327
|
135 extern Bool isvisible(Client *c);
|
arg@327
|
136 extern void restack();
|
arg@327
|
137 extern void togglemode(Arg *arg);
|
arg@327
|
138 extern void toggleview(Arg *arg);
|
arg@327
|
139 extern void view(Arg *arg);
|
arg@327
|
140 extern void zoom(Arg *arg);
|