ime.c (2f7775c6) ime.c (eb902e5b)
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Win32k subsystem
4 * PURPOSE: Input Method Editor and Input Method Manager support
5 * FILE: win32ss/user/ntuser/ime.c
6 * PROGRAMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7 * Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
8 */

--- 1217 unchanged lines hidden (view full) ---

1226
1227 return ObjHead;
1228}
1229
1230VOID UserFreeInputContext(PVOID Object)
1231{
1232 PTHRDESKHEAD ObjHead = Object;
1233 PDESKTOP pDesk = ObjHead->rpdesk;
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Win32k subsystem
4 * PURPOSE: Input Method Editor and Input Method Manager support
5 * FILE: win32ss/user/ntuser/ime.c
6 * PROGRAMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7 * Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
8 */

--- 1217 unchanged lines hidden (view full) ---

1226
1227 return ObjHead;
1228}
1229
1230VOID UserFreeInputContext(PVOID Object)
1231{
1232 PTHRDESKHEAD ObjHead = Object;
1233 PDESKTOP pDesk = ObjHead->rpdesk;
1234 PIMC pIMC = Object, *ppIMC;
1234 PIMC pNode, pIMC = Object;
1235 PTHREADINFO pti;
1236
1237 if (!pIMC)
1238 return;
1239
1235 PTHREADINFO pti;
1236
1237 if (!pIMC)
1238 return;
1239
1240 /* Find the IMC in the list and remove it */
1240 // Remove pIMC from the list except spDefaultImc
1241 pti = pIMC->head.pti;
1241 pti = pIMC->head.pti;
1242 for (ppIMC = &pti->spDefaultImc; *ppIMC; ppIMC = &(*ppIMC)->pImcNext)
1242 for (pNode = pti->spDefaultImc; pNode; pNode = pNode->pImcNext)
1243 {
1243 {
1244 if (*ppIMC == pIMC)
1244 if (pNode->pImcNext == pIMC)
1245 {
1245 {
1246 *ppIMC = pIMC->pImcNext;
1246 pNode->pImcNext = pIMC->pImcNext;
1247 break;
1248 }
1249 }
1250
1251 DesktopHeapFree(pDesk, Object);
1252
1253 pti->ppi->UserHandleCount--;
1254 IntDereferenceThreadInfo(pti);
1255}
1256
1257BOOLEAN UserDestroyInputContext(PVOID Object)
1258{
1259 PIMC pIMC = Object;
1260
1247 break;
1248 }
1249 }
1250
1251 DesktopHeapFree(pDesk, Object);
1252
1253 pti->ppi->UserHandleCount--;
1254 IntDereferenceThreadInfo(pti);
1255}
1256
1257BOOLEAN UserDestroyInputContext(PVOID Object)
1258{
1259 PIMC pIMC = Object;
1260
1261 if (!pIMC)
1261 if (!pIMC || !UserMarkObjectDestroy(pIMC))
1262 return TRUE;
1263
1262 return TRUE;
1263
1264 UserMarkObjectDestroy(pIMC);
1265
1266 return UserDeleteObject(UserHMGetHandle(pIMC), TYPE_INPUTCONTEXT);
1267}
1268
1264 return UserDeleteObject(UserHMGetHandle(pIMC), TYPE_INPUTCONTEXT);
1265}
1266
1269BOOL NTAPI NtUserDestroyInputContext(HIMC hIMC)
1267// Win: DestroyInputContext
1268BOOLEAN IntDestroyInputContext(PVOID Object)
1270{
1269{
1271 PIMC pIMC;
1272 BOOL ret = FALSE;
1270 PIMC pIMC = Object;
1271 HIMC hIMC = pIMC->head.h;
1272 PTHREADINFO pti = pIMC->head.pti;
1273 PWND pwndChild;
1274 PWINDOWLIST pwl;
1273 HWND *phwnd;
1274 PWND pWnd;
1275 HWND *phwnd;
1276 PWND pWnd;
1275 PWINDOWLIST pwl;
1276 PTHREADINFO pti;
1277
1277
1278 UserEnterExclusive();
1278 if (pIMC->head.pti != gptiCurrent)
1279 {
1280 EngSetLastError(ERROR_ACCESS_DENIED);
1281 return FALSE;
1282 }
1279
1283
1280 if (!IS_IMM_MODE())
1284 if (pIMC == pti->spDefaultImc)
1281 {
1285 {
1282 ERR("!IS_IMM_MODE()\n");
1283 EngSetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1284 goto Quit;
1286 EngSetLastError(ERROR_INVALID_PARAMETER);
1287 return FALSE;
1285 }
1286
1288 }
1289
1287 pIMC = UserGetObjectNoErr(gHandleTable, hIMC, TYPE_INPUTCONTEXT);
1288 if (!pIMC)
1289 goto Quit;
1290
1291 pti = pIMC->head.pti;
1292 if (pti != GetW32ThreadInfo() || pIMC == pti->spDefaultImc)
1293 goto Quit;
1294
1295 UserMarkObjectDestroy(pIMC);
1296
1297 pwl = IntBuildHwndList(pti->rpdesk->pDeskInfo->spwnd->spwndChild,
1298 IACE_CHILDREN | IACE_LIST, pti);
1290 pwndChild = pti->rpdesk->pDeskInfo->spwnd->spwndChild;
1291 pwl = IntBuildHwndList(pwndChild, IACE_LIST | IACE_CHILDREN, pti);
1299 if (pwl)
1300 {
1301 for (phwnd = pwl->ahwnd; *phwnd != HWND_TERMINATOR; ++phwnd)
1302 {
1292 if (pwl)
1293 {
1294 for (phwnd = pwl->ahwnd; *phwnd != HWND_TERMINATOR; ++phwnd)
1295 {
1303 pWnd = ValidateHwndNoErr(*phwnd);
1304 if (!pWnd)
1305 continue;
1306
1307 if (pWnd->hImc == hIMC)
1296 pWnd = UserGetObjectNoErr(gHandleTable, *phwnd, TYPE_WINDOW);
1297 if (pWnd && pWnd->hImc == hIMC)
1308 IntAssociateInputContext(pWnd, pti->spDefaultImc);
1309 }
1310
1311 IntFreeHwndList(pwl);
1312 }
1313
1298 IntAssociateInputContext(pWnd, pti->spDefaultImc);
1299 }
1300
1301 IntFreeHwndList(pwl);
1302 }
1303
1314 ret = UserDeleteObject(hIMC, TYPE_INPUTCONTEXT);
1304 UserDeleteObject(hIMC, TYPE_INPUTCONTEXT);
1305 return TRUE;
1306}
1315
1307
1308BOOL NTAPI NtUserDestroyInputContext(HIMC hIMC)
1309{
1310 BOOL ret = FALSE;
1311 PIMC pIMC;
1312
1313 UserEnterExclusive();
1314
1315 if (!IS_IMM_MODE())
1316 {
1317 EngSetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1318 goto Quit;
1319 }
1320
1321 pIMC = UserGetObjectNoErr(gHandleTable, hIMC, TYPE_INPUTCONTEXT);
1322 if (pIMC)
1323 ret = IntDestroyInputContext(pIMC);
1324
1316Quit:
1317 UserLeave();
1318 return ret;
1319}
1320
1321// Win: CreateInputContext
1322PIMC FASTCALL UserCreateInputContext(ULONG_PTR dwClientImcData)
1323{

--- 271 unchanged lines hidden ---
1325Quit:
1326 UserLeave();
1327 return ret;
1328}
1329
1330// Win: CreateInputContext
1331PIMC FASTCALL UserCreateInputContext(ULONG_PTR dwClientImcData)
1332{

--- 271 unchanged lines hidden ---