XIM: Conveying cursor/preedit area in on-the-spot mode.
XIM currently does not have a way for a client to convey the location of the preedit/cursor area to the IM server in the OnTheSpot mode. Modern input methods on X11 use this information by default with their own toolkit integration modules, and make their own candidate window placement decisions. XIM was originally specified such that the client and the server would mutually negotiate locations and sizes the status/preedit areas, through a process called geometry negotiation; however I have found very little documentation, and zero examples, of to what this entailed. It is almost entirely glossed over in the XIM docbook docs and assorted Xt/CDE documentation that mention it. The closest I've seen is clients unilaterally suggesting a status window area (in status attrs) and preedit window area (when the PreeditArea
style is enabled). Neither fcitx nor ibus even support the PreeditArea
style. Fcitx's XIM frontend advertises StatusArea
in OverTheSpot
but doesn't actually read the status attrs ever. ibus doesn't advertise StatusArea
or PreeditArea
in any mode, and never looks at the status attrs.
Currently libx11 blocks clients from setting the XNArea
attribute in OnTheSpot mode.
My initial proposal, which may or may not be the right way to go ultimately, is to allow XNArea
to be set XIM clients in OnTheSpot mode (that is, when using PreeditCallbacks
), with the idea being that it follows the original purpose of this attribute in the other modes, and meets current expectations.
One reason for this idea is that I have read most publicly available code that mentions XNArea
in this context, and either it is not sent in OnTheSpot mode, or the toolkit/application attempts to send it, and means for it to work the way that I'm suggesting.
My analysis so far indicates that allowing XNArea
to be set while OnTheSpot
, just as we do with XNSpotLocation
would:
- Not break existing clients, even in a harmless way
- Not break existing servers (which don't even look at
XNArea
ever in any mode right now) - Suddenly cause some existing clients to start working as expected, when they update libx11 and their IM server
The Fcitx author/maintainer Weng Xuetian has indicated that he is willing to accept the change to enable this in Fcitx's XIM frontend if a patch for this is accepted in libx11, and I think that it would also be welcome in ibus at that point; these are effectively the only XIM servers in current use as far as I can tell, and for both of them the patch to enable this behavior is trivial (I already have it working).