Blob


1 /* Copyright (c) 2006 Russ Cox */
3 /*
5 tag[1] Rerror error[s]
7 tag[1] Trdmouse
8 tag[1] Rrdmouse x[4] y[4] button[4] msec[4] resized[1]
10 tag[1] Tmoveto x[4] y[4]
11 tag[1] Rmoveto
13 tag[1] Tcursor cursor[]
14 tag[1] Rcursor
16 tag[1] Tcursor2 cursor[]
17 tag[1] Rcursor2
19 tag[1] Tbouncemouse x[4] y[4] button[4]
20 tag[1] Rbouncemouse
22 tag[1] Trdkbd
23 tag[1] Rrdkbd rune[2]
25 tag[1] Tlabel label[s]
26 tag[1] Rlabel
28 tag[1] Tctxt wsysid[s]
29 tag[1] Rctxt
31 tag[1] Tinit winsize[s] label[s] font[s]
32 tag[1] Rinit
34 tag[1] Trdsnarf
35 tag[1] Rrdsnarf snarf[s]
37 tag[1] Twrsnarf snarf[s]
38 tag[1] Rwrsnarf
40 tag[1] Trddraw count[4]
41 tag[1] Rrddraw count[4] data[count]
43 tag[1] Twrdraw count[4] data[count]
44 tag[1] Rwrdraw count[4]
46 tag[1] Ttop
47 tag[1] Rtop
49 tag[1] Tresize rect[4*4]
50 tag[1] Rresize
51 */
54 #define PUT(p, x) \
55 (p)[0] = ((x) >> 24)&0xFF, \
56 (p)[1] = ((x) >> 16)&0xFF, \
57 (p)[2] = ((x) >> 8)&0xFF, \
58 (p)[3] = (x)&0xFF
60 #define GET(p, x) \
61 ((x) = (u32int)(((p)[0] << 24) | ((p)[1] << 16) | ((p)[2] << 8) | ((p)[3])))
63 #define PUT2(p, x) \
64 (p)[0] = ((x) >> 8)&0xFF, \
65 (p)[1] = (x)&0xFF
67 #define GET2(p, x) \
68 ((x) = (((p)[0] << 8) | ((p)[1])))
70 enum {
71 Rerror = 1,
72 Trdmouse = 2,
73 Rrdmouse,
74 Tmoveto = 4,
75 Rmoveto,
76 Tcursor = 6,
77 Rcursor,
78 Tbouncemouse = 8,
79 Rbouncemouse,
80 Trdkbd = 10,
81 Rrdkbd,
82 Tlabel = 12,
83 Rlabel,
84 Tinit = 14,
85 Rinit,
86 Trdsnarf = 16,
87 Rrdsnarf,
88 Twrsnarf = 18,
89 Rwrsnarf,
90 Trddraw = 20,
91 Rrddraw,
92 Twrdraw = 22,
93 Rwrdraw,
94 Ttop = 24,
95 Rtop,
96 Tresize = 26,
97 Rresize,
98 Tcursor2 = 28,
99 Rcursor2,
100 Tctxt = 30,
101 Rctxt,
102 Tmax,
103 };
105 enum {
106 MAXWMSG = 4*1024*1024
107 };
109 typedef struct Wsysmsg Wsysmsg;
110 struct Wsysmsg
112 uchar type;
113 uchar tag;
114 Mouse mouse;
115 int resized;
116 Cursor cursor;
117 Cursor2 cursor2;
118 int arrowcursor;
119 Rune rune;
120 char *winsize;
121 char *label;
122 char *snarf;
123 char *error;
124 char *id;
125 uchar *data;
126 uint count;
127 Rectangle rect;
128 };
130 uint convW2M(Wsysmsg*, uchar*, uint);
131 uint convM2W(uchar*, uint, Wsysmsg*);
132 uint sizeW2M(Wsysmsg*);
133 int readwsysmsg(int, uchar*, uint);
135 int drawfcallfmt(Fmt*);