3194 3195 BOOL AwtToolkit::TICloseTouchInputHandle(HTOUCHINPUT hTouchInput) { 3196 if (m_pCloseTouchInputHandle == NULL) { 3197 return FALSE; 3198 } 3199 return m_pCloseTouchInputHandle(hTouchInput); 3200 } 3201 3202 /* 3203 * The fuction intended for access to an IME API. It posts IME message to the queue and 3204 * waits untill the message processing is completed. 3205 * 3206 * On Windows 10 the IME may process the messages send via SenMessage() from other threads 3207 * when the IME is called by TranslateMessage(). This may cause an reentrancy issue when 3208 * the windows procedure processing the sent message call an IME function and leaves 3209 * the IME functionality in an unexpected state. 3210 * This function avoids reentrancy issue and must be used for sending of all IME messages 3211 * instead of SendMessage(). 3212 */ 3213 LRESULT AwtToolkit::InvokeInputMethodFunction(UINT msg, WPARAM wParam, LPARAM lParam) { 3214 CriticalSection::Lock lock(m_inputMethodLock); 3215 if (PostMessage(msg, wParam, lParam)) { 3216 ::WaitForSingleObject(m_inputMethodWaitEvent, INFINITE); 3217 return m_inputMethodData; 3218 } 3219 return 0; 3220 } | 3194 3195 BOOL AwtToolkit::TICloseTouchInputHandle(HTOUCHINPUT hTouchInput) { 3196 if (m_pCloseTouchInputHandle == NULL) { 3197 return FALSE; 3198 } 3199 return m_pCloseTouchInputHandle(hTouchInput); 3200 } 3201 3202 /* 3203 * The fuction intended for access to an IME API. It posts IME message to the queue and 3204 * waits untill the message processing is completed. 3205 * 3206 * On Windows 10 the IME may process the messages send via SenMessage() from other threads 3207 * when the IME is called by TranslateMessage(). This may cause an reentrancy issue when 3208 * the windows procedure processing the sent message call an IME function and leaves 3209 * the IME functionality in an unexpected state. 3210 * This function avoids reentrancy issue and must be used for sending of all IME messages 3211 * instead of SendMessage(). 3212 */ 3213 LRESULT AwtToolkit::InvokeInputMethodFunction(UINT msg, WPARAM wParam, LPARAM lParam) { 3214 /* 3215 * DND runs on the main thread. So it is necessary to use SendMessage() to call an IME 3216 * function once the DND is active; otherwise a hang is possible since DND may wait for 3217 * the IME completion. 3218 */ 3219 if (isInDoDragDropLoop) { 3220 return SendMessage(msg, wParam, lParam); 3221 } else { 3222 CriticalSection::Lock lock(m_inputMethodLock); 3223 if (PostMessage(msg, wParam, lParam)) { 3224 ::WaitForSingleObject(m_inputMethodWaitEvent, INFINITE); 3225 return m_inputMethodData; 3226 } 3227 return 0; 3228 } 3229 } 3230 |