blob: fb339919d17807e14215faad87753424f0bb160e [file] [log] [blame]
rsc9801d5e2006-06-26 00:08:29 +00001/* Copyright (c) 2006 Russ Cox */
2
3/*
4
5tag[1] Rerror error[s]
6
7tag[1] Trdmouse
8tag[1] Rrdmouse x[4] y[4] button[4] msec[4] resized[1]
9
10tag[1] Tmoveto x[4] y[4]
11tag[1] Rmoveto
12
13tag[1] Tcursor cursor[]
14tag[1] Rcursor
15
16tag[1] Tbouncemouse x[4] y[4] button[4]
17tag[1] Rbouncemouse
18
19tag[1] Trdkbd
20tag[1] Rrdkbd rune[2]
21
22tag[1] Tlabel label[s]
23tag[1] Rlabel
24
25tag[1] Tinit winsize[s] label[s] font[s]
26tag[1] Rinit
27
28tag[1] Trdsnarf
29tag[1] Rrdsnarf snarf[s]
30
31tag[1] Twrsnarf snarf[s]
32tag[1] Rwrsnarf
33
34tag[1] Trddraw count[4]
35tag[1] Rrddraw count[4] data[count]
36
37tag[1] Twrdraw count[4] data[count]
38tag[1] Rwrdraw count[4]
39
40tag[1] Ttop
41tag[1] Rtop
42
43tag[1] Tresize rect[4*4]
44tag[1] Rresize
45*/
46
rsc9801d5e2006-06-26 00:08:29 +000047
48#define PUT(p, x) \
49 (p)[0] = ((x) >> 24)&0xFF, \
50 (p)[1] = ((x) >> 16)&0xFF, \
51 (p)[2] = ((x) >> 8)&0xFF, \
52 (p)[3] = (x)&0xFF
53
54#define GET(p, x) \
rsc9a5678a2006-11-04 20:41:42 +000055 ((x) = (u32int)(((p)[0] << 24) | ((p)[1] << 16) | ((p)[2] << 8) | ((p)[3])))
rsc9801d5e2006-06-26 00:08:29 +000056
57#define PUT2(p, x) \
58 (p)[0] = ((x) >> 8)&0xFF, \
59 (p)[1] = (x)&0xFF
60
61#define GET2(p, x) \
62 ((x) = (((p)[0] << 8) | ((p)[1])))
63
64enum {
65 Rerror = 1,
66 Trdmouse = 2,
67 Rrdmouse,
68 Tmoveto = 4,
69 Rmoveto,
70 Tcursor = 6,
71 Rcursor,
72 Tbouncemouse = 8,
73 Rbouncemouse,
74 Trdkbd = 10,
75 Rrdkbd,
76 Tlabel = 12,
77 Rlabel,
78 Tinit = 14,
79 Rinit,
80 Trdsnarf = 16,
81 Rrdsnarf,
82 Twrsnarf = 18,
83 Rwrsnarf,
84 Trddraw = 20,
85 Rrddraw,
86 Twrdraw = 22,
87 Rwrdraw,
88 Ttop = 24,
89 Rtop,
90 Tresize = 26,
91 Rresize,
92 Tmax,
93};
94
95enum {
96 MAXWMSG = 4*1024*1024
97};
98
99typedef struct Wsysmsg Wsysmsg;
100struct Wsysmsg
101{
102 uchar type;
103 uchar tag;
104 Mouse mouse;
105 int resized;
106 Cursor cursor;
107 int arrowcursor;
108 Rune rune;
109 char *winsize;
110 char *label;
111 char *snarf;
112 char *error;
113 uchar *data;
114 uint count;
115 Rectangle rect;
116};
117
118uint convW2M(Wsysmsg*, uchar*, uint);
119uint convM2W(uchar*, uint, Wsysmsg*);
120uint sizeW2M(Wsysmsg*);
121int readwsysmsg(int, uchar*, uint);
122
123int drawfcallfmt(Fmt*);