Bug 840409 part.11 Implement nsIMEContext::AssociateDefaultContext() and nsIMEContext::Disassociate() r=jimm

This commit is contained in:
Masayuki Nakano
2013-02-25 13:00:06 +09:00
parent 87e6efa41c
commit d77ec1a2c8
5 changed files with 52 additions and 47 deletions

View File

@@ -214,19 +214,19 @@ nsIMM32Handler::CommitComposition(nsWindow* aWindow, bool aForce)
return;
}
bool associated = aWindow->AssociateDefaultIMC(true);
nsIMEContext IMEContext(aWindow->GetWindowHandle());
bool associated = IMEContext.AssociateDefaultContext();
PR_LOG(gIMM32Log, PR_LOG_ALWAYS,
("IMM32: CommitComposition, associated=%s\n",
associated ? "YES" : "NO"));
nsIMEContext IMEContext(aWindow->GetWindowHandle());
if (IMEContext.IsValid()) {
::ImmNotifyIME(IMEContext.get(), NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
::ImmNotifyIME(IMEContext.get(), NI_COMPOSITIONSTR, CPS_CANCEL, 0);
}
if (associated) {
aWindow->AssociateDefaultIMC(false);
IMEContext.Disassociate();
}
}
@@ -245,18 +245,18 @@ nsIMM32Handler::CancelComposition(nsWindow* aWindow, bool aForce)
return;
}
bool associated = aWindow->AssociateDefaultIMC(true);
nsIMEContext IMEContext(aWindow->GetWindowHandle());
bool associated = IMEContext.AssociateDefaultContext();
PR_LOG(gIMM32Log, PR_LOG_ALWAYS,
("IMM32: CancelComposition, associated=%s\n",
associated ? "YES" : "NO"));
nsIMEContext IMEContext(aWindow->GetWindowHandle());
if (IMEContext.IsValid()) {
::ImmNotifyIME(IMEContext.get(), NI_COMPOSITIONSTR, CPS_CANCEL, 0);
}
if (associated) {
aWindow->AssociateDefaultIMC(false);
IMEContext.Disassociate();
}
}