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