engine: the one capability is a flag

Cclientpreedit was a one-bit mask that every producer set as "want ?
Cclientpreedit : 0" and every consumer masked out again; nothing else
was ever going to join it.  Keyreq carries clientpre, an int that says
whether the client draws the preedit, and the engine and the XIM
context keep it under that name.
This commit is contained in:
2026-08-17 10:57:15 +09:00
parent 33023d7f51
commit 88ad5f7630
10 changed files with 53 additions and 57 deletions

View File

@@ -437,7 +437,7 @@ nexttracecap(struct ct *t, Ximfix *f, int op, Ic *owner, int cap)
return req;
CT_EQ_INT(t, op, req.op);
CT_EQ_PTR(t, owner, req.owner);
CT_EQ_INT(t, cap, req.cap);
CT_EQ_INT(t, cap, req.clientpre);
CT_EQ_PTR(t, replyc, req.reply);
return req;
}
@@ -445,7 +445,7 @@ nexttracecap(struct ct *t, Ximfix *f, int op, Ic *owner, int cap)
static Keyreq
nexttrace(struct ct *t, Ximfix *f, int op, Ic *state)
{
return nexttracecap(t, f, op, state, state->cap);
return nexttracecap(t, f, op, state, state->clientpre);
}
static void
@@ -539,7 +539,7 @@ xim_adapter_release_lifecycle(struct ct *t)
keypress(dead, 'n', 0, &res);
nexttrace(t, &f, Keypress, dead);
CT_EQ_PTR(t, dead, testengineowner());
deadcap = dead->cap;
deadcap = dead->clientpre;
icfree(dead);
nexttracecap(t, &f, Keyrelease, dead, deadcap);
dead = nil;
@@ -654,8 +654,8 @@ xim_adapter_styles(struct ct *t)
state = icbindings[0].data;
if(!CT_CHECK(t, state != nil && state == ics))
continue;
CT_EQ_INT(t, want[i] & XCB_IM_PreeditCallbacks ? Cclientpreedit : 0,
state->cap);
CT_EQ_INT(t, want[i] & XCB_IM_PreeditCallbacks ? 1 : 0,
state->clientpre);
CT_EQ_PTR(t, ic, state->xic);
icunlink(state);
free(state);
@@ -799,7 +799,7 @@ xim_adapter_callback_replacement(struct ct *t)
ic = (xcb_im_input_context_t*)(uintptr)3;
memset(&state, 0, sizeof state);
state.xic = ic;
state.cap = Cclientpreedit;
state.clientpre = 1;
wireclear();
sinit(&pre, "k", strlen("k"));
updatepreedit(&state, &pre);
@@ -848,7 +848,7 @@ xim_adapter_callback_unicode(struct ct *t)
for(i = 0; i < nelem(text); i++){
memset(&state, 0, sizeof state);
state.xic = (xcb_im_input_context_t*)(uintptr)(10+i);
state.cap = Cclientpreedit;
state.clientpre = 1;
sinit(&pre, text[i], strlen(text[i]));
wireclear();
updatepreedit(&state, &pre);
@@ -868,7 +868,7 @@ startstate(Ic *state, xcb_im_input_context_t *ic)
memset(state, 0, sizeof *state);
state->xic = ic;
state->cap = Cclientpreedit;
state->clientpre = 1;
sinit(&pre, "", strlen(""));
updatepreedit(state, &pre);
}
@@ -896,7 +896,7 @@ xim_adapter_callback_cleanup(struct ct *t)
wireclear();
wirebind(0, ic, &state);
state.xic = ic;
state.cap = Cclientpreedit;
state.clientpre = 1;
keypress(&state, 'k', 0, &res);
nexttrace(t, &f, Keypress, &state);
keypress(&state, 'a', 0, &res);
@@ -984,7 +984,7 @@ xim_adapter_callback_transfer(struct ct *t)
goto cleanup;
wireclear();
a.xic = aic;
a.cap = Cclientpreedit;
a.clientpre = 1;
sinit(&pre, "", strlen(""));
updatepreedit(&a, &pre);
keypress(&b, 'x', 0, &res);
@@ -1021,7 +1021,7 @@ xim_adapter_callback_owner_loss(struct ct *t)
wireclear();
wirebind(0, ic, &state);
state.xic = ic;
state.cap = Cclientpreedit;
state.clientpre = 1;
keypress(&state, 'k', 0, &res);
nexttrace(t, &f, Keypress, &state);
updatepreedit(&state, &res.preedit);