Bug 840409 part.6 Implement widget::IMEHandler::NotifyIME() for committing and canceling composition r=jimm, feedback=roc

This commit is contained in:
Masayuki Nakano
2013-02-25 13:00:06 +09:00
parent e8d25344c1
commit 06f68bb034
4 changed files with 46 additions and 21 deletions

View File

@@ -96,6 +96,42 @@ IMEHandler::IsComposingOn(nsWindow* aWindow)
return nsIMM32Handler::IsComposingOn(aWindow);
}
// static
nsresult
IMEHandler::NotifyIME(nsWindow* aWindow,
NotificationToIME aNotification)
{
#ifdef NS_ENABLE_TSF
if (sIsInTSFMode) {
switch (aNotification) {
case REQUEST_TO_COMMIT_COMPOSITION:
if (nsTextStore::IsComposingOn(aWindow)) {
nsTextStore::CommitComposition(false);
}
return NS_OK;
case REQUEST_TO_CANCEL_COMPOSITION:
if (nsTextStore::IsComposingOn(aWindow)) {
nsTextStore::CommitComposition(true);
}
return NS_OK;
default:
return NS_ERROR_NOT_IMPLEMENTED;
}
}
#endif //NS_ENABLE_TSF
switch (aNotification) {
case REQUEST_TO_COMMIT_COMPOSITION:
nsIMM32Handler::CommitComposition(aWindow);
return NS_OK;
case REQUEST_TO_CANCEL_COMPOSITION:
nsIMM32Handler::CancelComposition(aWindow);
return NS_OK;
default:
return NS_ERROR_NOT_IMPLEMENTED;
}
}
#ifdef DEBUG
// static
bool