An IBus client throws away a dead key its engine did not take — the GTK module's own comment says so, and Qt does the same — so é and ü were lost in every IBus application, while XIM composed them with a table of its own. That table moves to compose.c, which both frontends now use; xim.c is the shorter for it. A finished sequence is text, not a key: the engine is asked to hand back what it had pending, and the composed text follows it, so the composed character can no longer land before the syllable typed before it.
68 lines
982 B
C
68 lines
982 B
C
#include "dat.h"
|
|
#include "fn.h"
|
|
|
|
Channel *drawc;
|
|
Channel *keyc;
|
|
|
|
void
|
|
usage(void)
|
|
{
|
|
fprint(2, "usage: strans mapdir\n");
|
|
threadexitsall("usage");
|
|
}
|
|
|
|
void
|
|
die(char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
|
|
fprint(2, "strans: ");
|
|
va_start(ap, fmt);
|
|
vfprint(2, fmt, ap);
|
|
va_end(ap);
|
|
fprint(2, "\n");
|
|
threadexitsall("die");
|
|
}
|
|
|
|
void*
|
|
emalloc(ulong n)
|
|
{
|
|
void *p;
|
|
|
|
p = mallocz(n, 1);
|
|
if(p == nil)
|
|
die("out of memory");
|
|
return p;
|
|
}
|
|
|
|
void*
|
|
erealloc(void *p, ulong n)
|
|
{
|
|
p = realloc(p, n);
|
|
if(p == nil)
|
|
die("out of memory");
|
|
return p;
|
|
}
|
|
|
|
void
|
|
threadmain(int argc, char **argv)
|
|
{
|
|
char *display;
|
|
|
|
if(argc != 2)
|
|
usage();
|
|
|
|
drawc = chancreate(sizeof(Drawcmd), 4);
|
|
keyc = chancreate(sizeof(Keyreq), 0);
|
|
langinit(argv[1]);
|
|
composeinit();
|
|
srvinit();
|
|
proccreate(drawthread, nil, 16384);
|
|
proccreate(srvthread, nil, 16384);
|
|
proccreate(ibusthread, nil, 32768);
|
|
display = getenv("DISPLAY");
|
|
if(display != nil && display[0] != '\0')
|
|
proccreate(ximthread, nil, 32768);
|
|
imthread(nil);
|
|
}
|