aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/rio/dat.h
blob: b2b74eea0da2b15d7329772ec4aa11c304f1100b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/* Copyright (c) 1994-1996 David Hogan, see README for licence details */

#define BORDER		_border
#define CORNER		_corner
#define	INSET		_inset
#define MAXHIDDEN	128
#define B3FIXED 	5
#define NUMVIRTUALS	12

#define AllButtonMask	(Button1Mask|Button2Mask|Button3Mask \
			|Button4Mask|Button5Mask)
#define ButtonMask	(ButtonPressMask|ButtonReleaseMask)
#define MenuMask	(ButtonMask|ButtonMotionMask|ExposureMask)
#define MenuGrabMask	(ButtonMask|ButtonMotionMask|StructureNotifyMask)

#ifdef	Plan9
#define DEFSHELL	"/bin/rc"
#else
#define DEFSHELL	"/bin/sh"
#endif

typedef struct Client Client;
typedef struct Menu Menu;
typedef struct ScreenInfo ScreenInfo;
typedef enum BorderOrient BorderOrient;

struct Client {
	Window		window;
	Window		parent;
	Window		trans;
	Client		*next;
	Client		*revert;

	int 		x;
	int 		y;
	int 		dx;
	int 		dy;
	int 		border;

	XSizeHints	size;
	int 		min_dx;
	int 		min_dy;

	int 		state;
	int 		init;
	int 		reparenting;
	int 		is9term;
	int 		hold;
	int 		proto;
	int			virt;

	char		*label;
	char		*instance;
	char		*class;
	char		*name;
	char		*iconname;

	Colormap	cmap;
	int 		ncmapwins;
	Window		*cmapwins;
	Colormap	*wmcmaps;
	ScreenInfo	*screen;
};

#define hidden(c)	((c)->state == IconicState)
#define withdrawn(c)	((c)->state == WithdrawnState)
#define normal(c)	((c)->state == NormalState)

/* c->proto */
#define Pdelete 	1
#define Ptakefocus	2
#define Plosefocus	4

struct Menu {
	char	**item;
	char	*(*gen)();
	int	lasthit;
};

enum BorderOrient {
	BorderUnknown = 0, /* we depend on this!*/
	BorderN,
	BorderNNE,
	BorderENE,
	BorderE,
	BorderESE,
	BorderSSE,
	BorderS,
	BorderSSW,
	BorderWSW,
	BorderW,
	BorderWNW,
	BorderNNW,
	NBorder,
};

struct ScreenInfo {
	int			num;
	int			depth;
	Visual		*vis;
	int			width;
	int			height;
	Window		root;
	Window		menuwin;
	Window		sweepwin;
	Colormap		def_cmap;
	GC			gc;
	GC			gccopy;
	GC			gcred;
	GC			gcsweep;
	GC			gcmenubg;
	GC			gcmenubgs;
	GC			gcmenufg;
	GC			gcmenufgs;
	unsigned long	black;
	unsigned long	white;
	unsigned long	activeholdborder;
	unsigned long	inactiveholdborder;
	unsigned long	activeborder;
	unsigned long	inactiveborder;
	unsigned long	red;
	Pixmap		bkup[2];
	int			min_cmaps;
	Cursor		target;
	Cursor		sweep0;
	Cursor		boxcurs;
	Cursor		arrow;
	Cursor		bordcurs[NBorder];
	Pixmap		root_pixmap;
	char			display[256];	/* arbitrary limit */
};

/* main.c */
extern Display		*dpy;
extern ScreenInfo	*screens;
extern int			num_screens;
extern int			initting;
extern XFontStruct	*font;
extern int			nostalgia;
extern char		**myargv;
extern Bool 		shape;
extern char 		*termprog;
extern char 		*shell;
extern char 		*version[];
extern int			_border;
extern int			_corner;
extern int			_inset;
extern int			curtime;
extern int			debug;
extern int			solidsweep;
extern int			numvirtuals;
extern int			scrolling;

extern Atom		exit_rio;
extern Atom		restart_rio;
extern Atom 		wm_state;
extern Atom		wm_change_state;
extern Atom 		_rio_hold_mode;
extern Atom 		wm_protocols;
extern Atom 		wm_delete;
extern Atom 		wm_take_focus;
extern Atom		wm_lose_focus;
extern Atom 		wm_colormaps;

/* client.c */
extern Client		*clients;
extern Client		*current;
extern Client		*currents[];

/* menu.c */
extern Client		*hiddenc[];
extern int 			numhidden;
extern char 		*b2items[];
extern Menu 		b2menu;
extern char 		*b3items[];
extern Menu 		b3menu;
extern int			virt;

/* manage.c */
extern int			isNew;

/* error.c */
extern int 			ignore_badwindow;