IME input processing in Widget
Impact only on Windows platform.
/r=shanjian, /sr=brendan
This commit is contained in:
yokoyama%netscape.com 2002-06-11 22:20:39 +00:00
Родитель 9e4ddda3e8
Коммит e84214b3aa
2 изменённых файлов: 31 добавлений и 22 удалений

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

@ -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)

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

@ -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;