Example #1
0
BOOL CTextService::_InitPreservedKey()
{
    ITfKeystrokeMgr *pKeystrokeMgr;
    HRESULT hr;

    if (_pThreadMgr->QueryInterface(IID_ITfKeystrokeMgr, (void **)&pKeystrokeMgr) != S_OK)
        return FALSE;

    // register VK_F2 key
    hr = pKeystrokeMgr->PreserveKey(_tfClientId, 
                                    GUID_PRESERVEDKEY_BURGLISH,
                                    &c_pkeyburglish,
                                    c_szPKeyOnOff,
                                    wcslen(c_szPKeyOnOff));

	hr = pKeystrokeMgr->PreserveKey(_tfClientId, 
                                    GUID_PRESERVEDKEY_BURMESE,
                                    &c_pkeyburmese,
                                    c_szPKeyOnOff,
                                    wcslen(c_szPKeyOnOff));

    pKeystrokeMgr->Release();

    return (hr == S_OK);
}
BOOL CTextService::_InitPreservedKey()
{
    ITfKeystrokeMgr *pKeystrokeMgr;
    HRESULT hr;

    if (_pThreadMgr->QueryInterface(IID_ITfKeystrokeMgr, (void **)&pKeystrokeMgr) != S_OK)
        return FALSE;

    // register Alt+~ key
    hr = pKeystrokeMgr->PreserveKey(_tfClientId, 
                                    GUID_PRESERVEDKEY_ONOFF,
                                    &c_pkeyOnOff0,
                                    c_szPKeyOnOff,
                                    lstrlen(c_szPKeyOnOff));

    // register KANJI key
    hr = pKeystrokeMgr->PreserveKey(_tfClientId, 
                                    GUID_PRESERVEDKEY_ONOFF,
                                    &c_pkeyOnOff1,
                                    c_szPKeyOnOff,
                                    lstrlen(c_szPKeyOnOff));

    // register F6 key
    hr = pKeystrokeMgr->PreserveKey(_tfClientId, 
                                    GUID_PRESERVEDKEY_F6,
                                    &c_pkeyF6,
                                    c_szPKeyF6,
                                    lstrlen(c_szPKeyF6));

    pKeystrokeMgr->Release();

    return (hr == S_OK);
}
Example #3
0
void WeaselTSF::_UninitKeyEventSink()
{
	ITfKeystrokeMgr *pKeystrokeMgr;
	
	if (_pThreadMgr->QueryInterface(IID_ITfKeystrokeMgr, (void **) &pKeystrokeMgr) != S_OK)
		return;

	pKeystrokeMgr->UnadviseKeyEventSink(_tfClientId);
	pKeystrokeMgr->Release();
}
Example #4
0
void CTextService::_UninitPreservedKey()
{
    ITfKeystrokeMgr *pKeystrokeMgr;

    if (_pThreadMgr->QueryInterface(IID_ITfKeystrokeMgr, (void **)&pKeystrokeMgr) != S_OK)
        return;

    pKeystrokeMgr->UnpreserveKey(GUID_PRESERVEDKEY_BURGLISH, &c_pkeyburglish);
	pKeystrokeMgr->UnpreserveKey(GUID_PRESERVEDKEY_BURMESE, &c_pkeyburmese);

    pKeystrokeMgr->Release();
}
void CTextService::_UninitPreservedKey()
{
    ITfKeystrokeMgr *pKeystrokeMgr;

    if (_pThreadMgr->QueryInterface(IID_ITfKeystrokeMgr, (void **)&pKeystrokeMgr) != S_OK)
        return;

    pKeystrokeMgr->UnpreserveKey(GUID_PRESERVEDKEY_ONOFF, &c_pkeyOnOff0);
    pKeystrokeMgr->UnpreserveKey(GUID_PRESERVEDKEY_ONOFF, &c_pkeyOnOff1);
    pKeystrokeMgr->UnpreserveKey(GUID_PRESERVEDKEY_F6,    &c_pkeyF6);

    pKeystrokeMgr->Release();
}
Example #6
0
BOOL WeaselTSF::_InitKeyEventSink()
{
	ITfKeystrokeMgr *pKeystrokeMgr;
	HRESULT hr;

	if (_pThreadMgr->QueryInterface(IID_ITfKeystrokeMgr, (void **) &pKeystrokeMgr) != S_OK)
		return FALSE;

	hr = pKeystrokeMgr->AdviseKeyEventSink(_tfClientId, (ITfKeyEventSink *) this, TRUE);
	pKeystrokeMgr->Release();
	
	return (hr == S_OK);
}
Example #7
0
// preserved key
void TextService::addPreservedKey(UINT keyCode, UINT modifiers, const GUID& guid) {
	PreservedKey preservedKey;
	preservedKey.guid = guid;
	preservedKey.uVKey = keyCode;
	preservedKey.uModifiers = modifiers;
	preservedKeys_.push_back(preservedKey);
	if(threadMgr_) { // our text service is activated
		ITfKeystrokeMgr *keystrokeMgr;
		if (threadMgr_->QueryInterface(IID_ITfKeystrokeMgr, (void **)&keystrokeMgr) == S_OK) {
			keystrokeMgr->PreserveKey(clientId_, guid, &preservedKey, NULL, 0);
			keystrokeMgr->Release();
		}
	}
}
Example #8
0
void TextService::removePreservedKey(const GUID& guid) {
	vector<PreservedKey>::iterator it;
	for(it = preservedKeys_.begin(); it != preservedKeys_.end(); ++it) {
		PreservedKey& preservedKey = *it;
		if(::IsEqualIID(preservedKey.guid, guid)) {
			if(threadMgr_) { // our text service is activated
				ITfKeystrokeMgr *keystrokeMgr;
				if (threadMgr_->QueryInterface(IID_ITfKeystrokeMgr, (void **)&keystrokeMgr) == S_OK) {
					keystrokeMgr->UnpreserveKey(preservedKey.guid, &preservedKey);
					keystrokeMgr->Release();
				}
			}
			preservedKeys_.erase(it);
			break;
		}
	}
}