Bug 1052343 part.3 Create TSFStaticSink for listening to some TSF events for whole life time of our process r=emk

This commit is contained in:
Masayuki Nakano 2014-09-03 10:38:20 +09:00
parent 505d5be613
commit 6eed598db5
2 changed files with 512 additions and 434 deletions

File diff suppressed because it is too large Load Diff

View File

@ -41,6 +41,7 @@ class nsWindow;
#ifdef MOZ_METRO
class MetroWidget;
#endif
class TSFStaticSink;
namespace mozilla {
namespace widget {
@ -54,8 +55,6 @@ struct MSGResult;
class nsTextStore MOZ_FINAL : public ITextStoreACP
, public ITfContextOwnerCompositionSink
, public ITfActiveLanguageProfileNotifySink
, public ITfInputProcessorProfileActivationSink
, public ITfMouseTrackerACP
{
public: /*IUnknown*/
@ -101,14 +100,6 @@ public: /*ITfContextOwnerCompositionSink*/
STDMETHODIMP OnUpdateComposition(ITfCompositionView*, ITfRange*);
STDMETHODIMP OnEndComposition(ITfCompositionView*);
public: /*ITfActiveLanguageProfileNotifySink*/
STDMETHODIMP OnActivated(REFCLSID clsid, REFGUID guidProfile,
BOOL fActivated);
public: /*ITfInputProcessorProfileActivationSink*/
STDMETHODIMP OnActivated(DWORD, LANGID, REFCLSID, REFGUID, REFGUID,
HKL, DWORD);
public: /*ITfMouseTrackerACP*/
STDMETHODIMP AdviseMouseSink(ITfRangeACP*, ITfMouseSink*, DWORD*);
STDMETHODIMP UnadviseMouseSink(DWORD);
@ -224,19 +215,7 @@ public:
return (IsComposing() && sEnabledTextStore->mWidget == aWidget);
}
static bool IsIMM_IME()
{
if (!sEnabledTextStore ||
!sEnabledTextStore->EnsureInitActiveTIPKeyboard()) {
return IsIMM_IME(::GetKeyboardLayout(0));
}
return sEnabledTextStore->mIsIMM_IME;
}
static bool IsIMM_IME(HKL aHKL)
{
return (::ImmGetIMEFileNameW(aHKL, nullptr, 0) > 0);
}
static bool IsIMM_IME();
#ifdef DEBUG
// Returns true when keyboard layout has IME (TIP).
@ -247,17 +226,9 @@ protected:
nsTextStore();
~nsTextStore();
bool Init(ITfThreadMgr* aThreadMgr);
void Shutdown();
static void MarkContextAsKeyboardDisabled(ITfContext* aContext);
static void MarkContextAsEmpty(ITfContext* aContext);
static bool IsTIPCategoryKeyboard(REFCLSID aTextService, LANGID aLangID,
REFGUID aProfile);
static void GetTIPDescription(REFCLSID aTextService, LANGID aLangID,
REFGUID aProfile, nsAString& aDescription);
bool Create(nsWindowBase* aWidget);
bool Destroy(void);
@ -318,18 +289,12 @@ protected:
// application. Otherwise, this does nothing.
void CreateNativeCaret();
bool EnsureInitActiveTIPKeyboard();
// Holds the pointer to our current win32 or metro widget
nsRefPtr<nsWindowBase> mWidget;
// Document manager for the currently focused editor
nsRefPtr<ITfDocumentMgr> mDocumentMgr;
// Edit cookie associated with the current editing context
DWORD mEditCookie;
// Cookie of installing ITfInputProcessorProfileActivationSink
DWORD mIPProfileCookie;
// Cookie of installing ITfActiveLanguageProfileNotifySink
DWORD mLangProfileCookie;
// Editing context at the bottom of mDocumentMgr's context stack
nsRefPtr<ITfContext> mContext;
// Currently installed notification sink
@ -340,9 +305,6 @@ protected:
DWORD mLock;
// 0 if no lock is queued, otherwise TS_LF_* indicating the queue lock
DWORD mLockQueued;
// Active TIP keyboard's description. If active language profile isn't TIP,
// i.e., IMM-IME or just a keyboard layout, this is empty.
nsString mActiveTIPKeyboardDescription;
class Composition MOZ_FINAL
{
@ -771,11 +733,6 @@ protected:
// While there is native caret, this is true. Otherwise, false.
bool mNativeCaretIsCreated;
// True if current IME is implemented with IMM.
bool mIsIMM_IME;
// True if OnActivated() is already called
bool mOnActivatedCalled;
// TSF thread manager object for the current application
static ITfThreadMgr* sTsfThreadMgr;
// sMessagePump is QI'ed from sTsfThreadMgr