https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e0da6437a1f2d6aefb1bc…
commit e0da6437a1f2d6aefb1bcdae69f00ac57944ea6f
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Sep 21 12:20:10 2021 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Sep 21 12:20:10 2021 +0900
[IMM32] Define ImeDpi_IsUnicode macro and use it (#3964)
- Define ImeDpi_IsUnicode macro in precomp.h.
- Use it.
CORE-11700
---
dll/win32/imm32/ime.c | 18 ++++++------------
dll/win32/imm32/keymsg.c | 4 ++--
dll/win32/imm32/precomp.h | 2 ++
dll/win32/imm32/regword.c | 16 ++++++++--------
4 files changed, 18 insertions(+), 22 deletions(-)
diff --git a/dll/win32/imm32/ime.c b/dll/win32/imm32/ime.c
index 75f538c5c91..b06afb628da 100644
--- a/dll/win32/imm32/ime.c
+++ b/dll/win32/imm32/ime.c
@@ -681,7 +681,7 @@ LRESULT WINAPI ImmEscapeA(HKL hKL, HIMC hIMC, UINT uSubFunc, LPVOID
lpData)
if (!pImeDpi)
return 0;
- if (!(pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE) || !lpData)
+ if (!ImeDpi_IsUnicode(pImeDpi) || !lpData)
{
ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
ImmUnlockImeDpi(pImeDpi);
@@ -769,7 +769,7 @@ LRESULT WINAPI ImmEscapeW(HKL hKL, HIMC hIMC, UINT uSubFunc, LPVOID
lpData)
if (!pImeDpi)
return 0;
- if ((pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE) || !lpData)
+ if (ImeDpi_IsUnicode(pImeDpi) || !lpData)
{
ret = ImeDpi_Escape(pImeDpi, hIMC, uSubFunc, lpData, hKL);
ImmUnlockImeDpi(pImeDpi);
@@ -1199,7 +1199,7 @@ ImmGetConversionListA(HKL hKL, HIMC hIMC, LPCSTR pSrc,
LPCANDIDATELIST lpDst,
if (pImeDpi == NULL)
return 0;
- if (!(pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE))
+ if (!ImeDpi_IsUnicode(pImeDpi))
{
ret = pImeDpi->ImeConversionList(hIMC, pSrc, lpDst, dwBufLen, uFlag);
ImmUnlockImeDpi(pImeDpi);
@@ -1254,7 +1254,7 @@ ImmGetConversionListW(HKL hKL, HIMC hIMC, LPCWSTR pSrc,
LPCANDIDATELIST lpDst,
if (!pImeDpi)
return 0;
- if (pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE)
+ if (ImeDpi_IsUnicode(pImeDpi))
{
ret = pImeDpi->ImeConversionList(hIMC, pSrc, lpDst, dwBufLen, uFlag);
ImmUnlockImeDpi(pImeDpi);
@@ -1395,11 +1395,8 @@ BOOL WINAPI ImmConfigureIMEA(HKL hKL, HWND hWnd, DWORD dwMode,
LPVOID lpData)
RtlZeroMemory(&RegWordW, sizeof(RegWordW));
- if (!(pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE) || !lpData ||
- dwMode != IME_CONFIG_REGISTERWORD)
- {
+ if (!ImeDpi_IsUnicode(pImeDpi) || !lpData || dwMode != IME_CONFIG_REGISTERWORD)
goto DoIt;
- }
pRegWordA = lpData;
@@ -1452,11 +1449,8 @@ BOOL WINAPI ImmConfigureIMEW(HKL hKL, HWND hWnd, DWORD dwMode,
LPVOID lpData)
RtlZeroMemory(&RegWordA, sizeof(RegWordA));
- if ((pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE) || !lpData ||
- dwMode != IME_CONFIG_REGISTERWORD)
- {
+ if (ImeDpi_IsUnicode(pImeDpi) || !lpData || dwMode != IME_CONFIG_REGISTERWORD)
goto DoIt;
- }
pRegWordW = lpData;
diff --git a/dll/win32/imm32/keymsg.c b/dll/win32/imm32/keymsg.c
index 69a26aed9be..6fe90bd26a2 100644
--- a/dll/win32/imm32/keymsg.c
+++ b/dll/win32/imm32/keymsg.c
@@ -371,7 +371,7 @@ ImmProcessKey(HWND hWnd, HKL hKL, UINT vKey, LPARAM lParam, DWORD
dwHotKeyID)
if (LOBYTE(vKey) == VK_PACKET &&
!(pImeDpi->ImeInfo.fdwProperty & IME_PROP_ACCEPT_WIDE_VKEY))
{
- if (pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE)
+ if (ImeDpi_IsUnicode(pImeDpi))
{
bLowWordOnly = TRUE;
}
@@ -633,7 +633,7 @@ BOOL WINAPI ImmTranslateMessage(HWND hwnd, UINT msg, WPARAM wParam,
LPARAM lKeyD
vk = pIC->nVKey;
if (pImeDpi->ImeInfo.fdwProperty & IME_PROP_KBD_CHAR_FIRST)
{
- if (pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE)
+ if (ImeDpi_IsUnicode(pImeDpi))
{
wch = 0;
kret = ToUnicode(vk, HIWORD(lKeyData), abKeyState, &wch, 1, 0);
diff --git a/dll/win32/imm32/precomp.h b/dll/win32/imm32/precomp.h
index ecd05ca85f0..2c82e5b3746 100644
--- a/dll/win32/imm32/precomp.h
+++ b/dll/win32/imm32/precomp.h
@@ -93,6 +93,8 @@ static inline BOOL Imm32IsCrossProcessAccess(HWND hWnd)
(DWORD_PTR)NtCurrentTeb()->ClientId.UniqueProcess);
}
+#define ImeDpi_IsUnicode(pImeDpi) ((pImeDpi)->ImeInfo.fdwProperty &
IME_PROP_UNICODE)
+
DWORD APIENTRY
CandidateListWideToAnsi(const CANDIDATELIST *pWideCL, LPCANDIDATELIST pAnsiCL, DWORD
dwBufLen,
UINT uCodePage);
diff --git a/dll/win32/imm32/regword.c b/dll/win32/imm32/regword.c
index 8d9fa43fa3e..cf038a2edcc 100644
--- a/dll/win32/imm32/regword.c
+++ b/dll/win32/imm32/regword.c
@@ -106,7 +106,7 @@ ImmEnumRegisterWordA(HKL hKL, REGISTERWORDENUMPROCA lpfnEnumProc,
if (!pImeDpi)
return 0;
- if (!(pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE))
+ if (!ImeDpi_IsUnicode(pImeDpi))
{
ret = pImeDpi->ImeEnumRegisterWord(lpfnEnumProc, lpszReading, dwStyle,
lpszRegister, lpData);
@@ -162,7 +162,7 @@ ImmEnumRegisterWordW(HKL hKL, REGISTERWORDENUMPROCW lpfnEnumProc,
if (!pImeDpi)
return 0;
- if (pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE)
+ if (ImeDpi_IsUnicode(pImeDpi))
{
ret = pImeDpi->ImeEnumRegisterWord(lpfnEnumProc, lpszReading, dwStyle,
lpszRegister, lpData);
@@ -216,7 +216,7 @@ UINT WINAPI ImmGetRegisterWordStyleA(HKL hKL, UINT nItem, LPSTYLEBUFA
lpStyleBuf
if (!pImeDpi)
return 0;
- if (!(pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE))
+ if (!ImeDpi_IsUnicode(pImeDpi))
{
ret = pImeDpi->ImeGetRegisterWordStyle(nItem, lpStyleBuf);
goto Quit;
@@ -274,7 +274,7 @@ UINT WINAPI ImmGetRegisterWordStyleW(HKL hKL, UINT nItem, LPSTYLEBUFW
lpStyleBuf
if (!pImeDpi)
return 0;
- if (pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE)
+ if (ImeDpi_IsUnicode(pImeDpi))
{
ret = pImeDpi->ImeGetRegisterWordStyle(nItem, lpStyleBuf);
goto Quit;
@@ -330,7 +330,7 @@ ImmRegisterWordA(HKL hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR
lpszRegister
if (!pImeDpi)
return FALSE;
- if (!(pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE))
+ if (!ImeDpi_IsUnicode(pImeDpi))
{
ret = pImeDpi->ImeRegisterWord(lpszReading, dwStyle, lpszRegister);
ImmUnlockImeDpi(pImeDpi);
@@ -377,7 +377,7 @@ ImmRegisterWordW(HKL hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR
lpszRegist
if (!pImeDpi)
return FALSE;
- if (pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE)
+ if (ImeDpi_IsUnicode(pImeDpi))
{
ret = pImeDpi->ImeRegisterWord(lpszReading, dwStyle, lpszRegister);
ImmUnlockImeDpi(pImeDpi);
@@ -424,7 +424,7 @@ ImmUnregisterWordA(HKL hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR
lpszUnregi
if (pImeDpi == NULL)
return FALSE;
- if (!(pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE))
+ if (!ImeDpi_IsUnicode(pImeDpi))
{
ret = pImeDpi->ImeUnregisterWord(lpszReading, dwStyle, lpszUnregister);
ImmUnlockImeDpi(pImeDpi);
@@ -471,7 +471,7 @@ ImmUnregisterWordW(HKL hKL, LPCWSTR lpszReading, DWORD dwStyle,
LPCWSTR lpszUnre
if (!pImeDpi)
return FALSE;
- if (pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE)
+ if (ImeDpi_IsUnicode(pImeDpi))
{
ret = pImeDpi->ImeUnregisterWord(lpszReading, dwStyle, lpszUnregister);
ImmUnlockImeDpi(pImeDpi);