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

4
ipc.h
View File

@@ -38,11 +38,13 @@ enum
Kmodfirst = Kspec|0xe1,
Kmodlast = Kspec|0xee,
/* X core modifier bits; GDK and IBus also flag Super at bit 26. */
Mshift = 1<<0,
Mctrl = 1<<2,
Malt = 1<<3,
Msuper = 1<<6,
Mmask = Mshift|Mctrl|Malt|Msuper,
Msupervirt = 1<<26,
Ipcreqsz = 6,
Ipccaretsz = 16,
@@ -70,6 +72,8 @@ struct Ipcresp
size_t preeditlen;
};
uint32_t ipckey(uint32_t, uint32_t);
uint32_t ipcmod(uint32_t);
void ipcpackreq(unsigned char[Ipcreqsz], int, uint32_t, uint32_t);
void ipcpackreset(unsigned char[Ipcreqsz], int);
void ipcpackcap(unsigned char[Ipcreqsz], int);