XIM text always went out through imdkit's COMPOUND_TEXT converter, which already wraps every UTF-8 string in ESC%G; the UTF8_STRING negotiation, the per-client encoding list, ximtext.c's fallback and its wrapper never changed a byte on the wire. The spot location is honoured for every style now (GTK's XIM module sends it with PreeditCallbacks) and an unset focus window means the client window, as the spec says, so those clients get the popup at the caret. readattrs/place kept four transient fields to pass values between them; ximclose tore down state right before die(); the OOM passthrough context was a third policy for one small calloc where emalloc dies like everything else. Both frontends now poll for engine-owner loss only while a preedit shows instead of XIM waking on a pipe the engine had to know about; ibus stops waking five times a second when idle. keymeaningful() is the engine's own predicate. The standalone xim_test moved into the unit suite, so xim/Makefile is gone.
38 lines
982 B
C
38 lines
982 B
C
#include <stdint.h>
|
|
#include <xcb/xcb.h>
|
|
#include <xkbcommon/xkbcommon.h>
|
|
#include <xkbcommon/xkbcommon-names.h>
|
|
|
|
/* The keysym for an X core key event, with its modifier and group state. */
|
|
uint32_t
|
|
keymaplookup(struct xkb_state *state, uint8_t keycode, uint16_t corestate)
|
|
{
|
|
static const char *modname[] = {
|
|
XKB_MOD_NAME_SHIFT,
|
|
XKB_MOD_NAME_CAPS,
|
|
XKB_MOD_NAME_CTRL,
|
|
XKB_MOD_NAME_MOD1,
|
|
XKB_MOD_NAME_MOD2,
|
|
XKB_MOD_NAME_MOD3,
|
|
XKB_MOD_NAME_MOD4,
|
|
XKB_MOD_NAME_MOD5,
|
|
};
|
|
struct xkb_keymap *keymap;
|
|
xkb_mod_index_t index;
|
|
xkb_mod_mask_t mods;
|
|
int i;
|
|
|
|
keymap = xkb_state_get_keymap(state);
|
|
mods = 0;
|
|
for(i = 0; i < (int)(sizeof modname / sizeof modname[0]); i++){
|
|
if(!(corestate & (1U << i)))
|
|
continue;
|
|
index = xkb_keymap_mod_get_index(keymap, modname[i]);
|
|
if(index != XKB_MOD_INVALID)
|
|
mods |= (xkb_mod_mask_t)1 << index;
|
|
}
|
|
xkb_state_update_mask(state, mods, 0, 0, 0, 0,
|
|
(corestate >> 13) & 3);
|
|
return xkb_state_key_get_one_sym(state, keycode);
|
|
}
|