Bug 1395876 - Initialize TSF modules after we create first normal window r=m_kato

Currently, we initialize TSF modules when there is only message window (this
started from bug 1341915).  At this time, QQ Input (Simplified Chinese TIP)
fails to initialize itself.

Therefore, we should put off to initialize TSF modules after creating first
normal window.  Then, initialize its IMC and input context for the window.

IMEHandler::InitInputContext() should be called when each normal window is
created.  Therefore, calling Initialize() from it can guarantee there is
at least one normal window when Initialize() is called.

MozReview-Commit-ID: IfR4y3pYv6J

--HG--
extra : rebase_source : 3f36acfa65567f140eea9c7fc12d6268aadbd5ef
This commit is contained in:
Masayuki Nakano 2017-09-08 16:26:54 +09:00
Родитель 6b536f8760
Коммит 4b414a44a2
3 изменённых файлов: 25 добавлений и 2 удалений

Просмотреть файл

@ -503,6 +503,22 @@ IMEHandler::AssociateIMEContext(nsWindowBase* aWindowBase, bool aEnable)
void
IMEHandler::InitInputContext(nsWindow* aWindow, InputContext& aInputContext)
{
MOZ_ASSERT(aWindow);
MOZ_ASSERT(aWindow->GetWindowHandle(),
"IMEHandler::SetInputContext() requires non-nullptr HWND");
static bool sInitialized = false;
if (!sInitialized) {
sInitialized = true;
// Some TIPs like QQ Input (Simplified Chinese) may need normal window
// (i.e., windows except message window) when initializing themselves.
// Therefore, we need to initialize TSF/IMM modules after first normal
// window is created. InitInputContext() should be called immediately
// after creating each normal window, so, here is a good place to
// initialize these modules.
Initialize();
}
// For a11y, the default enabled state should be 'enabled'.
aInputContext.mIMEState.mEnabled = IMEState::ENABLED;

Просмотреть файл

@ -30,8 +30,16 @@ struct MSGResult;
*/
class IMEHandler final
{
public:
private:
/**
* Initialize() initializes both TSF modules and IMM modules. Some TIPs
* may require a normal window (i.e., not message window) belonging to
* this process. Therefore, this is called immediately after first normal
* window is created.
*/
static void Initialize();
public:
static void Terminate();
/**

Просмотреть файл

@ -655,7 +655,6 @@ nsWindow::nsWindow(bool aIsChildWindow)
#if defined(ACCESSIBILITY)
mozilla::TIPMessageHandler::Initialize();
#endif // defined(ACCESSIBILITY)
IMEHandler::Initialize();
if (SUCCEEDED(::OleInitialize(nullptr))) {
sIsOleInitialized = TRUE;
}