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