Sorry, I don't have time to look at the source
(Bright now.
(BSo here are only vague general remarks.
(B
(BXIM is designed to be created only once for an X
(Bconnection. Don't create more than one XIM
(Bnor destroy and recreate again and again.
(BXlib can be quite fragile, (especially you tried
(Bto create multiple XIM in different locales.)
(B
(BShift+Space doesn't connect/create nor disconnect/
(Bdestroy XIM. XIM servers are programmed to toggle
(Bconversion service. They are kept connected.
(B
(BMulti_Key diacritics composition is an XIM server
(Bbuilt into Xserver. Other XIM server must be
(Brunning external to Xserver process.
(B
(BXIC is designed to be created for each GC (graphic
(Bcontext). Especially, each window (widget) must
(Bhave its own input context if it expects user input.
(BThe current design of xforms is flawed that it
(Bcreates only process global XIC and tries to use it
(Bfor all widgets. Just consider the disaster it
(Bcauses if a user changes focus across windows sharing
(Bthe same input context during a conversion.
(B
(BHope some of the remarks above can be of a help.
(B
(BRegards,
(B SMiyata