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