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] Tbouncemouse x[4] y[4] button[4]17 tag[1] Rbouncemouse19 tag[1] Trdkbd20 tag[1] Rrdkbd rune[2]22 tag[1] Tlabel label[s]23 tag[1] Rlabel25 tag[1] Tinit winsize[s] label[s] font[s]26 tag[1] Rinit28 tag[1] Trdsnarf29 tag[1] Rrdsnarf snarf[s]31 tag[1] Twrsnarf snarf[s]32 tag[1] Rwrsnarf34 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] Ttop41 tag[1] Rtop43 tag[1] Tresize rect[4*4]44 tag[1] Rresize45 */47 AUTOLIB(draw)49 #define PUT(p, x) \50 (p)[0] = ((x) >> 24)&0xFF, \51 (p)[1] = ((x) >> 16)&0xFF, \52 (p)[2] = ((x) >> 8)&0xFF, \53 (p)[3] = (x)&0xFF55 #define GET(p, x) \56 ((x) = (((p)[0] << 24) | ((p)[1] << 16) | ((p)[2] << 8) | ((p)[3])))58 #define PUT2(p, x) \59 (p)[0] = ((x) >> 8)&0xFF, \60 (p)[1] = (x)&0xFF62 #define GET2(p, x) \63 ((x) = (((p)[0] << 8) | ((p)[1])))65 enum {66 Rerror = 1,67 Trdmouse = 2,68 Rrdmouse,69 Tmoveto = 4,70 Rmoveto,71 Tcursor = 6,72 Rcursor,73 Tbouncemouse = 8,74 Rbouncemouse,75 Trdkbd = 10,76 Rrdkbd,77 Tlabel = 12,78 Rlabel,79 Tinit = 14,80 Rinit,81 Trdsnarf = 16,82 Rrdsnarf,83 Twrsnarf = 18,84 Rwrsnarf,85 Trddraw = 20,86 Rrddraw,87 Twrdraw = 22,88 Rwrdraw,89 Ttop = 24,90 Rtop,91 Tresize = 26,92 Rresize,93 Tmax,94 };96 enum {97 MAXWMSG = 4*1024*102498 };100 typedef struct Wsysmsg Wsysmsg;101 struct Wsysmsg102 {103 uchar type;104 uchar tag;105 Mouse mouse;106 int resized;107 Cursor cursor;108 int arrowcursor;109 Rune rune;110 char *winsize;111 char *label;112 char *snarf;113 char *error;114 uchar *data;115 uint count;116 Rectangle rect;117 };119 uint convW2M(Wsysmsg*, uchar*, uint);120 uint convM2W(uchar*, uint, Wsysmsg*);121 uint sizeW2M(Wsysmsg*);122 int readwsysmsg(int, uchar*, uint);124 int drawfcallfmt(Fmt*);