IME input processing
Only impact Simplified Chinese Windows.
/r=shanjian, /sr=brendan
This commit is contained in:
yokoyama%netscape.com 2002-06-07 21:44:08 +00:00
Родитель 5b462b6aaf
Коммит 372740a4e8
2 изменённых файлов: 31 добавлений и 22 удалений

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

@ -777,6 +777,7 @@ nsWindow::nsWindow() : nsBaseWidget()
mIMECompClauseStringSize = 0; mIMECompClauseStringSize = 0;
mIMECompClauseStringLength = 0; mIMECompClauseStringLength = 0;
mIMEReconvertUnicode = NULL; mIMEReconvertUnicode = NULL;
mIMEWaitForTrailingByte = PR_FALSE;
static BOOL gbInitGlobalValue = FALSE; static BOOL gbInitGlobalValue = FALSE;
if(! gbInitGlobalValue) { if(! gbInitGlobalValue) {
@ -2925,19 +2926,13 @@ BOOL nsWindow::OnKeyUp( UINT aVirtualKeyCode, UINT aScanCode, LPARAM aKeyData)
BOOL nsWindow::OnChar( UINT mbcsCharCode, UINT virtualKeyCode, bool isMultiByte ) BOOL nsWindow::OnChar( UINT mbcsCharCode, UINT virtualKeyCode, bool isMultiByte )
{ {
wchar_t uniChar; wchar_t uniChar;
char charToConvert[2]; char charToConvert[3];
size_t length; size_t length;
if (mIMEIsComposing) { if (mIMEIsComposing) {
HandleEndComposition(); HandleEndComposition();
} }
{
charToConvert[0] = LOBYTE(mbcsCharCode);
length=1;
}
if(mIsControlDown && (virtualKeyCode <= 0x1A)) // Ctrl+A Ctrl+Z, see Programming Windows 3.1 page 110 for details if(mIsControlDown && (virtualKeyCode <= 0x1A)) // Ctrl+A Ctrl+Z, see Programming Windows 3.1 page 110 for details
{ {
// need to account for shift here. bug 16486 // need to account for shift here. bug 16486
@ -2963,6 +2958,19 @@ BOOL nsWindow::OnChar( UINT mbcsCharCode, UINT virtualKeyCode, bool isMultiByte
} }
else else
{ {
if (PR_TRUE == mIMEWaitForTrailingByte) {
charToConvert[1] = LOBYTE(mbcsCharCode);
mIMEWaitForTrailingByte = PR_FALSE;
length=2;
}
else {
charToConvert[0] = LOBYTE(mbcsCharCode);
if (::IsDBCSLeadByte(charToConvert[0])) {
mIMEWaitForTrailingByte = PR_TRUE;
return TRUE;
}
length=1;
}
::MultiByteToWideChar(gCurrentKeyboardCP,MB_PRECOMPOSED,charToConvert,length, ::MultiByteToWideChar(gCurrentKeyboardCP,MB_PRECOMPOSED,charToConvert,length,
&uniChar, 1); &uniChar, 1);
virtualKeyCode = 0; virtualKeyCode = 0;
@ -5305,7 +5313,7 @@ NS_METHOD nsWindow::SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight)
#define ZH_CN_MS_PINYIN_IME_3_0 ((HKL)0xe00e0804L) #define ZH_CN_MS_PINYIN_IME_3_0 ((HKL)0xe00e0804L)
#define ZH_CN_NEIMA_IME ((HKL)0xe0050804L) #define ZH_CN_NEIMA_IME ((HKL)0xe0050804L)
#define USE_OVERTHESPOT_IME(kl) ((nsToolkit::mIsWinXP) \ #define USE_OVERTHESPOT_IME(kl) ((nsToolkit::mIsWinXP) \
&& (ZH_CN_MS_PINYIN_IME_3_0 == (kl)) || (ZH_CN_NEIMA_IME == (kl))) && (ZH_CN_MS_PINYIN_IME_3_0 == (kl)))
void void
nsWindow::HandleTextEvent(HIMC hIMEContext,PRBool aCheckAttr) nsWindow::HandleTextEvent(HIMC hIMEContext,PRBool aCheckAttr)

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

@ -477,22 +477,28 @@ private:
protected: protected:
nsSize mLastSize; nsSize mLastSize;
static nsWindow* gCurrentWindow; static nsWindow* gCurrentWindow;
PRBool mIsTopWidgetWindow;
nsPoint mLastPoint; nsPoint mLastPoint;
HWND mWnd; HWND mWnd;
#if 0 #if 0
HPALETTE mPalette; HPALETTE mPalette;
#endif #endif
WNDPROC mPrevWndProc; WNDPROC mPrevWndProc;
PRBool mHas3DBorder;
HBRUSH mBrush; HBRUSH mBrush;
PRBool mIsShiftDown;
PRBool mIsControlDown; PRPackedBool mIsTopWidgetWindow;
PRBool mIsAltDown; PRPackedBool mHas3DBorder;
PRBool mIsDestroying; PRPackedBool mIsShiftDown;
PRBool mOnDestroyCalled; PRPackedBool mIsControlDown;
PRBool mIsVisible; PRPackedBool mIsAltDown;
PRPackedBool mIsDestroying;
PRPackedBool mOnDestroyCalled;
PRPackedBool mIsVisible;
PRPackedBool mIMEIsComposing;
PRPackedBool mIMEIsStatusChanged;
PRPackedBool mIMEWaitForTrailingByte;
PRPackedBool mIsInMouseCapture;
PRPackedBool mIsInMouseWheelProcessing;
// XXX Temporary, should not be caching the font // XXX Temporary, should not be caching the font
nsFont * mFont; nsFont * mFont;
@ -507,8 +513,6 @@ protected:
// For Input Method Support // For Input Method Support
DWORD mIMEProperty; DWORD mIMEProperty;
PRBool mIMEIsComposing;
PRBool mIMEIsStatusChanged;
nsCString* mIMECompString; nsCString* mIMECompString;
nsString* mIMECompUnicode; nsString* mIMECompUnicode;
PRUint8* mIMEAttributeString; PRUint8* mIMEAttributeString;
@ -524,9 +528,6 @@ protected:
static UINT gCurrentKeyboardCP; static UINT gCurrentKeyboardCP;
static HKL gKeyboardLayout; static HKL gKeyboardLayout;
PRBool mIsInMouseCapture;
PRBool mIsInMouseWheelProcessing;
// Drag & Drop // Drag & Drop
nsNativeDragTarget * mNativeDragTarget; nsNativeDragTarget * mNativeDragTarget;