In Japanese(FE) environment, WebKit/safari cannot accept IME composition result. So many users shoud use notepad or something to enter Japanese.... (Type Japanese with notepad, copy to clipboard, and paste to Safari/WebKit) Windows+IME doesn't obey WM_KEYDOWN - WM_CHAR - WM_KEYUP sequence. At IME composition startup, WM_KEYDOWN with wParam==VK_PROCESSKEY sent without proceeding WM_CHAR/WM_KEYUP. During IME compotision, WM_KEYDOWN without WM_CHAR is sent. At candidate selection, result is sent by WM_IME_CHAR without WM_KEYDOWN/WM_KEYUP, and not WM_CHAR. At IME composition ended, WM_KEYUP without WM_KEYDOWN sent. Out-of-sequence-WM_KEY-message may takes L"\x0" to text input class, so sending form content breaks off at that L"\x0" point, as it treated as cstr-terminating. I think Apple team now implementing 'Full IME support' with Aqua theme, may be. Many FE evaluator feels Safari for Windows good and try it widely ASAP. I wish more nice WM_KEY/WM_CHAR handling model in WebViewWndProc implementation for FE envilonment. Below is sample implementation. Works almost well with floating composition window. ...works very well, nice experience. volatile LONG cIMEComposition=0; volatile LONG cWMKeyMessagesPassThruTicketCount=0; volatile LONG cWMKeyDownMessagesCountForCheckingPair=0; LRESULT CALLBACK MyWebVwWndProcW(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg){ case WM_IME_STARTCOMPOSITION: cIMEComposition++; break; case WM_IME_ENDCOMPOSITION: cIMEComposition--; if(cIMEComposition<0) cIMEComposition=0; cWMKeyDownMessagesCountForCheckingPair=0; break; case WM_IME_CHAR: cWMKeyMessagesPassThruTicketCount+=2; // 2 times... WM_KEYDOWN and WM_KEYUP PostMessageW(hwnd, WM_KEYDOWN, wParam, lParam); PostMessageW(hwnd, WM_CHAR, wParam, lParam); PostMessageW(hwnd, WM_KEYUP, wParam, lParam | 0xc0000000); return 0; case WM_KEYUP: if(!cWMKeyDownMessagesCountForCheckingPair) break; // bypass NOT paired with WM_KEYDOWN cWMKeyDownMessagesCountForCheckingPair--; if(cWMKeyDownMessagesCountForCheckingPair<0) cWMKeyDownMessagesCountForCheckingPair=0; goto L1; case WM_KEYDOWN: if(wParam==VK_PROCESSKEY) break; cWMKeyDownMessagesCountForCheckingPair++; // ----- L1: if(cIMEComposition) { // NOT bypass WM_KEY* from WM_IME_CHAR above // with this demo code, suppose WM_KEY* reach very soon after PostMessageW above if(cWMKeyMessagesPassThruTicketCount){ cWMKeyMessagesPassThruTicketCount--; if(cWMKeyMessagesPassThruTicketCount<0) cWMKeyMessagesPassThruTicketCount=0; // thru } else { break; } } // NOT IME composition mode, pass to WebVwWndProcW default: return WebVwWndProcW(hwnd,uMsg,wParam,lParam); } return DefWindowProcW(hwnd, uMsg, wParam, lParam); }
> ...works very well, nice experience. means: Safari/Webkit ...works very well with Japanese, nice experience.
Created attachment 15203 [details] spyxx log with Safari/IME. example WM sequence. Example spyxx log. With Safari, search box. Filtered by 'IME messages'+'Keyboard messages'. I typed simply 'aaa', and enter IME composition, type 'ringo' and do composition(with Space/Enter Key), and leaved IME. And typed simply 'yyy' again, and escaped Safari-window with Alt+Tab.
<rdar://problem/5231528>
This is clearly a p1, assigning to self.
errata. example below is buggy. anonymous reporter (2ch,net/software, poster ID:6tWs8t100) said comma cannot be inputed via IME. need to be fixed like this: PostMessageW(hwnd, WM_CHAR, wParam, lParam); WebVwWndProcW(hwnd, WM_KEYDOWN, 0xFFFF, lParam); PostMessageW(hwnd, WM_KEYUP, 0xFFFF, lParam | 0xc0000000);
Created attachment 15511 [details] Basic IME support
Reviewed by darin + alexey Landed r24285