зеркало из https://github.com/mozilla/gecko-dev.git
Bug 840409 part.6 Implement widget::IMEHandler::NotifyIME() for committing and canceling composition r=jimm, feedback=roc
This commit is contained in:
Родитель
d4f5d5a259
Коммит
7eb648f847
|
@ -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
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#define WinIMEHandler_h_
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsEvent.h"
|
||||
#include <windows.h>
|
||||
|
||||
class nsWindow;
|
||||
|
@ -47,6 +48,12 @@ public:
|
|||
*/
|
||||
static bool IsComposingOn(nsWindow* aWindow);
|
||||
|
||||
/**
|
||||
* Notifies IME of the notification (a request or an event).
|
||||
*/
|
||||
static nsresult NotifyIME(nsWindow* aWindow,
|
||||
NotificationToIME aNotification);
|
||||
|
||||
/**
|
||||
* "Kakutei-Undo" of ATOK or WXG (both of them are Japanese IME) causes
|
||||
* strange WM_KEYDOWN/WM_KEYUP/WM_CHAR message pattern. So, when this
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
|
||||
static void CommitComposition(bool aDiscard)
|
||||
{
|
||||
if (!sTsfTextStore) return;
|
||||
NS_ENSURE_TRUE_VOID(sTsfTextStore);
|
||||
sTsfTextStore->CommitCompositionInternal(aDiscard);
|
||||
}
|
||||
|
||||
|
|
|
@ -7384,16 +7384,7 @@ nsWindow::OnSysColorChanged()
|
|||
|
||||
NS_IMETHODIMP nsWindow::ResetInputState()
|
||||
{
|
||||
#ifdef DEBUG_KBSTATE
|
||||
PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("ResetInputState\n"));
|
||||
#endif
|
||||
|
||||
#ifdef NS_ENABLE_TSF
|
||||
nsTextStore::CommitComposition(false);
|
||||
#endif //NS_ENABLE_TSF
|
||||
|
||||
nsIMM32Handler::CommitComposition(this);
|
||||
return NS_OK;
|
||||
return IMEHandler::NotifyIME(this, REQUEST_TO_COMMIT_COMPOSITION);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void)
|
||||
|
@ -7462,16 +7453,7 @@ nsWindow::GetInputContext()
|
|||
|
||||
NS_IMETHODIMP nsWindow::CancelIMEComposition()
|
||||
{
|
||||
#ifdef DEBUG_KBSTATE
|
||||
PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("CancelIMEComposition\n"));
|
||||
#endif
|
||||
|
||||
#ifdef NS_ENABLE_TSF
|
||||
nsTextStore::CommitComposition(true);
|
||||
#endif //NS_ENABLE_TSF
|
||||
|
||||
nsIMM32Handler::CancelComposition(this);
|
||||
return NS_OK;
|
||||
return IMEHandler::NotifyIME(this, REQUEST_TO_CANCEL_COMPOSITION);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
Загрузка…
Ссылка в новой задаче