STDAPI CTextService::OnPreservedKey(ITfContext *pic, REFGUID rguid, BOOL *pfEaten)
{
	if(pic == NULL || pfEaten == NULL)
	{
		return E_INVALIDARG;
	}

	BOOL fOpen = _IsKeyboardOpen();

	if(IsEqualGUID(rguid, c_guidPreservedKeyOn))
	{
		if(!fOpen)
		{
			inputmode = im_disable;

			_SetKeyboardOpen(TRUE);
		}
		else
		{
			_UpdateLanguageBar();
		}

		*pfEaten = TRUE;
	}
	else if(IsEqualGUID(rguid, c_guidPreservedKeyOff))
	{
		if(fOpen)
		{
			_ClearComposition();

			_SetKeyboardOpen(FALSE);
		}
		else
		{
			_UpdateLanguageBar();
		}

		*pfEaten = TRUE;
	}
	else
	{
		*pfEaten = FALSE;
	}

	return S_OK;
}
Example #2
0
STDAPI CTextService::OnPreservedKey(ITfContext *pic, REFGUID rguid, BOOL *pfEaten)
{
	if(IsEqualGUID(rguid, c_guidPreservedKeyOnOff))
	{
		BOOL fOpen = _IsKeyboardOpen();
		if(!fOpen)
		{
			inputmode = im_disable;
		}
		else
		{
			_ClearComposition();
		}
		_SetKeyboardOpen(fOpen ? FALSE : TRUE);
		*pfEaten = TRUE;
	}
	else
	{
		*pfEaten = FALSE;
	}

	return S_OK;
}
Example #3
0
STDAPI CTextService::OnTestKeyDown(ITfContext *pic, WPARAM wParam, LPARAM lParam, BOOL *pfEaten)
{
	*pfEaten = _IsKeyEaten(pic, wParam);

	if(_pCandidateList == NULL || !_pCandidateList->_IsShowCandidateWindow())
	{
		if(_pInputModeWindow != NULL)
		{
			_ClearComposition();
		}

		if(inputmode == im_ascii)
		{
			WCHAR ch = _GetCh((BYTE)wParam);
			if(_IsKeyVoid(ch, (BYTE)wParam))
			{
				_GetActiveFlags();
				_UpdateLanguageBar();
			}
		}
	}

	return S_OK;
}