From d25d0ca1a3682d97df67f62789767562aa5bf1b3 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 18 May 2020 23:45:03 -0400 Subject: 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. --- src/cmd/devdraw/srv.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/cmd/devdraw/srv.c') diff --git a/src/cmd/devdraw/srv.c b/src/cmd/devdraw/srv.c index bdfc1654..05a08fda 100644 --- a/src/cmd/devdraw/srv.c +++ b/src/cmd/devdraw/srv.c @@ -229,6 +229,7 @@ runmsg(Client *c, Wsysmsg *m) break; case Trdkbd: + case Trdkbd4: qlock(&c->eventlk); if((c->kbdtags.wi+1)%nelem(c->kbdtags.t) == c->kbdtags.ri) { qunlock(&c->eventlk); @@ -236,7 +237,7 @@ runmsg(Client *c, Wsysmsg *m) replyerror(c, m); break; } - c->kbdtags.t[c->kbdtags.wi++] = m->tag; + c->kbdtags.t[c->kbdtags.wi++] = (m->tag<<1) | (m->type==Trdkbd4); if(c->kbdtags.wi == nelem(c->kbdtags.t)) c->kbdtags.wi = 0; c->kbd.stall = 0; @@ -357,13 +358,17 @@ replymsg(Client *c, Wsysmsg *m) static void matchkbd(Client *c) { + int tag; Wsysmsg m; if(c->kbd.stall) return; while(c->kbd.ri != c->kbd.wi && c->kbdtags.ri != c->kbdtags.wi){ + tag = c->kbdtags.t[c->kbdtags.ri++]; m.type = Rrdkbd; - m.tag = c->kbdtags.t[c->kbdtags.ri++]; + if(tag&1) + m.type = Rrdkbd4; + m.tag = tag>>1; if(c->kbdtags.ri == nelem(c->kbdtags.t)) c->kbdtags.ri = 0; m.rune = c->kbd.r[c->kbd.ri++]; -- cgit v1.2.3