We need to copy the string allocated from winex11 to some memory that is accessible to the win32 side. EM_REPLACESEL does that already and using WM_IME_INTERNAL we would have to add more code to do the same thing.
OK, thanks for the answer.
I'm not sure to understand what you mean by invalid? get_focus could return a different window than the one which received the input event and I think we should follow X11 target window. Especially as I think that ultimately input events should be listened to in a separate thread.
The reason I said invalid is because the hwnd in the xic callback is not the hwnd stored with IMMGWL_IMC. But it's OK, because ime_ui_wndow_proc will use the correct hwnd value. In my old personal code, I used the value received by ImeSetActiveContext.
How about in a Win32 -> X11 situation? This is the situation with the POC patch "Use NtUserGetAncestor() for the foreign window in X11DRV_get_ic()".