зеркало из https://github.com/mozilla/gecko-dev.git
Bug 840409 part.10 Implement widget::IMEHandler::SetOpenState() and widget::IMEHandler::GetOpenState() r=jimm
This commit is contained in:
Родитель
60933117b1
Коммит
d5fcbc0600
|
@ -168,6 +168,34 @@ IMEHandler::GetUpdatePreference()
|
|||
return nsIMEUpdatePreference(false, false);
|
||||
}
|
||||
|
||||
void
|
||||
IMEHandler::SetOpenState(nsWindow* aWindow, bool aOpen)
|
||||
{
|
||||
#ifdef NS_ENABLE_TSF
|
||||
if (sIsInTSFMode) {
|
||||
nsTextStore::SetIMEOpenState(aOpen);
|
||||
return;
|
||||
}
|
||||
#endif //NS_ENABLE_TSF
|
||||
|
||||
nsIMEContext IMEContext(aWindow->GetWindowHandle());
|
||||
IMEContext.SetOpenState(aOpen);
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
IMEHandler::GetOpenState(nsWindow* aWindow)
|
||||
{
|
||||
#ifdef NS_ENABLE_TSF
|
||||
if (sIsInTSFMode) {
|
||||
return nsTextStore::GetIMEOpenState();
|
||||
}
|
||||
#endif //NS_ENABLE_TSF
|
||||
|
||||
nsIMEContext IMEContext(aWindow->GetWindowHandle());
|
||||
return IMEContext.GetOpenState();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// static
|
||||
bool
|
||||
|
|
|
@ -67,6 +67,12 @@ public:
|
|||
*/
|
||||
static nsIMEUpdatePreference GetUpdatePreference();
|
||||
|
||||
/**
|
||||
* Sets and Gets IME open state.
|
||||
*/
|
||||
static void SetOpenState(nsWindow* aWindow, bool aOpen);
|
||||
static bool GetOpenState(nsWindow* aWindow);
|
||||
|
||||
/**
|
||||
* "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
|
||||
|
|
|
@ -45,6 +45,22 @@ public:
|
|||
return !!mIMC;
|
||||
}
|
||||
|
||||
void SetOpenState(bool aOpen) const
|
||||
{
|
||||
if (!mIMC) {
|
||||
return;
|
||||
}
|
||||
::ImmSetOpenStatus(mIMC, aOpen);
|
||||
}
|
||||
|
||||
bool GetOpenState() const
|
||||
{
|
||||
if (!mIMC) {
|
||||
return false;
|
||||
}
|
||||
return (::ImmGetOpenStatus(mIMC) != FALSE);
|
||||
}
|
||||
|
||||
protected:
|
||||
nsIMEContext()
|
||||
{
|
||||
|
|
|
@ -7417,13 +7417,7 @@ nsWindow::SetInputContext(const InputContext& aContext,
|
|||
if (enable &&
|
||||
mInputContext.mIMEState.mOpen != IMEState::DONT_CHANGE_OPEN_STATE) {
|
||||
bool open = (mInputContext.mIMEState.mOpen == IMEState::OPEN);
|
||||
#ifdef NS_ENABLE_TSF
|
||||
nsTextStore::SetIMEOpenState(open);
|
||||
#endif //NS_ENABLE_TSF
|
||||
nsIMEContext IMEContext(mWnd);
|
||||
if (IMEContext.IsValid()) {
|
||||
::ImmSetOpenStatus(IMEContext.get(), open);
|
||||
}
|
||||
IMEHandler::SetOpenState(this, open);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7433,20 +7427,11 @@ nsWindow::GetInputContext()
|
|||
mInputContext.mIMEState.mOpen = IMEState::CLOSED;
|
||||
switch (mInputContext.mIMEState.mEnabled) {
|
||||
case IMEState::ENABLED:
|
||||
case IMEState::PLUGIN: {
|
||||
nsIMEContext IMEContext(mWnd);
|
||||
if (IMEContext.IsValid()) {
|
||||
mInputContext.mIMEState.mOpen =
|
||||
::ImmGetOpenStatus(IMEContext.get()) ? IMEState::OPEN :
|
||||
IMEState::CLOSED;
|
||||
}
|
||||
#ifdef NS_ENABLE_TSF
|
||||
if (mInputContext.mIMEState.mOpen == IMEState::CLOSED &&
|
||||
nsTextStore::GetIMEOpenState()) {
|
||||
case IMEState::PLUGIN:
|
||||
if (IMEHandler::GetOpenState(this)) {
|
||||
mInputContext.mIMEState.mOpen = IMEState::OPEN;
|
||||
}
|
||||
#endif //NS_ENABLE_TSF
|
||||
}
|
||||
break;
|
||||
}
|
||||
return mInputContext;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче