IME own candidate window, strange behaviour

Hello,

currently im using the windows IME api in c# to receive the candidate list and render it with unity ui, which works grea.
But if I want to select a candidate from the UI through clicking the mode from chinese switches to english, which is not an expected behaviour.
See here
yjglkr

Im just setting the unity window and register the delegate, so I can receive on WndProc the messages and act on certain messages.

hWndPtr = NativeWindow.GetForegroundWindow();
newWndProc = new WndProcDelegate(WndProc);
newWndProcPtr = Marshal.GetFunctionPointerForDelegate(newWndProc);
oldWndProcPtr = NativeWindow.SetWindowLongPtr(hWndPtr, GWL_WNDPROC, newWndProcPtr);

Does anyone ever had this issue ?

Since there is not much information about ime and unity…imma push this thread

I appreciate any help!

It also would help if someone could tell me what unity is natively doin with IME. Even if I create a own input field(code vice) clicking while choosing a candidate disables the ime. It also would be interesting what Input.imeComposition under the hood is doing. Just some snippets of source code or the functions unity is calling would help.