xref: /inferno-os/module/wmsrv.m (revision 2b69dba5038ffd0b59cf30a4c44bce549e5097f8)
1 Wmsrv: module{
2 	PATH: con "/dis/lib/wmsrv.dis";
3 
4 	init:	fn(): 	(chan of (string, chan of (string, ref Draw->Wmcontext)),
5 		chan of (ref Client, chan of string),
6 		chan of (ref Client, array of byte, Sys->Rwrite));
7 
8 	find:	fn(p: Draw->Point): ref Client;
9 	top:	fn(): ref Client;
10 
11 	Window: adt {
12 		tag:	string;
13 		r:	Draw->Rect;
14 		img:	ref Draw->Image;
15 	};
16 
17 	Client: adt {
18 		kbd:		chan of int;
19 		ptr:		chan of ref Draw->Pointer;
20 		ctl:		chan of string;
21 		stop:		chan of int;
22 		flags:	int;			# general purpose.
23 		cursor:	string;		# hack.
24 		wins:	list of ref Window;
25 		znext:	cyclic ref Client;
26 
27 		# private:
28 		images:	chan of (ref Draw->Point, ref Draw->Image, chan of int);
29 		id:		int;				# index into clients array
30 		fid:		int;
31 		token:	int;
32 		wmctxt:	ref Draw->Wmcontext;
33 
34 		window:	fn(c: self ref Client, tag: string): ref Window;
35 		contains:	fn(c: self ref Client, p: Draw->Point): int;
36 		image:	fn(c: self ref Client, tag: string):	ref Draw->Image;
37 		setimage:	fn(c: self ref Client, tag: string,  i: ref Draw->Image): int;	# only in response to some msgs.
38 		setorigin:	fn(c: self ref Client, tag: string, o: Draw->Point): int;		# only in response to some msgs.
39 		top:		fn(c: self ref Client);			# bring to top.
40 		bottom:	fn(c: self ref Client);			# send to bottom.
41 		hide:		fn(w: self ref Client);		# move offscreen.
42 		unhide:	fn(w: self ref Client);		# move onscreen.
43 		remove:	fn(w: self ref Client);
44 	};
45 };
46 
47