From 372740a4e822a6ac85477afc98c233e3b14d0f23 Mon Sep 17 00:00:00 2001 From: "yokoyama%netscape.com" Date: Fri, 7 Jun 2002 21:44:08 +0000 Subject: [PATCH] Bug 149171 and 146844 IME input processing Only impact Simplified Chinese Windows. /r=shanjian, /sr=brendan --- widget/src/windows/nsWindow.cpp | 24 ++++++++++++++++-------- widget/src/windows/nsWindow.h | 29 +++++++++++++++-------------- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index c282d5e381de..f16a95b5472a 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -777,6 +777,7 @@ nsWindow::nsWindow() : nsBaseWidget() mIMECompClauseStringSize = 0; mIMECompClauseStringLength = 0; mIMEReconvertUnicode = NULL; + mIMEWaitForTrailingByte = PR_FALSE; static BOOL gbInitGlobalValue = FALSE; if(! gbInitGlobalValue) { @@ -2925,19 +2926,13 @@ BOOL nsWindow::OnKeyUp( UINT aVirtualKeyCode, UINT aScanCode, LPARAM aKeyData) BOOL nsWindow::OnChar( UINT mbcsCharCode, UINT virtualKeyCode, bool isMultiByte ) { wchar_t uniChar; - char charToConvert[2]; + char charToConvert[3]; size_t length; if (mIMEIsComposing) { HandleEndComposition(); } - { - charToConvert[0] = LOBYTE(mbcsCharCode); - length=1; - } - - 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 @@ -2963,6 +2958,19 @@ BOOL nsWindow::OnChar( UINT mbcsCharCode, UINT virtualKeyCode, bool isMultiByte } 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, &uniChar, 1); 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_NEIMA_IME ((HKL)0xe0050804L) #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 nsWindow::HandleTextEvent(HIMC hIMEContext,PRBool aCheckAttr) diff --git a/widget/src/windows/nsWindow.h b/widget/src/windows/nsWindow.h index 54f00ec625fa..16533020d7f1 100644 --- a/widget/src/windows/nsWindow.h +++ b/widget/src/windows/nsWindow.h @@ -477,22 +477,28 @@ private: protected: nsSize mLastSize; static nsWindow* gCurrentWindow; - PRBool mIsTopWidgetWindow; nsPoint mLastPoint; HWND mWnd; #if 0 HPALETTE mPalette; #endif WNDPROC mPrevWndProc; - - PRBool mHas3DBorder; HBRUSH mBrush; - PRBool mIsShiftDown; - PRBool mIsControlDown; - PRBool mIsAltDown; - PRBool mIsDestroying; - PRBool mOnDestroyCalled; - PRBool mIsVisible; + + PRPackedBool mIsTopWidgetWindow; + PRPackedBool mHas3DBorder; + PRPackedBool mIsShiftDown; + PRPackedBool mIsControlDown; + 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 nsFont * mFont; @@ -507,8 +513,6 @@ protected: // For Input Method Support DWORD mIMEProperty; - PRBool mIMEIsComposing; - PRBool mIMEIsStatusChanged; nsCString* mIMECompString; nsString* mIMECompUnicode; PRUint8* mIMEAttributeString; @@ -524,9 +528,6 @@ protected: static UINT gCurrentKeyboardCP; static HKL gKeyboardLayout; - PRBool mIsInMouseCapture; - PRBool mIsInMouseWheelProcessing; - // Drag & Drop nsNativeDragTarget * mNativeDragTarget;