bug 163572 : converted string is inserted every time space key is pressed patch by masayuki@d-toybox.com (r=pinkerton,bryner,amardare,emaijala,sfraser,roc, sr=bryner,sfraser,roc)
This commit is contained in:
Родитель
ac7e4ac4f6
Коммит
ffd7ee363f
|
@ -2104,30 +2104,35 @@ nsEditor::NotifyIMEOnFocus()
|
|||
{
|
||||
mNeedRecoverIMEOpenState = PR_FALSE;
|
||||
|
||||
if(gDontCareForIMEOnFocusPassword
|
||||
|| !(mFlags & nsIPlaintextEditor::eEditorPasswordMask))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIKBStateControl> kb;
|
||||
nsresult res = GetKBStateControl(getter_AddRefs(kb));
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
if (kb) {
|
||||
PRBool isOpen;
|
||||
res = kb->GetIMEOpenState(&isOpen);
|
||||
if (!kb)
|
||||
return NS_OK;
|
||||
|
||||
res = kb->CancelIMEComposition();
|
||||
if (NS_FAILED(res))
|
||||
kb->ResetInputState();
|
||||
|
||||
if(gDontCareForIMEOnFocusPassword
|
||||
|| !(mFlags & nsIPlaintextEditor::eEditorPasswordMask))
|
||||
return NS_OK;
|
||||
|
||||
PRBool isOpen;
|
||||
res = kb->GetIMEOpenState(&isOpen);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
if (isOpen) {
|
||||
res = kb->SetIMEOpenState(PR_FALSE);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
if (isOpen) {
|
||||
res = kb->SetIMEOpenState(PR_FALSE);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
}
|
||||
|
||||
mNeedRecoverIMEOpenState = isOpen;
|
||||
}
|
||||
|
||||
mNeedRecoverIMEOpenState = isOpen;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,10 @@ class nsIKBStateControl : public nsISupports {
|
|||
*/
|
||||
NS_IMETHOD GetIMEOpenState(PRBool* aState) = 0;
|
||||
|
||||
/*
|
||||
* Destruct and don't commit the IME composition string.
|
||||
*/
|
||||
NS_IMETHOD CancelIMEComposition() = 0;
|
||||
};
|
||||
|
||||
#endif // nsIKBStateControl_h__
|
||||
|
|
|
@ -247,6 +247,7 @@ public:
|
|||
NS_IMETHOD ResetInputState();
|
||||
NS_IMETHOD SetIMEOpenState(PRBool aState);
|
||||
NS_IMETHOD GetIMEOpenState(PRBool* aState);
|
||||
NS_IMETHOD CancelIMEComposition();
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -2047,6 +2047,11 @@ NS_IMETHODIMP nsChildView::GetIMEOpenState(PRBool* aState)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChildView::CancelIMEComposition()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// GetQuickDrawPort
|
||||
|
|
|
@ -2355,6 +2355,10 @@ NS_IMETHODIMP nsWidget::GetIMEOpenState(PRBool* aState) {
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::CancelIMEComposition() {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
GtkWindow *nsWidget::GetTopLevelWindow(void)
|
||||
{
|
||||
|
|
|
@ -172,6 +172,7 @@ public:
|
|||
NS_IMETHOD ResetInputState();
|
||||
NS_IMETHOD SetIMEOpenState(PRBool aState);
|
||||
NS_IMETHOD GetIMEOpenState(PRBool* aState);
|
||||
NS_IMETHOD CancelIMEComposition();
|
||||
|
||||
void InitEvent(nsGUIEvent& event, nsPoint* aPoint = nsnull);
|
||||
|
||||
|
|
|
@ -2653,6 +2653,10 @@ NS_IMETHODIMP nsWindow::GetIMEOpenState(PRBool* aState) {
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWindow::CancelIMEComposition() {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
#if !TARGET_CARBON
|
||||
|
||||
|
|
|
@ -227,6 +227,7 @@ public:
|
|||
NS_IMETHOD ResetInputState();
|
||||
NS_IMETHOD SetIMEOpenState(PRBool aState);
|
||||
NS_IMETHOD GetIMEOpenState(PRBool* aState);
|
||||
NS_IMETHOD CancelIMEComposition();
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -229,6 +229,10 @@ NS_IMETHODIMP nsWidget::GetIMEOpenState(PRBool* aState) {
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::CancelIMEComposition() {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Hide or show this component
|
||||
|
|
|
@ -215,6 +215,7 @@ public:
|
|||
NS_IMETHOD ResetInputState();
|
||||
NS_IMETHOD SetIMEOpenState(PRBool aState);
|
||||
NS_IMETHOD GetIMEOpenState(PRBool* aState);
|
||||
NS_IMETHOD CancelIMEComposition();
|
||||
|
||||
inline void InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint = nsnull)
|
||||
{
|
||||
|
|
|
@ -6554,7 +6554,7 @@ NS_IMETHODIMP nsWindow::ResetInputState()
|
|||
NS_IMETHODIMP nsWindow::SetIMEOpenState(PRBool aState)
|
||||
{
|
||||
#ifdef DEBUG_KBSTATE
|
||||
printf("SetImeOpenState %s\n", (aState ? "Open" : "Close"));
|
||||
printf("SetIMEOpenState %s\n", (aState ? "Open" : "Close"));
|
||||
#endif
|
||||
HIMC hIMC;
|
||||
NS_IMM_GETCONTEXT(mWnd, hIMC);
|
||||
|
@ -6580,6 +6580,22 @@ NS_IMETHODIMP nsWindow::GetIMEOpenState(PRBool* aState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
NS_IMETHODIMP nsWindow::CancelIMEComposition()
|
||||
{
|
||||
#ifdef DEBUG_KBSTATE
|
||||
printf("CancelIMEComposition\n");
|
||||
#endif
|
||||
HIMC hIMC;
|
||||
NS_IMM_GETCONTEXT(mWnd, hIMC);
|
||||
if (hIMC) {
|
||||
BOOL ret = FALSE;
|
||||
NS_IMM_NOTIFYIME(hIMC, NI_COMPOSITIONSTR, CPS_CANCEL, NULL, ret);
|
||||
NS_IMM_RELEASECONTEXT(mWnd, hIMC);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
#define PT_IN_RECT(pt, rc) ((pt).x>(rc).left && (pt).x <(rc).right && (pt).y>(rc).top && (pt).y<(rc).bottom)
|
||||
|
||||
|
|
|
@ -362,6 +362,7 @@ public:
|
|||
NS_IMETHOD ResetInputState();
|
||||
NS_IMETHOD SetIMEOpenState(PRBool aState);
|
||||
NS_IMETHOD GetIMEOpenState(PRBool* aState);
|
||||
NS_IMETHOD CancelIMEComposition();
|
||||
|
||||
PRBool IMEMouseHandling(PRUint32 aEventType, PRInt32 aAction, LPARAM lParam);
|
||||
PRBool IMECompositionHitTest(PRUint32 aEventType, POINT * ptPos);
|
||||
|
|
Загрузка…
Ссылка в новой задаче