ipc: share one keysym and modifier mapping across frontends

The keysym-to-engine-key rule lived in ibus.c, xim/xim.c and gtk/main.c,
and the copies disagreed: GTK sent keypad digits as special keys while
IBus and XIM sent '1'..'9'. Modifiers were rebuilt bit by bit in two
places although Mmask already is the X core layout; only the virtual
Super bit (26) that GDK and IBus set needs folding. ipckey/ipcmod in
ipc.c serve the daemon, the module and the tests.
This commit is contained in:
2026-08-16 15:47:47 +09:00
parent 66ea2892f8
commit 43b469f70b
6 changed files with 49 additions and 76 deletions

View File

@@ -249,12 +249,6 @@ out:
return ok;
}
static u32int
kget(uint8_t kc, u16int state)
{
return keymaplookup(kstate, kc, state);
}
static xcb_screen_t*
getscreen(int scr)
{
@@ -466,7 +460,7 @@ sendrequest(Ic *state, int op, u32int key, u32int mod, Keyres *res)
kr.cap = state->cap;
kr.op = op;
kr.ks = key;
kr.mod = mod & Mmask;
kr.mod = ipcmod(mod);
kr.caret = state->caret;
kr.reply = replyc;
chansend(keyc, &kr);
@@ -557,17 +551,11 @@ kpress(Ic *state, xcb_key_press_event_t *ev)
{
Keyres res;
char buf[Maxutf];
u32int key, rune;
u32int key;
int n, wasvalid;
key = kget(ev->detail, ev->state);
rune = xkb_keysym_to_utf32(key);
if(rune >= ' ' && rune != 0x7f)
key = rune;
else if(key >= 0xff00 && key <= 0xffff)
key = Kspec + (key - 0xff00);
else
key = rune;
key = keymaplookup(kstate, ev->detail, ev->state);
key = ipckey(key, xkb_keysym_to_utf32(key));
if(meaningful(key)){
wasvalid = state->caret.valid;
refreshplace(state);