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:
25
ipc.c
25
ipc.c
@@ -223,6 +223,31 @@ Bad:
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Engine key for an X keysym and its Unicode value: printable characters
|
||||
* as themselves, the function keysyms 0xff00-0xffff as Kspec+offset.
|
||||
*/
|
||||
uint32_t
|
||||
ipckey(uint32_t sym, uint32_t unicode)
|
||||
{
|
||||
if(unicode >= ' ' && unicode != 0x7f)
|
||||
return unicode;
|
||||
if(sym >= 0xff00 && sym <= 0xffff)
|
||||
return Kspec + (sym - 0xff00);
|
||||
return unicode;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ipcmod(uint32_t state)
|
||||
{
|
||||
uint32_t m;
|
||||
|
||||
m = state & Mmask;
|
||||
if(state & Msupervirt)
|
||||
m |= Msuper;
|
||||
return m;
|
||||
}
|
||||
|
||||
void
|
||||
ipcpackreq(unsigned char req[Ipcreqsz], int want, uint32_t mod,
|
||||
uint32_t key)
|
||||
|
||||
Reference in New Issue
Block a user