diff options
author | Russ Cox <rsc@swtch.com> | 2020-05-18 23:45:03 -0400 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2020-05-18 23:45:03 -0400 |
commit | d25d0ca1a3682d97df67f62789767562aa5bf1b3 (patch) | |
tree | 95e736b3189ffd5dbb74fb74c41eb8ac450de8f5 /src/cmd/devdraw | |
parent | b4cc38f94321c71e8d19fbbd4691e72f7c0d817b (diff) | |
download | plan9port-d25d0ca1a3682d97df67f62789767562aa5bf1b3.tar.gz plan9port-d25d0ca1a3682d97df67f62789767562aa5bf1b3.tar.bz2 plan9port-d25d0ca1a3682d97df67f62789767562aa5bf1b3.zip |
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.
Diffstat (limited to 'src/cmd/devdraw')
-rw-r--r-- | src/cmd/devdraw/mklatinkbd.c | 2 | ||||
-rw-r--r-- | src/cmd/devdraw/srv.c | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/cmd/devdraw/mklatinkbd.c b/src/cmd/devdraw/mklatinkbd.c index db34b6ec..50dd26b0 100644 --- a/src/cmd/devdraw/mklatinkbd.c +++ b/src/cmd/devdraw/mklatinkbd.c @@ -191,7 +191,7 @@ readfile(char *fname) r = strtol(line, nil, 16); p = strchr(line, ' '); - if(r == 0 || p != line+4 || p[0] != ' ' || p[1] != ' ') { + if(r == 0 || (p != line+4 && p != line+5) || p[0] != ' ' || (p == line+4 && p[1] != ' ')) { fprint(2, "%s:%d: cannot parse line\n", fname, lineno); continue; } 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++]; |