U16	LLKeyboardMacOSX::inverseTranslateNumpadKey(const KEY translated_key)
{
	if(mNumpadDistinct == ND_NUMLOCK_ON)
	{
		std::map<KEY, U16>::iterator iter= mInvTranslateNumpadMap.find(translated_key);
		if(iter != mInvTranslateNumpadMap.end())
		{
			return iter->second;
		}
	}
	return inverseTranslateKey(translated_key);
}
U16  LLKeyboardWin32::inverseTranslateExtendedKey(const KEY translated_key)
{
	// if numlock is on, then we need to translate KEY_PAD_FOO to the corresponding number pad number
	if((mNumpadDistinct == ND_NUMLOCK_ON) && (GetKeyState(VK_NUMLOCK) & 1))
	{
		std::map<KEY, U16>::iterator iter = mInvTranslateNumpadMap.find(translated_key);
		if (iter != mInvTranslateNumpadMap.end())
		{
			return iter->second;
		}
	}

	// if numlock is off or we're not converting numbers to arrows, we map our keypad arrows
	// to regular arrows since Windows doesn't distinguish between them
	KEY converted_key = translated_key;
	switch (converted_key) 
	{
		case KEY_PAD_LEFT:
			converted_key = KEY_LEFT; break;
		case KEY_PAD_RIGHT: 
			converted_key = KEY_RIGHT; break;
		case KEY_PAD_UP: 
			converted_key = KEY_UP; break;
		case KEY_PAD_DOWN:
			converted_key = KEY_DOWN; break;
		case KEY_PAD_HOME:
			converted_key = KEY_HOME; break;
		case KEY_PAD_END:
			converted_key = KEY_END; break;
		case KEY_PAD_PGUP:
			converted_key = KEY_PAGE_UP; break;
		case KEY_PAD_PGDN:
			converted_key = KEY_PAGE_DOWN; break;
		case KEY_PAD_INS:
			converted_key = KEY_INSERT; break;
		case KEY_PAD_DEL:
			converted_key = KEY_DELETE; break;
		case KEY_PAD_RETURN:
			converted_key = KEY_RETURN; break;
	}
	// convert our virtual keys to OS keys
	return inverseTranslateKey(converted_key);
}
예제 #3
0
U16	LLKeyboardMacOSX::inverseTranslateNumpadKey(const KEY translated_key)
{
	return inverseTranslateKey(translated_key);
}