some key codes changes

This commit is contained in:
Eduardo Bart 2012-02-04 00:43:43 -02:00
parent aafe219532
commit 2b206a74a9
6 changed files with 22 additions and 41 deletions

@ -1 +1 @@
Subproject commit dd648e1431171bffe091b748744395780df7eba1
Subproject commit 9beb17daaeb170c127c39c5a5e4feb9d95ebed92

View File

@ -82,7 +82,6 @@ KeyCapsLock = 20
KeyCtrl = 21
KeyShift = 22
KeyAlt = 23
KeyAltGr = 24
KeyMeta = 25
KeyMenu = 26
KeySpace = 32 -- ' '
@ -201,7 +200,6 @@ KeyCodeDescs = {
[KeyCtrl] = 'Ctrl',
[KeyShift] = 'Shift',
[KeyAlt] = 'Alt',
[KeyAltGr] = 'AltGr',
[KeyMeta] = 'Meta',
[KeyMenu] = 'Menu',
[KeySpace] = 'Space',

View File

@ -29,7 +29,7 @@ end
local function determineKeyComboDesc(keyCode, keyboardModifiers)
local keyCombo = {}
if keyCode == KeyCtrl or keyCode == KeyShift or keyCode == KeyAlt or keyCode == KeyAltGr then
if keyCode == KeyCtrl or keyCode == KeyShift or keyCode == KeyAlt then
table.insert(keyCombo, keyCode)
elseif KeyCodeDescs[keyCode] ~= nil then
if keyboardModifiers == KeyboardCtrlModifier then

View File

@ -60,6 +60,7 @@ namespace Fw
KeyEscape = 1,
KeyTab = 2,
KeyBackspace = 3,
//KeyReturn = 4,
KeyEnter = 5,
KeyInsert = 6,
KeyDelete = 7,
@ -79,7 +80,7 @@ namespace Fw
KeyCtrl = 21,
KeyShift = 22,
KeyAlt = 23,
KeyAltGr = 24,
//KeyAltGr = 24,
KeyMeta = 25,
KeyMenu = 26,
KeySpace = 32, // ' '

View File

@ -71,10 +71,10 @@ WIN32Window::WIN32Window()
m_keyMap[VK_RSHIFT] = Fw::KeyShift;
m_keyMap[VK_MENU] = Fw::KeyAlt;
m_keyMap[VK_LMENU] = Fw::KeyAlt;
m_keyMap[VK_RMENU] = Fw::KeyAltGr;
m_keyMap[VK_RMENU] = Fw::KeyAlt;
m_keyMap[VK_LWIN] = Fw::KeyMeta;
m_keyMap[VK_RWIN] = Fw::KeyMeta;
m_keyMap[VK_MENU] = Fw::KeyMenu;
m_keyMap[VK_APPS] = Fw::KeyMenu;
// ascii characters
/*
@ -163,18 +163,6 @@ WIN32Window::WIN32Window()
m_keyMap[VK_DIVIDE] = Fw::KeySlash;
m_keyMap[VK_MULTIPLY] = Fw::KeyAsterisk;
// keypad with numlock off
m_keyMap[VK_NUMPAD0] = Fw::KeyNumpad0;
m_keyMap[VK_NUMPAD1] = Fw::KeyNumpad1;
m_keyMap[VK_NUMPAD2] = Fw::KeyNumpad2;
m_keyMap[VK_NUMPAD3] = Fw::KeyNumpad3;
m_keyMap[VK_NUMPAD4] = Fw::KeyNumpad4;
m_keyMap[VK_NUMPAD5] = Fw::KeyNumpad5;
m_keyMap[VK_NUMPAD6] = Fw::KeyNumpad6;
m_keyMap[VK_NUMPAD7] = Fw::KeyNumpad7;
m_keyMap[VK_NUMPAD8] = Fw::KeyNumpad8;
m_keyMap[VK_NUMPAD9] = Fw::KeyNumpad9;
m_keyMap[VK_OEM_1] = Fw::KeySemicolon;
m_keyMap[VK_OEM_2] = Fw::KeySlash;
m_keyMap[VK_OEM_3] = Fw::KeyGrave;
@ -432,39 +420,32 @@ Fw::Key WIN32Window::retranslateVirtualKey(WPARAM wParam, LPARAM lParam)
// retranslate numpad keys
switch(wParam) {
case VK_INSERT:
wParam = VK_NUMPAD0;
break;
return Fw::KeyNumpad0;
case VK_END:
wParam = VK_NUMPAD1;
break;
return Fw::KeyNumpad1;
case VK_DOWN:
wParam = VK_NUMPAD2;
break;
return Fw::KeyNumpad2;
case VK_NEXT:
wParam = VK_NUMPAD3;
break;
return Fw::KeyNumpad3;
case VK_LEFT:
wParam = VK_NUMPAD4;
break;
return Fw::KeyNumpad4;
case VK_CLEAR:
wParam = VK_NUMPAD5;
break;
return Fw::KeyNumpad5;
case VK_RIGHT:
wParam = VK_NUMPAD6;
break;
return Fw::KeyNumpad6;
case VK_HOME:
wParam = VK_NUMPAD7;
break;
return Fw::KeyNumpad7;
case VK_UP:
wParam = VK_NUMPAD8;
break;
return Fw::KeyNumpad8;
case VK_PRIOR:
wParam = VK_NUMPAD9;
break;
return Fw::KeyNumpad9;
}
}
return m_keyMap[wParam];
if(m_keyMap.find(wParam) != m_keyMap.end())
return m_keyMap[wParam];
return Fw::KeyUnknown;
}
LRESULT WIN32Window::windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

View File

@ -77,7 +77,7 @@ X11Window::X11Window()
m_keyMap[XK_Control_R] = Fw::KeyCtrl;
m_keyMap[XK_Shift_R] = Fw::KeyShift;
m_keyMap[XK_Shift_L] = Fw::KeyShift;
m_keyMap[XK_Alt_R] = Fw::KeyAltGr;
m_keyMap[XK_Alt_R] = Fw::KeyAlt;
m_keyMap[XK_Alt_L] = Fw::KeyAlt;
m_keyMap[XK_Meta_L] = Fw::KeyMeta;
m_keyMap[XK_Meta_R] = Fw::KeyMeta;
@ -545,6 +545,7 @@ void X11Window::poll()
char buf[32];
int len = XLookupString(&xkey, buf, sizeof(buf), &keysym, 0);
Fw::Key keyCode = Fw::KeyUnknown;
if(m_keyMap.find(keysym) != m_keyMap.end())
keyCode = m_keyMap[keysym];