xim: drop what no client uses; poll for owner loss like IBus
XIM text always went out through imdkit's COMPOUND_TEXT converter, which already wraps every UTF-8 string in ESC%G; the UTF8_STRING negotiation, the per-client encoding list, ximtext.c's fallback and its wrapper never changed a byte on the wire. The spot location is honoured for every style now (GTK's XIM module sends it with PreeditCallbacks) and an unset focus window means the client window, as the spec says, so those clients get the popup at the caret. readattrs/place kept four transient fields to pass values between them; ximclose tore down state right before die(); the OOM passthrough context was a third policy for one small calloc where emalloc dies like everything else. Both frontends now poll for engine-owner loss only while a preedit shows instead of XIM waking on a pipe the engine had to know about; ibus stops waking five times a second when idle. keymeaningful() is the engine's own predicate. The standalone xim_test moved into the unit suite, so xim/Makefile is gone.
This commit is contained in:
19
strans.c
19
strans.c
@@ -438,6 +438,13 @@ ismodkey(u32int ks)
|
||||
return ks >= Kmodfirst && ks <= Kmodlast;
|
||||
}
|
||||
|
||||
/* Modifier presses and unmapped keys never engage the engine. */
|
||||
int
|
||||
keymeaningful(u32int ks)
|
||||
{
|
||||
return ks != 0 && !ismodkey(ks);
|
||||
}
|
||||
|
||||
static void
|
||||
foldascii(Str *s)
|
||||
{
|
||||
@@ -765,12 +772,6 @@ init(void)
|
||||
memset(&lastdraw, 0, sizeof lastdraw);
|
||||
}
|
||||
|
||||
static int
|
||||
meaningful(Keyreq *kr)
|
||||
{
|
||||
return kr->ks != 0 && !ismodkey(kr->ks);
|
||||
}
|
||||
|
||||
/*
|
||||
* The engine belongs to whichever context last typed a real key; only
|
||||
* the owner's requests change state. Every request ends in redraw(),
|
||||
@@ -780,9 +781,7 @@ static void
|
||||
imhandlekey(Keyreq *kr)
|
||||
{
|
||||
Keyres res;
|
||||
void *oldowner;
|
||||
|
||||
oldowner = activeowner;
|
||||
sclear(&res.commit);
|
||||
sclear(&res.preedit);
|
||||
res.eaten = 1;
|
||||
@@ -811,7 +810,7 @@ imhandlekey(Keyreq *kr)
|
||||
res.eaten = 0;
|
||||
if(activeowner != nil && kr->owner == activeowner)
|
||||
activecap = kr->cap & Cclientpreedit;
|
||||
if(meaningful(kr)){
|
||||
if(keymeaningful(kr->ks)){
|
||||
if(kr->owner != activeowner){
|
||||
reset();
|
||||
activeowner = kr->owner;
|
||||
@@ -824,8 +823,6 @@ imhandlekey(Keyreq *kr)
|
||||
break;
|
||||
}
|
||||
redraw();
|
||||
if(activeowner != oldowner)
|
||||
ximownernotify();
|
||||
if(kr->owner == activeowner){
|
||||
if(search.lang)
|
||||
res.preedit = search.text;
|
||||
|
||||
Reference in New Issue
Block a user