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

10
xim.c
View File

@@ -16,7 +16,7 @@
/*
* One XIM input context. Only PreeditCallbacks clients draw the preedit
* themselves (cap); the popup shows it for the others. engaged means the
* themselves (clientpre); the popup shows it for the others. engaged means the
* engine has seen a real key from this context and owes it a release.
*/
typedef struct Ic Ic;
@@ -26,7 +26,7 @@ struct Ic
xcb_im_input_context_t *xic;
xcb_im_client_t *client;
int engaged;
int cap;
int clientpre;
int prestarted;
int nprerune;
Caret caret;
@@ -255,7 +255,7 @@ updatepreedit(Ic *state, Str *pre)
size_t nwire;
int i, nbyte;
if(!(state->cap & Cclientpreedit))
if(!state->clientpre)
return;
if(pre->n == 0){
clearpreedit(state);
@@ -291,7 +291,7 @@ sendrequest(Ic *state, int op, u32int key, u32int mod, Keyres *res)
memset(&kr, 0, sizeof kr);
kr.owner = state;
kr.cap = state->cap;
kr.clientpre = state->clientpre;
kr.op = op;
kr.ks = key;
kr.mod = ipcmod(mod);
@@ -471,7 +471,7 @@ iccreate(xcb_im_client_t *client, xcb_im_input_context_t *ic)
state->xic = ic;
state->client = client;
if(xcb_im_input_context_get_input_style(ic) & XCB_IM_PreeditCallbacks)
state->cap = Cclientpreedit;
state->clientpre = 1;
state->next = ics;
ics = state;
xcb_im_input_context_set_data(ic, state, icfree);