Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

conime.c

Go to the documentation of this file.
00001 /**************************************************************************\ 00002 * Module Name: conime.c 00003 * 00004 * Copyright (c) 1985 - 1999, Microsoft Corporation 00005 * 00006 * client side receiveing stubs 00007 * 00008 * History: 00009 * 19-Sep-1995 v-HirShi Created 00010 * 12-Jun-1996 v-HirShi Attached to SUR 00011 \**************************************************************************/ 00012 #include "precomp.h" 00013 #pragma hdrstop 00014 00015 #define GUI_VKEY_MASK (0x00ff) 00016 00017 DWORD 00018 ImmProcessKey( 00019 HWND hWnd, 00020 HKL hkl, 00021 UINT uVKey, 00022 LPARAM lParam, 00023 DWORD dwHotKeyID 00024 ) ; 00025 00026 BOOL 00027 ImmSetActiveContext( 00028 HWND hWnd, 00029 HIMC hIMC, 00030 BOOL fFlag 00031 ) ; 00032 00033 DWORD 00034 ImmCallImeConsoleIME( 00035 HWND hWnd, 00036 UINT Message, 00037 WPARAM wParam, 00038 LPARAM lParam, 00039 PUINT puVKey 00040 ) 00041 /*++ 00042 00043 Routine Description: 00044 00045 Called by Console IME to convert Character 00046 This routine copy from user\kernel\ntimm.c :: xxxImmProcessKey 00047 for Console IME could not calls kernel function. 00048 00049 Arguments: 00050 00051 Return Value: 00052 --*/ 00053 { 00054 DWORD dwReturn ; 00055 PIMC pImc ; 00056 HIMC hImc ; 00057 BOOL fDBERoman ; 00058 PWND pwnd ; 00059 PIMEDPI pImeDpi; 00060 HKL hkl ; 00061 00062 dwReturn = 0; 00063 pImc = NULL; 00064 fDBERoman = FALSE; 00065 00066 // 00067 // we're interested in only keyboard messages. 00068 // 00069 if ( Message != WM_KEYDOWN && 00070 Message != WM_SYSKEYDOWN && 00071 Message != WM_KEYUP && 00072 Message != WM_SYSKEYUP ) { 00073 00074 return dwReturn; 00075 } 00076 00077 hkl = GetKeyboardLayout( GetWindowThreadProcessId(hWnd, NULL) ); 00078 pwnd = ValidateHwnd(hWnd); 00079 if ( pwnd == NULL) { 00080 return dwReturn; 00081 } 00082 hImc = ImmGetContext(hWnd); 00083 if ( hImc == NULL_HIMC ){ 00084 return dwReturn; 00085 } 00086 00087 *puVKey = (UINT)wParam & GUI_VKEY_MASK; 00088 00089 // 00090 // Check input context 00091 // 00092 pImc = HMValidateHandle((HANDLE)hImc, TYPE_INPUTCONTEXT); 00093 if ( pImc == NULL ) { 00094 return dwReturn; 00095 } 00096 00097 #ifdef LATER 00098 // 00099 // If there is an easy way to check the input context open/close status 00100 // from the kernel side, IME_PROP_NO_KEYS_ON_CLOSE checking should be 00101 // done here in kernel side. [ 3/10/96 takaok] 00102 // 00103 00104 // 00105 // Check IME_PROP_NO_KEYS_ON_CLOSE bit 00106 // 00107 // if the current imc is not open and IME doesn't need 00108 // keys when being closed, we don't pass any keyboard 00109 // input to ime except hotkey and keys that change 00110 // the keyboard status. 00111 // 00112 if ( (piix->ImeInfo.fdwProperty & IME_PROP_NO_KEYS_ON_CLOSE) && 00113 (!pimc->fdwState & IMC_OPEN) && 00114 uVKey != VK_SHIFT && // 0x10 00115 uVKey != VK_CONTROL && // 0x11 00116 uVKey != VK_CAPITAL && // 0x14 00117 uVKey != VK_KANA && // 0x15 00118 uVKey != VK_NUMLOCK && // 0x90 00119 uVKey != VK_SCROLL ) // 0x91 00120 { 00121 // Check if Korea Hanja conversion mode 00122 if( !(pimc->fdwConvMode & IME_CMODE_HANJACONVERT) ) { 00123 return dwReturn; 00124 } 00125 } 00126 #endif 00127 00128 // 00129 // if the IME doesn't need key up messages, we don't call ime. 00130 // 00131 pImeDpi = ImmLockImeDpi(hkl); 00132 if ( pImeDpi == NULL ) { 00133 return dwReturn; 00134 } 00135 00136 if ( lParam & 0x80000000 && // set if key up, clear if key down 00137 pImeDpi->ImeInfo.fdwProperty & IME_PROP_IGNORE_UPKEYS ) 00138 { 00139 return dwReturn; 00140 } 00141 00142 // 00143 // we don't want to handle sys keys since many functions for 00144 // acceelerators won't work without this 00145 // 00146 fDBERoman = (BOOL)( (*puVKey == VK_DBE_ROMAN) || 00147 (*puVKey == VK_DBE_NOROMAN) || 00148 (*puVKey == VK_DBE_HIRAGANA) || 00149 (*puVKey == VK_DBE_KATAKANA) || 00150 (*puVKey == VK_DBE_CODEINPUT) || 00151 (*puVKey == VK_DBE_NOCODEINPUT) || 00152 (*puVKey == VK_DBE_IME_WORDREGISTER) || 00153 (*puVKey == VK_DBE_IME_DIALOG) ); 00154 00155 if (Message == WM_SYSKEYDOWN || Message == WM_SYSKEYUP ) { 00156 // 00157 // IME may be waiting for VK_MENU, VK_F10 or VK_DBE_xxx 00158 // 00159 if ( *puVKey != VK_MENU && *puVKey != VK_F10 && !fDBERoman ) { 00160 return dwReturn; 00161 } 00162 } 00163 00164 // 00165 // check if the IME doesn't need ALT key 00166 // 00167 00168 if ( !(pImeDpi->ImeInfo.fdwProperty & IME_PROP_NEED_ALTKEY) ) { 00169 // 00170 // IME doesn't need ALT key 00171 // 00172 // we don't pass the ALT and ALT+xxx except VK_DBE_xxx keys. 00173 // 00174 if ( ! fDBERoman && 00175 (*puVKey == VK_MENU || (lParam & 0x20000000)) // KF_ALTDOWN 00176 ) 00177 { 00178 return dwReturn; 00179 } 00180 } 00181 00182 00183 dwReturn = ImmProcessKey(hWnd, hkl, *puVKey, lParam, IME_INVALID_HOTKEY ) ; 00184 return dwReturn; 00185 } 00186 00187 BOOL 00188 ImmSetActiveContextConsoleIME( 00189 HWND hWnd, 00190 BOOL fFlag 00191 ) 00192 00193 /*++ 00194 00195 Routine Description: 00196 00197 Set this context as active one. 00198 00199 Arguments: 00200 00201 hWnd - the get focus window 00202 fFlag - get focus or kill focus 00203 00204 Return Value: 00205 00206 --*/ 00207 00208 { 00209 HIMC hImc; 00210 00211 hImc = ImmGetContext(hWnd) ; 00212 if (hImc == NULL_HIMC) { 00213 return FALSE; 00214 } 00215 return(ImmSetActiveContext(hWnd, hImc, fFlag)) ; 00216 00217 } 00218

Generated on Sat May 15 19:39:33 2004 for test by doxygen 1.3.7