00036 {
00037 HIMC hIMC =
ImmGetContext(hWnd);
00038
PIMEDPI pImeDpi =
ImmLockImeDpi(hkl);
00039
DWORD dwReturn = 0;
00040
#if DBG
00041
if (dwHotKeyID >= IME_KHOTKEY_FIRST && dwHotKeyID <= IME_KHOTKEY_LAST) {
00042 TAGMSG2(DBGTAG_IMM,
"ImmProcessKey: Kor IME Hotkeys should not come here: dwHotKeyID=%x, uVKey=%x", dwHotKeyID, uVKey);
00043 }
00044
#endif
00045
00046
ImmAssert(dwHotKeyID != IME_KHOTKEY_ENGLISH &&
00047 dwHotKeyID != IME_KHOTKEY_SHAPE_TOGGLE &&
00048 dwHotKeyID != IME_KHOTKEY_HANJACONVERT);
00049
00050
00051
00052
00053
if (pImeDpi !=
NULL) {
00054 PINPUTCONTEXT pInputContext =
ImmLockIMC(hIMC);
00055
00056
if (pInputContext !=
NULL) {
00057 BOOLEAN fTruncateWideVK =
FALSE;
00058 BOOLEAN fCallIme =
TRUE;
00059 BOOLEAN fSkipThisKey =
FALSE;
00060
00061
#ifdef LATER
00062
00063
00064
00065
00066
00067
00068
00069
if ((pImeDpi->fdwProperty & IME_PROP_NO_KEYS_ON_CLOSE) &&
00070 !pInputContext->fOpen &&
00071 uVKey != VK_SHIFT &&
00072 uVKey != VK_CONTROL &&
00073 uVKey != VK_CAPITAL &&
00074 uVKey != VK_KANA &&
00075 uVKey != VK_NUMLOCK &&
00076 uVKey != VK_SCROLL) {
00077
00078
if(!(pimc->fdwConvMode & IME_CMODE_HANJACONVERT)) {
00079 fCallIme =
FALSE;
00080 }
00081 }
00082
else
00083
#endif
00084
00085
00086
00087
if ((
BYTE)uVKey == VK_PACKET &&
00088 (pImeDpi->
ImeInfo.fdwProperty & IME_PROP_ACCEPT_WIDE_VKEY) == 0) {
00089
00090
if (pImeDpi->
ImeInfo.fdwProperty & IME_PROP_UNICODE) {
00091
00092
00093
00094
00095 fTruncateWideVK =
TRUE;
00096 }
00097
else {
00098
00099
00100
00101
00102
00103
00104 fCallIme =
FALSE;
00105
if (pInputContext->fOpen) {
00106 fSkipThisKey =
TRUE;
00107 }
00108 }
00109 }
00110
00111
if (fCallIme) {
00112
PBYTE pbKeyState = (
PBYTE)
ImmLocalAlloc(0, 256);
00113
00114
ImmAssert(fSkipThisKey == FALSE);
00115
00116
if (pbKeyState !=
NULL) {
00117
if (
GetKeyboardState(pbKeyState)) {
00118
UINT uVKeyIme = uVKey;
00119
if (fTruncateWideVK) {
00120 uVKeyIme &= 0xffff;
00121 }
00122
if ( (*pImeDpi->
pfn.
ImeProcessKey)(hIMC, uVKeyIme, lParam, pbKeyState) ) {
00123
00124
00125
00126
00127
00128 pInputContext->fChgMsg =
TRUE;
00129 pInputContext->uSavedVKey = uVKey;
00130 dwReturn |=
IPHK_PROCESSBYIME;
00131 }
00132 }
00133
ImmLocalFree(pbKeyState);
00134 }
00135 }
00136
else if (fSkipThisKey) {
00137 dwReturn |= IPHK_SKIPTHISKEY;
00138
ImmAssert((dwReturn & (IPHK_PROCESSBYIME | IPHK_HOTKEY)) == 0);
00139 }
00140
ImmUnlockIMC(hIMC);
00141 }
00142
ImmUnlockImeDpi(pImeDpi);
00143 }
00144
00145
00146
00147
00148
if (dwHotKeyID != IME_INVALID_HOTKEY &&
HotKeyIDDispatcher(hWnd, hIMC, hkl, dwHotKeyID)) {
00149
00150
00151
if ((uVKey != VK_KANJI) ||
00152 (dwHotKeyID != IME_JHOTKEY_CLOSE_OPEN)) {
00153 dwReturn |=
IPHK_HOTKEY;
00154 }
00155 }
00156
00157
00158
00159
00160
00161
if (dwReturn &
IPHK_PROCESSBYIME) {
00162
00163
DWORD dwImeCompat =
ImmGetAppCompatFlags(hIMC);
00164
00165
if (dwImeCompat & IMECOMPAT_NOVKPROCESSKEY) {
00166
00167
00168
00169
00170
if ( PRIMARYLANGID(LANGIDFROMLCID(GetSystemDefaultLCID())) == LANG_KOREAN &&
00171 ( (uVKey == VK_PROCESSKEY) || (dwReturn &
IPHK_HOTKEY) ) ) {
00172
ImmReleaseContext(hWnd, hIMC);
00173
return dwReturn;
00174 }
00175
00176
ImmTranslateMessage(hWnd, WM_KEYDOWN, VK_PROCESSKEY, lParam);
00177 dwReturn &= ~
IPHK_PROCESSBYIME;
00178 dwReturn |= IPHK_SKIPTHISKEY;
00179 }
00180 }
00181
ImmReleaseContext(hWnd, hIMC);
00182
00183
return dwReturn;
00184 }