On Mon Oct 27 08:04:14 2025 +0000, Byeongsik Jeon wrote:
Since macdrv_ime_process_key uses OnThreadMain, the WineQueryNoPreemptWait flag is no longer needed. This was introduced in 33610da. ~~Unlike Korean keyboard, Japanese keyboard IME processing calls firstRectForCharacterRange earlier. When the Japanese keyboard response is delayed, it appears to additionally call the firstRectForCharacterRange method, which can occur after macdrv_ProcessEvents. Due to delayed query event processing, a timeout occurs. The number of firstRectForCharacterRange/query_ime_char_rect pairs differs.~~ Like other query events, this event should also be handled in OnMainThread. **Update:** Hmm... Sorry for posting that crappy interpretation. Looking more closely at the macdrv source, it seems there was an issue with the interpretation. Something must have gone wrong with the tests. There's a timing problem, but the number of firstRectForCharacterRange/query_ime_char_rect pairs matches. The conclusion seems the same, but the interpretation needs further examination.
The waitUntilQueryDone method waits for the execution of query_ime_char_rect and eventually reaches a timeout.
By OnMainThread: ``` -[WineContentView firstRectForCharacterRange:actualRange:] -[WineApplicationController waitUntilQueryDone:timeout:processEvents:] *done=0 -[WineContentView setMarkedText:selectedRange:replacementRange:] -[WineContentView firstRectForCharacterRange:actualRange:] -[WineApplicationController waitUntilQueryDone:timeout:processEvents:] *done=0 ```
By macdrv_ProcessEvents: ``` 0024:trace:ime:query_ime_char_rect win 0x10118/0x7fcbe6144260 himc 0x1011e range 0-0 0024:trace:ime:query_ime_char_rect -> range 0-0 rect (134,442)-(137,481) 0024:trace:ime:macdrv_im_set_text win 0x10118/0x7fcbe6144260 himc 0x1011e text L"n" complete 0 0024:trace:ime:query_ime_char_rect win 0x10118/0x7fcbe6144260 himc 0x1011e range 0-1 0024:trace:ime:query_ime_char_rect -> range 0-1 rect (134,442)-(137,481) ```
Without the WineQueryNoPreemptWait flag, it executes as follows: ``` -[WineContentView firstRectForCharacterRange:actualRange:] 0024:trace:ime:query_ime_char_rect win 0x10118/0x7fcbe6144260 himc 0x1011e range 0-0 0024:trace:ime:query_ime_char_rect -> range 0-0 rect (134,442)-(137,481) -[WineApplicationController waitUntilQueryDone:timeout:processEvents:] *done=1 ```