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] Tbouncemouse x[4] y[4] button[4]
17 tag[1] Rbouncemouse
19 tag[1] Trdkbd
20 tag[1] Rrdkbd rune[2]
22 tag[1] Tlabel label[s]
23 tag[1] Rlabel
25 tag[1] Tinit winsize[s] label[s] font[s]
26 tag[1] Rinit
28 tag[1] Trdsnarf
29 tag[1] Rrdsnarf snarf[s]
31 tag[1] Twrsnarf snarf[s]
32 tag[1] Rwrsnarf
34 tag[1] Trddraw count[4]
35 tag[1] Rrddraw count[4] data[count]
37 tag[1] Twrdraw count[4] data[count]
38 tag[1] Rwrdraw count[4]
40 tag[1] Ttop
41 tag[1] Rtop
43 tag[1] Tresize rect[4*4]
44 tag[1] Rresize
45 */
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
54 #define GET(p, x) \
55 ((x) = (u32int)(((p)[0] << 24) | ((p)[1] << 16) | ((p)[2] << 8) | ((p)[3])))
57 #define PUT2(p, x) \
58 (p)[0] = ((x) >> 8)&0xFF, \
59 (p)[1] = (x)&0xFF
61 #define GET2(p, x) \
62 ((x) = (((p)[0] << 8) | ((p)[1])))
64 enum {
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 };
95 enum {
96 MAXWMSG = 4*1024*1024
97 };
99 typedef struct Wsysmsg Wsysmsg;
100 struct Wsysmsg
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 };
118 uint convW2M(Wsysmsg*, uchar*, uint);
119 uint convM2W(uchar*, uint, Wsysmsg*);
120 uint sizeW2M(Wsysmsg*);
121 int readwsysmsg(int, uchar*, uint);
123 int drawfcallfmt(Fmt*);