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

@@ -46,6 +46,18 @@ ipc_masks_modifiers(struct ct *t)
CT_EQ_UINT(t, 0, mod);
CT_EQ_UINT(t, 0, key);
CT_CHECK(t, ipcreqreset(buf));
/* Frontends share one keysym and modifier mapping. */
CT_EQ_UINT(t, 'a', ipckey('a', 'a'));
CT_EQ_UINT(t, '1', ipckey(0xffb1, '1')); /* KP_1 */
CT_EQ_UINT(t, Kret, ipckey(0xff0d, '\r'));
CT_EQ_UINT(t, Kback, ipckey(0xff08, 8));
CT_EQ_UINT(t, Kspec + 0xff, ipckey(0xffff, 0x7f)); /* Delete */
CT_EQ_UINT(t, 0x1f642, ipckey(0x101f642, 0x1f642));
CT_EQ_UINT(t, 0, ipckey(0xfe03, 0)); /* ISO_Level3_Shift */
CT_EQ_UINT(t, Mshift|Mctrl, ipcmod(Mshift|Mctrl|(1<<1)|(1<<4)));
CT_EQ_UINT(t, Msuper, ipcmod(1<<6));
CT_EQ_UINT(t, Msuper, ipcmod(1<<26));
}
void