#140983 [regression]SC IME doesn't work properly and JA IME works wrong

If windows code page is 936 (simplified chinese), check IME's support of
unicode using GetProperty.
p=yokoyama, r=shanjian, sr=kin
check in for roy by shanjian
This commit is contained in:
shanjian%netscape.com 2002-05-08 20:24:55 +00:00
Родитель a91955185f
Коммит 43dfeac81f
4 изменённых файлов: 42 добавлений и 1 удалений

Просмотреть файл

@ -55,6 +55,7 @@ static PRUintn gToolkitTLSIndex = 0;
HINSTANCE nsToolkit::mDllInstance = 0;
PRBool nsToolkit::mUseImeApiW = PR_FALSE;
PRBool nsToolkit::mW2KXP_CP936 = PR_FALSE;
#ifdef MOZ_AIMM
IActiveIMMApp* nsToolkit::gAIMMApp = NULL;
@ -248,8 +249,10 @@ nsToolkit::Startup(HMODULE hModule)
// XXX Hack for stopping the crash (125573)
if (osversion.dwMajorVersion == 5 && (osversion.dwMinorVersion == 0 || osversion.dwMinorVersion == 1)) {
// "Microsoft Windows 2000 " or "Microsoft Windows XP "
if (936 == ::GetACP()) // Chinese (PRC, Singapore)
if (936 == ::GetACP()) { // Chinese (PRC, Singapore)
nsToolkit::mUseImeApiW = PR_FALSE;
nsToolkit::mW2KXP_CP936 = PR_TRUE;
}
}
}

Просмотреть файл

@ -90,6 +90,7 @@ public:
static HINSTANCE mDllInstance;
// OS flag
static PRBool mUseImeApiW;
static PRBool mW2KXP_CP936;
static void Startup(HINSTANCE hModule);
static void Shutdown();

Просмотреть файл

@ -350,6 +350,16 @@ static PRBool is_vk_down(int vk)
} \
}
#define NS_IMM_GETPROPERTY(hKL, dwIndex, dwProp) \
{ \
if (nsToolkit::gAIMMApp) \
nsToolkit::gAIMMApp->GetProperty(hKL, dwIndex, &(dwProp)); \
else { \
nsIMM& theIMM = nsIMM::LoadModule(); \
dwProp = (DWORD)theIMM.GetProperty(hKL, dwIndex); \
} \
}
#else /* !MOZ_AIMM */
#define NS_IMM_GETCOMPOSITIONSTRING(hIMC, dwIndex, pBuf, dwBufLen, compStrLen) \
@ -400,6 +410,12 @@ static PRBool is_vk_down(int vk)
theIMM.SetConversionStatus(hIMC, (lpfdwConversion), (lpfdwSentence)); \
}
#define NS_IMM_GETPROPERTY(hKL, dwIndex, dwProp) \
{ \
nsIMM& theIMM = nsIMM::LoadModule(); \
dwProp = (DWORD)theIMM.GetProperty(hKL, dwIndex); \
}
#endif /* MOZ_AIMM */
//
@ -630,6 +646,12 @@ nsWindow::nsWindow() : nsBaseWidget()
gbInitGlobalValue = TRUE;
gKeyboardLayout = GetKeyboardLayout(0);
LangIDToCP((WORD)(0x0FFFFL & (DWORD)gKeyboardLayout), gCurrentKeyboardCP);
if (nsToolkit::mW2KXP_CP936) {
DWORD imeProp = 0;
NS_IMM_GETPROPERTY(gKeyboardLayout, IGP_PROPERTY, imeProp);
nsToolkit::mUseImeApiW = (imeProp & IME_PROP_UNICODE) ? PR_TRUE : PR_FALSE;
}
//
// Reconvert message for Windows 95 / NT 4.0
@ -5427,6 +5449,11 @@ BOOL nsWindow::OnInputLangChange(HKL aHKL, LRESULT *oRetValue)
gKeyboardLayout = aHKL;
*oRetValue = LangIDToCP((WORD)((DWORD)gKeyboardLayout & 0x0FFFF),
gCurrentKeyboardCP);
if (nsToolkit::mW2KXP_CP936) {
DWORD imeProp = 0;
NS_IMM_GETPROPERTY(gKeyboardLayout, IGP_PROPERTY, imeProp);
nsToolkit::mUseImeApiW = (imeProp & IME_PROP_UNICODE) ? PR_TRUE : PR_FALSE;
}
}
ResetInputState();

Просмотреть файл

@ -84,6 +84,7 @@ class nsIMM
typedef LONG (CALLBACK *NotifyIMEPtr) (HIMC,DWORD,DWORD,DWORD);
typedef LONG (CALLBACK *SetCandWindowPtr) (HIMC,LPCANDIDATEFORM);
typedef LONG (CALLBACK *GetCompWindowPtr) (HIMC,LPCOMPOSITIONFORM);
typedef LONG (CALLBACK *GetPropertyPtr) (HKL, DWORD);
public:
@ -122,6 +123,9 @@ public:
mGetCompositionWindow=(mInstance) ? (GetCompWindowPtr)GetProcAddress(mInstance,"ImmGetCompositionWindow") : 0;
NS_ASSERTION(mGetCompositionWindow!=NULL,"nsIMM.ImmGetCompositionWindow failed.");
mGetProperty=(mInstance) ? (GetPropertyPtr)GetProcAddress(mInstance,"ImmGetProperty") : 0;
NS_ASSERTION(mGetProperty!=NULL,"nsIMM.ImmGetProperty failed.");
}
~nsIMM() {
@ -137,6 +141,7 @@ public:
mNotifyIME=0;
mSetCandiateWindow=0;
mGetCompositionWindow=0;
mGetProperty=0;
}
LONG GetCompositionStringA(HIMC h,DWORD d1,LPVOID v,DWORD d2) {
@ -175,6 +180,10 @@ public:
return (mGetCompositionWindow) ? mGetCompositionWindow(h,l) : 0L;
}
LONG GetProperty(HKL hKL, DWORD dwIndex) {
return (mGetProperty) ? mGetProperty(hKL, dwIndex) : 0L;
}
private:
HINSTANCE mInstance;
@ -187,6 +196,7 @@ private:
NotifyIMEPtr mNotifyIME;
SetCandWindowPtr mSetCandiateWindow;
GetCompWindowPtr mGetCompositionWindow;
GetPropertyPtr mGetProperty;
};
/**