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] Tctxt wsysid[s]29 tag[1] Rctxt31 tag[1] Tinit winsize[s] label[s] font[s]32 tag[1] Rinit34 tag[1] Trdsnarf35 tag[1] Rrdsnarf snarf[s]37 tag[1] Twrsnarf snarf[s]38 tag[1] Rwrsnarf40 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] Ttop47 tag[1] Rtop49 tag[1] Tresize rect[4*4]50 tag[1] Rresize51 */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)&0xFF60 #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)&0xFF67 #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*1024107 };109 typedef struct Wsysmsg Wsysmsg;110 struct Wsysmsg111 {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*);