diff --git a/dlls/msctf/inputprocessor.c b/dlls/msctf/inputprocessor.c index 5115a845ba1..f1595f89e55 100644 --- a/dlls/msctf/inputprocessor.c +++ b/dlls/msctf/inputprocessor.c @@ -64,7 +64,7 @@ typedef struct tagInputProcessorProfilesSink { typedef struct tagInputProcessorProfiles { ITfInputProcessorProfiles ITfInputProcessorProfiles_iface; ITfSource ITfSource_iface; - /* const ITfInputProcessorProfileMgrVtbl *InputProcessorProfileMgrVtbl; */ + ITfInputProcessorProfileMgr ITfInputProcessorProfileMgr_iface; /* const ITfInputProcessorProfilesExVtbl *InputProcessorProfilesExVtbl; */ /* const ITfInputProcessorProfileSubstituteLayoutVtbl *InputProcessorProfileSubstituteLayoutVtbl; */ LONG refCount; @@ -171,28 +171,31 @@ static void add_userkey( REFCLSID rclsid, LANGID langid, RegCloseKey(key); } -static HRESULT WINAPI InputProcessorProfiles_QueryInterface(ITfInputProcessorProfiles *iface, REFIID iid, LPVOID *ppvOut) +static HRESULT WINAPI InputProcessorProfiles_QueryInterface(ITfInputProcessorProfiles *iface, REFIID iid, void **ppv) { InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface); - *ppvOut = NULL; if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfInputProcessorProfiles)) { - *ppvOut = &This->ITfInputProcessorProfiles_iface; + *ppv = &This->ITfInputProcessorProfiles_iface; + } + else if (IsEqualIID(iid, &IID_ITfInputProcessorProfileMgr)) + { + *ppv = &This->ITfInputProcessorProfileMgr_iface; } else if (IsEqualIID(iid, &IID_ITfSource)) { - *ppvOut = &This->ITfSource_iface; + *ppv = &This->ITfSource_iface; } - - if (*ppvOut) + else { - ITfInputProcessorProfiles_AddRef(iface); - return S_OK; + *ppv = NULL; + WARN("unsupported interface: %s\n", debugstr_guid(iid)); + return E_NOINTERFACE; } - WARN("unsupported interface: %s\n", debugstr_guid(iid)); - return E_NOINTERFACE; + ITfInputProcessorProfiles_AddRef(iface); + return S_OK; } static ULONG WINAPI InputProcessorProfiles_AddRef(ITfInputProcessorProfiles *iface) @@ -685,6 +688,114 @@ static const ITfInputProcessorProfilesVtbl InputProcessorProfilesVtbl = InputProcessorProfiles_SubstituteKeyboardLayout }; +static inline InputProcessorProfiles *impl_from_ITfInputProcessorProfileMgr(ITfInputProcessorProfileMgr *iface) +{ + return CONTAINING_RECORD(iface, InputProcessorProfiles, ITfInputProcessorProfileMgr_iface); +} + +static HRESULT WINAPI InputProcessorProfileMgr_QueryInterface(ITfInputProcessorProfileMgr *iface, REFIID riid, void **ppv) +{ + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface); + return ITfInputProcessorProfiles_QueryInterface(&This->ITfInputProcessorProfiles_iface, riid, ppv); +} + +static ULONG WINAPI InputProcessorProfileMgr_AddRef(ITfInputProcessorProfileMgr *iface) +{ + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface); + return ITfInputProcessorProfiles_AddRef(&This->ITfInputProcessorProfiles_iface); +} + +static ULONG WINAPI InputProcessorProfileMgr_Release(ITfInputProcessorProfileMgr *iface) +{ + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface); + return ITfInputProcessorProfiles_Release(&This->ITfInputProcessorProfiles_iface); +} + +static HRESULT WINAPI InputProcessorProfileMgr_ActivateProfile(ITfInputProcessorProfileMgr *iface, DWORD dwProfileType, + LANGID langid, REFCLSID clsid, REFGUID guidProfile, HKL hkl, DWORD dwFlags) +{ + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface); + FIXME("(%p)->(%d %x %s %s %p %x)\n", This, dwProfileType, langid, debugstr_guid(clsid), + debugstr_guid(guidProfile), hkl, dwFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfileMgr_DeactivateProfile(ITfInputProcessorProfileMgr *iface, DWORD dwProfileType, + LANGID langid, REFCLSID clsid, REFGUID guidProfile, HKL hkl, DWORD dwFlags) +{ + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface); + FIXME("(%p)->(%d %x %s %s %p %x)\n", This, dwProfileType, langid, debugstr_guid(clsid), + debugstr_guid(guidProfile), hkl, dwFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfileMgr_GetProfile(ITfInputProcessorProfileMgr *iface, DWORD dwProfileType, + LANGID langid, REFCLSID clsid, REFGUID guidProfile, HKL hkl, TF_INPUTPROCESSORPROFILE *pProfile) +{ + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface); + FIXME("(%p)->(%d %x %s %s %p %p)\n", This, dwProfileType, langid, debugstr_guid(clsid), + debugstr_guid(guidProfile), hkl, pProfile); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfileMgr_EnumProfiles(ITfInputProcessorProfileMgr *iface, LANGID langid, + IEnumTfInputProcessorProfiles **ppEnum) +{ + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface); + FIXME("(%p)->(%x %p)\n", This, langid, ppEnum); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfileMgr_ReleaseInputProcessor(ITfInputProcessorProfileMgr *iface, REFCLSID rclsid, + DWORD dwFlags) +{ + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface); + FIXME("(%p)->(%s %x)\n", This, debugstr_guid(rclsid), dwFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfileMgr_RegisterProfile(ITfInputProcessorProfileMgr *iface, REFCLSID rclsid, + LANGID langid, REFGUID guidProfile, const WCHAR *pchDesc, ULONG cchDesc, const WCHAR *pchIconFile, + ULONG cchFile, ULONG uIconIndex, HKL hklsubstitute, DWORD dwPreferredLayout, BOOL bEnabledByDefault, + DWORD dwFlags) +{ + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface); + FIXME("(%p)->(%s %x %s %s %d %s %u %u %p %x %x %x)\n", This, debugstr_guid(rclsid), langid, debugstr_guid(guidProfile), + debugstr_w(pchDesc), cchDesc, debugstr_w(pchIconFile), cchFile, uIconIndex, hklsubstitute, dwPreferredLayout, + bEnabledByDefault, dwFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfileMgr_UnregisterProfile(ITfInputProcessorProfileMgr *iface, REFCLSID rclsid, + LANGID langid, REFGUID guidProfile, DWORD dwFlags) +{ + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface); + FIXME("(%p)->(%s %x %s %x)\n", This, debugstr_guid(rclsid), langid, debugstr_guid(guidProfile), dwFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI InputProcessorProfileMgr_GetActiveProfile(ITfInputProcessorProfileMgr *iface, REFGUID catid, + TF_INPUTPROCESSORPROFILE *pProfile) +{ + InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface); + FIXME("(%p)->(%s %p)\n", This, debugstr_guid(catid), pProfile); + return E_NOTIMPL; +} + +static const ITfInputProcessorProfileMgrVtbl InputProcessorProfileMgrVtbl = { + InputProcessorProfileMgr_QueryInterface, + InputProcessorProfileMgr_AddRef, + InputProcessorProfileMgr_Release, + InputProcessorProfileMgr_ActivateProfile, + InputProcessorProfileMgr_DeactivateProfile, + InputProcessorProfileMgr_GetProfile, + InputProcessorProfileMgr_EnumProfiles, + InputProcessorProfileMgr_ReleaseInputProcessor, + InputProcessorProfileMgr_RegisterProfile, + InputProcessorProfileMgr_UnregisterProfile, + InputProcessorProfileMgr_GetActiveProfile +}; + /***************************************************** * ITfSource functions *****************************************************/ @@ -782,6 +893,7 @@ HRESULT InputProcessorProfiles_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut This->ITfInputProcessorProfiles_iface.lpVtbl= &InputProcessorProfilesVtbl; This->ITfSource_iface.lpVtbl = &InputProcessorProfilesSourceVtbl; + This->ITfInputProcessorProfileMgr_iface.lpVtbl = &InputProcessorProfileMgrVtbl; This->refCount = 1; This->currentLanguage = GetUserDefaultLCID(); diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c index 89d1e1a7c64..f457dbbe650 100644 --- a/dlls/msctf/tests/inputprocessor.c +++ b/dlls/msctf/tests/inputprocessor.c @@ -2186,6 +2186,18 @@ static void test_AssociateFocus(void) sink_check_ok(&test_OnPopContext,"OnPopContext"); } +static void test_QI(void) +{ + ITfInputProcessorProfileMgr *ipp_mgr; + HRESULT hres; + + /* A trivial test, probably worth moving once more will be added. */ + hres = ITfInputProcessorProfiles_QueryInterface(g_ipp, &IID_ITfInputProcessorProfileMgr, (void**)&ipp_mgr); + ok(hres == S_OK, "Could not get ITfInputProcessorProfileMgr iface: %08x\n", hres); + + ITfInputProcessorProfileMgr_Release(ipp_mgr); +} + START_TEST(inputprocessor) { if (SUCCEEDED(initialize())) @@ -2212,6 +2224,7 @@ START_TEST(inputprocessor) test_ThreadMgrUnadviseSinks(); test_UnregisterCategory(); test_Unregister(); + test_QI(); } else skip("Unable to create InputProcessor\n");