mirror of
https://github.com/reactos/reactos.git
synced 2025-04-04 04:26:32 +00:00
[MSCTFIME] Refactor on IMC/IMCC locking
- Rename _IMCCLock as IMCCLOCK. - Rename InternalIMCCLock as IMCCLock. - Rename _IMCLock as IMCLOCK. - Add get() pointer accessor of IMCCLock and IMCLOCK. - Protect the pointer of IMCCLOCK and IMCLOCK. CORE-19360
This commit is contained in:
parent
52bd0c0c18
commit
5197d36839
2 changed files with 32 additions and 20 deletions
|
@ -101,7 +101,7 @@ CicInputContext::GetGuidAtom(
|
|||
_In_ DWORD dwUnknown,
|
||||
_Out_opt_ LPDWORD pdwGuidAtom)
|
||||
{
|
||||
InternalIMCCLock<CTFIMECONTEXT> imeContext(imcLock.m_pIC->hCompStr);
|
||||
IMCCLock<CTFIMECONTEXT> imeContext(imcLock.get().hCompStr);
|
||||
|
||||
HRESULT hr = imeContext.m_hr;
|
||||
if (!imeContext)
|
||||
|
@ -809,17 +809,17 @@ CtfImeGetGuidAtom(
|
|||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
InternalIMCCLock<CTFIMECONTEXT> imccLock(imcLock.m_pIC->hCtfImeContext);
|
||||
IMCCLock<CTFIMECONTEXT> imccLock(imcLock.get().hCtfImeContext);
|
||||
hr = imccLock.m_hr;
|
||||
if (!imccLock)
|
||||
hr = E_FAIL;
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (!imccLock.m_pIMCC->m_pCicIC)
|
||||
if (!imccLock.get().m_pCicIC)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
hr = imccLock.m_pIMCC->m_pCicIC->GetGuidAtom(imcLock, dwUnknown, pdwGuidAtom);
|
||||
hr = imccLock.get().m_pCicIC->GetGuidAtom(imcLock, dwUnknown, pdwGuidAtom);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -842,7 +842,7 @@ CtfImeIsGuidMapEnable(
|
|||
if (!imcLock)
|
||||
hr = E_FAIL;
|
||||
if (SUCCEEDED(hr))
|
||||
ret = !!(imcLock.m_pIC->fdwInit & INIT_GUIDMAP);
|
||||
ret = !!(imcLock.get().fdwInit & INIT_GUIDMAP);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -7,20 +7,22 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
// class _IMCCLock<T_DATA>;
|
||||
// class InternalIMCCLock<T_DATA>;
|
||||
// class IMCCLOCK<T_DATA>;
|
||||
// class IMCCLock<T_DATA>;
|
||||
// class _IMCLock;
|
||||
// class IMCLock;
|
||||
|
||||
template <typename T_DATA>
|
||||
class _IMCCLock
|
||||
class IMCCLOCK
|
||||
{
|
||||
public:
|
||||
protected:
|
||||
T_DATA *m_pIMCC;
|
||||
|
||||
public:
|
||||
HIMCC m_hIMCC;
|
||||
HRESULT m_hr;
|
||||
|
||||
_IMCCLock(HIMCC hIMCC)
|
||||
IMCCLOCK(HIMCC hIMCC)
|
||||
{
|
||||
m_pIMCC = NULL;
|
||||
m_hr = S_OK;
|
||||
|
@ -29,15 +31,15 @@ public:
|
|||
};
|
||||
|
||||
template <typename T_DATA>
|
||||
class InternalIMCCLock : public _IMCCLock<T_DATA>
|
||||
class IMCCLock : public IMCCLOCK<T_DATA>
|
||||
{
|
||||
public:
|
||||
InternalIMCCLock(HIMCC hIMCC) : _IMCCLock<T_DATA>(hIMCC)
|
||||
IMCCLock(HIMCC hIMCC) : IMCCLOCK<T_DATA>(hIMCC)
|
||||
{
|
||||
if (hIMCC)
|
||||
_LockIMCC(this->m_hIMCC, &this->m_pIMCC);
|
||||
}
|
||||
~InternalIMCCLock()
|
||||
~IMCCLock()
|
||||
{
|
||||
if (this->m_pIMCC)
|
||||
_UnlockIMCC(this->m_hIMCC);
|
||||
|
@ -46,6 +48,10 @@ public:
|
|||
{
|
||||
return this->m_pIMCC;
|
||||
}
|
||||
T_DATA& get() const
|
||||
{
|
||||
return *this->m_pIMCC;
|
||||
}
|
||||
|
||||
protected:
|
||||
HRESULT _LockIMCC(HIMCC hIMCC, T_DATA **pptr)
|
||||
|
@ -63,15 +69,17 @@ protected:
|
|||
}
|
||||
};
|
||||
|
||||
class _IMCLock
|
||||
class IMCLOCK
|
||||
{
|
||||
public:
|
||||
protected:
|
||||
LPINPUTCONTEXTDX m_pIC;
|
||||
|
||||
public:
|
||||
HIMC m_hIMC;
|
||||
HRESULT m_hr;
|
||||
DWORD m_dw3;
|
||||
|
||||
_IMCLock(HIMC hIMC)
|
||||
IMCLOCK(HIMC hIMC)
|
||||
{
|
||||
m_pIC = NULL;
|
||||
m_hIMC = hIMC;
|
||||
|
@ -85,10 +93,10 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class IMCLock : public _IMCLock
|
||||
class IMCLock : public IMCLOCK
|
||||
{
|
||||
public:
|
||||
IMCLock(HIMC hIMC) : _IMCLock(hIMC)
|
||||
IMCLock(HIMC hIMC) : IMCLOCK(hIMC)
|
||||
{
|
||||
m_hr = _LockIMC(hIMC, &m_pIC);
|
||||
}
|
||||
|
@ -111,11 +119,11 @@ public:
|
|||
if (ImmGetIMCCSize(m_pIC->hCompStr) < sizeof(COMPOSITIONSTRING))
|
||||
return FALSE;
|
||||
|
||||
InternalIMCCLock<COMPOSITIONSTRING> imccLock(m_pIC->hCompStr);
|
||||
IMCCLock<COMPOSITIONSTRING> imccLock(m_pIC->hCompStr);
|
||||
if (!imccLock)
|
||||
return FALSE;
|
||||
|
||||
return imccLock.m_pIMCC->dwCompStrLen > 0;
|
||||
return imccLock.get().dwCompStrLen > 0;
|
||||
}
|
||||
|
||||
BOOL UseVerticalCompWindow() const
|
||||
|
@ -127,6 +135,10 @@ public:
|
|||
{
|
||||
return m_pIC;
|
||||
}
|
||||
INPUTCONTEXTDX& get() const
|
||||
{
|
||||
return *m_pIC;
|
||||
}
|
||||
|
||||
protected:
|
||||
HRESULT _LockIMC(HIMC hIMC, LPINPUTCONTEXTDX *ppIC)
|
||||
|
|
Loading…
Reference in a new issue