ref: 6101cdddfc46943fefce89a02ebcb1be54457dcf
parent: e153011a788a20522317155016d2bdccc85760eb
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Feb 24 20:00:44 EST 2020
plan9: disable compose mode after Alt has been pressed
--- a/plan9.c
+++ b/plan9.c
@@ -1080,12 +1080,13 @@
kbdproc(void *cchan)
{
char buf[128], buf2[128], *s;
- int kfd, n;
+ int kfd, n, kbin;
Rune r;
threadsetname("kbdproc");
if ((kfd = open("/dev/kbd", OREAD)) < 0)
sysfatal("/dev/kbd: %r");
+ kbin = open("/dev/kbin", OWRITE);
buf2[0] = 0;
buf2[1] = 0;
@@ -1116,6 +1117,9 @@
s += chartorune(&r, s);
if (utfrune(buf2+1, r) == nil) {
if (r == Kalt) {
+ /* magic trick: write Alt scancode to disable the "compose" mode */
+ if (kbin >= 0)
+ write(kbin, "\x46", 1);
altdown = true;
} else if (r == Kshift) {
shiftdown = true;