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
|
/* Copyright (c) 2006 Russ Cox */
/*
tag[1] Rerror error[s]
tag[1] Trdmouse
tag[1] Rrdmouse x[4] y[4] button[4] msec[4] resized[1]
tag[1] Tmoveto x[4] y[4]
tag[1] Rmoveto
tag[1] Tcursor cursor[]
tag[1] Rcursor
tag[1] Tbouncemouse x[4] y[4] button[4]
tag[1] Rbouncemouse
tag[1] Trdkbd
tag[1] Rrdkbd rune[2]
tag[1] Tlabel label[s]
tag[1] Rlabel
tag[1] Tinit winsize[s] label[s] font[s]
tag[1] Rinit
tag[1] Trdsnarf
tag[1] Rrdsnarf snarf[s]
tag[1] Twrsnarf snarf[s]
tag[1] Rwrsnarf
tag[1] Trddraw count[4]
tag[1] Rrddraw count[4] data[count]
tag[1] Twrdraw count[4] data[count]
tag[1] Rwrdraw count[4]
tag[1] Ttop
tag[1] Rtop
tag[1] Tresize rect[4*4]
tag[1] Rresize
*/
#define PUT(p, x) \
(p)[0] = ((x) >> 24)&0xFF, \
(p)[1] = ((x) >> 16)&0xFF, \
(p)[2] = ((x) >> 8)&0xFF, \
(p)[3] = (x)&0xFF
#define GET(p, x) \
((x) = (u32int)(((p)[0] << 24) | ((p)[1] << 16) | ((p)[2] << 8) | ((p)[3])))
#define PUT2(p, x) \
(p)[0] = ((x) >> 8)&0xFF, \
(p)[1] = (x)&0xFF
#define GET2(p, x) \
((x) = (((p)[0] << 8) | ((p)[1])))
enum {
Rerror = 1,
Trdmouse = 2,
Rrdmouse,
Tmoveto = 4,
Rmoveto,
Tcursor = 6,
Rcursor,
Tbouncemouse = 8,
Rbouncemouse,
Trdkbd = 10,
Rrdkbd,
Tlabel = 12,
Rlabel,
Tinit = 14,
Rinit,
Trdsnarf = 16,
Rrdsnarf,
Twrsnarf = 18,
Rwrsnarf,
Trddraw = 20,
Rrddraw,
Twrdraw = 22,
Rwrdraw,
Ttop = 24,
Rtop,
Tresize = 26,
Rresize,
Tmax,
};
enum {
MAXWMSG = 4*1024*1024
};
typedef struct Wsysmsg Wsysmsg;
struct Wsysmsg
{
uchar type;
uchar tag;
Mouse mouse;
int resized;
Cursor cursor;
int arrowcursor;
Rune rune;
char *winsize;
char *label;
char *snarf;
char *error;
uchar *data;
uint count;
Rectangle rect;
};
uint convW2M(Wsysmsg*, uchar*, uint);
uint convM2W(uchar*, uint, Wsysmsg*);
uint sizeW2M(Wsysmsg*);
int readwsysmsg(int, uchar*, uint);
int drawfcallfmt(Fmt*);
|