Blob
1 /* Copyright (c) 2006 Russ Cox */3 /*5 tag[1] Rerror error[s]7 tag[1] Trdmouse8 tag[1] Rrdmouse x[4] y[4] button[4] msec[4] resized[1]10 tag[1] Tmoveto x[4] y[4]11 tag[1] Rmoveto13 tag[1] Tcursor cursor[]14 tag[1] Rcursor16 tag[1] Tcursor2 cursor[]17 tag[1] Rcursor219 tag[1] Tbouncemouse x[4] y[4] button[4]20 tag[1] Rbouncemouse22 tag[1] Trdkbd23 tag[1] Rrdkbd rune[2]25 tag[1] Tlabel label[s]26 tag[1] Rlabel28 tag[1] Tinit winsize[s] label[s] font[s]29 tag[1] Rinit31 tag[1] Trdsnarf32 tag[1] Rrdsnarf snarf[s]34 tag[1] Twrsnarf snarf[s]35 tag[1] Rwrsnarf37 tag[1] Trddraw count[4]38 tag[1] Rrddraw count[4] data[count]40 tag[1] Twrdraw count[4] data[count]41 tag[1] Rwrdraw count[4]43 tag[1] Ttop44 tag[1] Rtop46 tag[1] Tresize rect[4*4]47 tag[1] Rresize48 */51 #define PUT(p, x) \52 (p)[0] = ((x) >> 24)&0xFF, \53 (p)[1] = ((x) >> 16)&0xFF, \54 (p)[2] = ((x) >> 8)&0xFF, \55 (p)[3] = (x)&0xFF57 #define GET(p, x) \58 ((x) = (u32int)(((p)[0] << 24) | ((p)[1] << 16) | ((p)[2] << 8) | ((p)[3])))60 #define PUT2(p, x) \61 (p)[0] = ((x) >> 8)&0xFF, \62 (p)[1] = (x)&0xFF64 #define GET2(p, x) \65 ((x) = (((p)[0] << 8) | ((p)[1])))67 enum {68 Rerror = 1,69 Trdmouse = 2,70 Rrdmouse,71 Tmoveto = 4,72 Rmoveto,73 Tcursor = 6,74 Rcursor,75 Tbouncemouse = 8,76 Rbouncemouse,77 Trdkbd = 10,78 Rrdkbd,79 Tlabel = 12,80 Rlabel,81 Tinit = 14,82 Rinit,83 Trdsnarf = 16,84 Rrdsnarf,85 Twrsnarf = 18,86 Rwrsnarf,87 Trddraw = 20,88 Rrddraw,89 Twrdraw = 22,90 Rwrdraw,91 Ttop = 24,92 Rtop,93 Tresize = 26,94 Rresize,95 Tcursor2 = 28,96 Rcursor2,97 Tmax,98 };100 enum {101 MAXWMSG = 4*1024*1024102 };104 typedef struct Wsysmsg Wsysmsg;105 struct Wsysmsg106 {107 uchar type;108 uchar tag;109 Mouse mouse;110 int resized;111 Cursor cursor;112 Cursor2 cursor2;113 int arrowcursor;114 Rune rune;115 char *winsize;116 char *label;117 char *snarf;118 char *error;119 uchar *data;120 uint count;121 Rectangle rect;122 };124 uint convW2M(Wsysmsg*, uchar*, uint);125 uint convM2W(uchar*, uint, Wsysmsg*);126 uint sizeW2M(Wsysmsg*);127 int readwsysmsg(int, uchar*, uint);129 int drawfcallfmt(Fmt*);