On Sat Oct 25 13:09:04 2025 +0000, Marc-Aurel Zent wrote:
I looked inside the OnMainThread, and perhaps there might be an error
in my reply. I'll describe the problematic situation: Should be fixed with the latest version. It is indeed as you already found an issue with the order of operations with the `IM_SET_TEXT` call. I added `macdrv_ProcessEvents(QS_POSTMESSAGE | QS_SENDMESSAGE)`, which makes this MR equivalent to the previous version, but still feels noticeably better. Regarding Japanese IME, there are many issues with it currently unfortunately, but these are probably best tackled in different MRs...
In addition to this MR, I tested whether it's possible to drop the
IM_SET_TEXT code. It's a proof-of-concept patch and needs cleanup. It seems to work well, including the issue posted above. Thanks for this, I don't think changing the signature of `ImeProcessKey()` is something we can do, but getting rid of some of these events if possible would be nicer indeed (or just making macdrv event handling much faster in general).
After examining macdrv_ProcessEvents and NtUserMsgWaitForMultipleObjectsEx, I finally understand the meaning of your comment in !9246. Thank you.
Since NSTextInputContext handleEvent operates synchronously, IM_SET_TEXT can also be removed. The provided POC patch is poorly written in many places. I'm embarrassed. If implemented, I believe we could receive the hwnd via macdrv_ime_process_key. Something like ‘struct ime_result’. But it's not strictly necessary at this point.
Patch v2 appears to work fine with the Korean keyboard. In my opinion, the Japanese keyboard issue should also be resolved in this MR to avoid regression. The current state is that Japanese sentence input is very slow. This happens frequently because the ‘RETURN’ key is used as the commit key.