Module: wine Branch: master Commit: 4fb6c01453494122671df56a2d48ad9b9722b4be URL: http://source.winehq.org/git/wine.git/?a=commit;h=4fb6c01453494122671df56a2d...
Author: Aric Stewart aric@codeweavers.com Date: Mon Feb 23 14:22:38 2009 -0600
msctf: Use ITfCategoryMgr::FindClosestCategory to set catid when enuming language profiles.
---
dlls/msctf/inputprocessor.c | 18 +++++++++++++++++- dlls/msctf/tests/inputprocessor.c | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/dlls/msctf/inputprocessor.c b/dlls/msctf/inputprocessor.c index de39af9..7df5575 100644 --- a/dlls/msctf/inputprocessor.c +++ b/dlls/msctf/inputprocessor.c @@ -72,6 +72,7 @@ typedef struct tagEnumTfLanguageProfiles { DWORD lang_index;
LANGID langid; + ITfCategoryMgr *catmgr; } EnumTfLanguageProfiles;
static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut); @@ -670,6 +671,7 @@ static void EnumTfLanguageProfiles_Destructor(EnumTfLanguageProfiles *This) RegCloseKey(This->tipkey); if (This->langkey) RegCloseKey(This->langkey); + ITfCategoryMgr_Release(This->catmgr); HeapFree(GetProcessHeap(),0,This); }
@@ -746,6 +748,9 @@ static INT next_LanguageProfile(EnumTfLanguageProfiles *This, CLSID clsid, TF_LA
if (tflp) { + static const GUID * tipcats[3] = { &GUID_TFCAT_TIP_KEYBOARD, + &GUID_TFCAT_TIP_SPEECH, + &GUID_TFCAT_TIP_HANDWRITING }; res = CLSIDFromString(profileid, &profile); if (FAILED(res)) return 0;
@@ -754,7 +759,10 @@ static INT next_LanguageProfile(EnumTfLanguageProfiles *This, CLSID clsid, TF_LA /* FIXME */ tflp->fActive = FALSE; tflp->guidProfile = profile; - /* FIXME set catid */ + if (ITfCategoryMgr_FindClosestCategory(This->catmgr, &clsid, + &tflp->catid, tipcats, 3) != S_OK) + ITfCategoryMgr_FindClosestCategory(This->catmgr, &clsid, + &tflp->catid, NULL, 0); }
return 1; @@ -865,6 +873,7 @@ static const IEnumTfLanguageProfilesVtbl IEnumTfLanguageProfiles_Vtbl ={
static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguageProfiles **ppOut) { + HRESULT hr; EnumTfLanguageProfiles *This;
This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(EnumTfLanguageProfiles)); @@ -875,6 +884,13 @@ static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguage This->refCount = 1; This->langid = langid;
+ hr = CategoryMgr_Constructor(NULL,(IUnknown**)&This->catmgr); + if (FAILED(hr)) + { + HeapFree(GetProcessHeap(),0,This); + return hr; + } + if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szwSystemTIPKey, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &This->tipkey, NULL) != ERROR_SUCCESS) return E_FAIL; diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c index 2d32413..d689034 100644 --- a/dlls/msctf/tests/inputprocessor.c +++ b/dlls/msctf/tests/inputprocessor.c @@ -115,7 +115,7 @@ static void test_EnumLanguageProfiles(void) { found = TRUE; ok(profile.langid == gLangid, "LangId Incorrect\n"); - todo_wine ok(IsEqualGUID(&profile.catid,&GUID_TFCAT_TIP_KEYBOARD), "CatId Incorrect\n"); + ok(IsEqualGUID(&profile.catid,&GUID_TFCAT_TIP_KEYBOARD), "CatId Incorrect\n"); ok(IsEqualGUID(&profile.guidProfile,&CLSID_FakeService), "guidProfile Incorrect\n"); } }