Bug 840409 part.6 Implement widget::IMEHandler::NotifyIME() for committing and canceling composition r=jimm, feedback=roc
This commit is contained in:
@@ -96,6 +96,42 @@ IMEHandler::IsComposingOn(nsWindow* aWindow)
|
|||||||
return nsIMM32Handler::IsComposingOn(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
|
#ifdef DEBUG
|
||||||
// static
|
// static
|
||||||
bool
|
bool
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#define WinIMEHandler_h_
|
#define WinIMEHandler_h_
|
||||||
|
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
|
#include "nsEvent.h"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
class nsWindow;
|
class nsWindow;
|
||||||
@@ -47,6 +48,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
static bool IsComposingOn(nsWindow* aWindow);
|
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
|
* "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
|
* strange WM_KEYDOWN/WM_KEYUP/WM_CHAR message pattern. So, when this
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ public:
|
|||||||
|
|
||||||
static void CommitComposition(bool aDiscard)
|
static void CommitComposition(bool aDiscard)
|
||||||
{
|
{
|
||||||
if (!sTsfTextStore) return;
|
NS_ENSURE_TRUE_VOID(sTsfTextStore);
|
||||||
sTsfTextStore->CommitCompositionInternal(aDiscard);
|
sTsfTextStore->CommitCompositionInternal(aDiscard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7384,16 +7384,7 @@ nsWindow::OnSysColorChanged()
|
|||||||
|
|
||||||
NS_IMETHODIMP nsWindow::ResetInputState()
|
NS_IMETHODIMP nsWindow::ResetInputState()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_KBSTATE
|
return IMEHandler::NotifyIME(this, REQUEST_TO_COMMIT_COMPOSITION);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(void)
|
NS_IMETHODIMP_(void)
|
||||||
@@ -7462,16 +7453,7 @@ nsWindow::GetInputContext()
|
|||||||
|
|
||||||
NS_IMETHODIMP nsWindow::CancelIMEComposition()
|
NS_IMETHODIMP nsWindow::CancelIMEComposition()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_KBSTATE
|
return IMEHandler::NotifyIME(this, REQUEST_TO_CANCEL_COMPOSITION);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|||||||
Reference in New Issue
Block a user