Blob
- Date:
- Message:
- devdraw, libdraw: handle keyboard runes > U+FFFF Runes in Plan 9 were limited to the 16-bit BMP when I drew up the RPC protocol between graphical programs and devdraw a long time ago. Now that they can be 32-bit, use a 32-bit wire encoding too. A new message number to avoid problems with other clients (like 9fans.net/go). Add keyboard shortcut alt : , for U+1F602, face with tears of joy, to test that it all works.
- Actions:
- History | Blame | Raw File
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] Trdkbd426 tag[1] Rrdkbd4 rune[4]28 tag[1] Tlabel label[s]29 tag[1] Rlabel31 tag[1] Tctxt wsysid[s]32 tag[1] Rctxt34 tag[1] Tinit winsize[s] label[s] font[s]35 tag[1] Rinit37 tag[1] Trdsnarf38 tag[1] Rrdsnarf snarf[s]40 tag[1] Twrsnarf snarf[s]41 tag[1] Rwrsnarf43 tag[1] Trddraw count[4]44 tag[1] Rrddraw count[4] data[count]46 tag[1] Twrdraw count[4] data[count]47 tag[1] Rwrdraw count[4]49 tag[1] Ttop50 tag[1] Rtop52 tag[1] Tresize rect[4*4]53 tag[1] Rresize54 */57 #define PUT(p, x) \58 (p)[0] = ((x) >> 24)&0xFF, \59 (p)[1] = ((x) >> 16)&0xFF, \60 (p)[2] = ((x) >> 8)&0xFF, \61 (p)[3] = (x)&0xFF63 #define GET(p, x) \64 ((x) = (u32int)(((p)[0] << 24) | ((p)[1] << 16) | ((p)[2] << 8) | ((p)[3])))66 #define PUT2(p, x) \67 (p)[0] = ((x) >> 8)&0xFF, \68 (p)[1] = (x)&0xFF70 #define GET2(p, x) \71 ((x) = (((p)[0] << 8) | ((p)[1])))73 enum {74 Rerror = 1,75 Trdmouse = 2,76 Rrdmouse,77 Tmoveto = 4,78 Rmoveto,79 Tcursor = 6,80 Rcursor,81 Tbouncemouse = 8,82 Rbouncemouse,83 Trdkbd = 10,84 Rrdkbd,85 Tlabel = 12,86 Rlabel,87 Tinit = 14,88 Rinit,89 Trdsnarf = 16,90 Rrdsnarf,91 Twrsnarf = 18,92 Rwrsnarf,93 Trddraw = 20,94 Rrddraw,95 Twrdraw = 22,96 Rwrdraw,97 Ttop = 24,98 Rtop,99 Tresize = 26,100 Rresize,101 Tcursor2 = 28,102 Rcursor2,103 Tctxt = 30,104 Rctxt,105 Trdkbd4 = 32,106 Rrdkbd4,107 Tmax,108 };110 enum {111 MAXWMSG = 4*1024*1024112 };114 typedef struct Wsysmsg Wsysmsg;115 struct Wsysmsg116 {117 uchar type;118 uchar tag;119 Mouse mouse;120 int resized;121 Cursor cursor;122 Cursor2 cursor2;123 int arrowcursor;124 Rune rune;125 char *winsize;126 char *label;127 char *snarf;128 char *error;129 char *id;130 uchar *data;131 uint count;132 Rectangle rect;133 };135 uint convW2M(Wsysmsg*, uchar*, uint);136 uint convM2W(uchar*, uint, Wsysmsg*);137 uint sizeW2M(Wsysmsg*);138 int readwsysmsg(int, uchar*, uint);140 int drawfcallfmt(Fmt*);