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 KeyCtrl = 21
KeyShift = 22 KeyShift = 22
KeyAlt = 23 KeyAlt = 23
KeyAltGr = 24
KeyMeta = 25 KeyMeta = 25
KeyMenu = 26 KeyMenu = 26
KeySpace = 32 -- ' ' KeySpace = 32 -- ' '
@ -201,7 +200,6 @@ KeyCodeDescs = {
[KeyCtrl] = 'Ctrl', [KeyCtrl] = 'Ctrl',
[KeyShift] = 'Shift', [KeyShift] = 'Shift',
[KeyAlt] = 'Alt', [KeyAlt] = 'Alt',
[KeyAltGr] = 'AltGr',
[KeyMeta] = 'Meta', [KeyMeta] = 'Meta',
[KeyMenu] = 'Menu', [KeyMenu] = 'Menu',
[KeySpace] = 'Space', [KeySpace] = 'Space',

View File

@ -29,7 +29,7 @@ end
local function determineKeyComboDesc(keyCode, keyboardModifiers) local function determineKeyComboDesc(keyCode, keyboardModifiers)
local keyCombo = {} 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) table.insert(keyCombo, keyCode)
elseif KeyCodeDescs[keyCode] ~= nil then elseif KeyCodeDescs[keyCode] ~= nil then
if keyboardModifiers == KeyboardCtrlModifier then if keyboardModifiers == KeyboardCtrlModifier then

View File

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

View File

@ -71,10 +71,10 @@ WIN32Window::WIN32Window()
m_keyMap[VK_RSHIFT] = Fw::KeyShift; m_keyMap[VK_RSHIFT] = Fw::KeyShift;
m_keyMap[VK_MENU] = Fw::KeyAlt; m_keyMap[VK_MENU] = Fw::KeyAlt;
m_keyMap[VK_LMENU] = 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_LWIN] = Fw::KeyMeta;
m_keyMap[VK_RWIN] = Fw::KeyMeta; m_keyMap[VK_RWIN] = Fw::KeyMeta;
m_keyMap[VK_MENU] = Fw::KeyMenu; m_keyMap[VK_APPS] = Fw::KeyMenu;
// ascii characters // ascii characters
/* /*
@ -163,18 +163,6 @@ WIN32Window::WIN32Window()
m_keyMap[VK_DIVIDE] = Fw::KeySlash; m_keyMap[VK_DIVIDE] = Fw::KeySlash;
m_keyMap[VK_MULTIPLY] = Fw::KeyAsterisk; 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_1] = Fw::KeySemicolon;
m_keyMap[VK_OEM_2] = Fw::KeySlash; m_keyMap[VK_OEM_2] = Fw::KeySlash;
m_keyMap[VK_OEM_3] = Fw::KeyGrave; m_keyMap[VK_OEM_3] = Fw::KeyGrave;
@ -432,39 +420,32 @@ Fw::Key WIN32Window::retranslateVirtualKey(WPARAM wParam, LPARAM lParam)
// retranslate numpad keys // retranslate numpad keys
switch(wParam) { switch(wParam) {
case VK_INSERT: case VK_INSERT:
wParam = VK_NUMPAD0; return Fw::KeyNumpad0;
break;
case VK_END: case VK_END:
wParam = VK_NUMPAD1; return Fw::KeyNumpad1;
break;
case VK_DOWN: case VK_DOWN:
wParam = VK_NUMPAD2; return Fw::KeyNumpad2;
break;
case VK_NEXT: case VK_NEXT:
wParam = VK_NUMPAD3; return Fw::KeyNumpad3;
break;
case VK_LEFT: case VK_LEFT:
wParam = VK_NUMPAD4; return Fw::KeyNumpad4;
break;
case VK_CLEAR: case VK_CLEAR:
wParam = VK_NUMPAD5; return Fw::KeyNumpad5;
break;
case VK_RIGHT: case VK_RIGHT:
wParam = VK_NUMPAD6; return Fw::KeyNumpad6;
break;
case VK_HOME: case VK_HOME:
wParam = VK_NUMPAD7; return Fw::KeyNumpad7;
break;
case VK_UP: case VK_UP:
wParam = VK_NUMPAD8; return Fw::KeyNumpad8;
break;
case VK_PRIOR: case VK_PRIOR:
wParam = VK_NUMPAD9; return Fw::KeyNumpad9;
break;
} }
} }
if(m_keyMap.find(wParam) != m_keyMap.end())
return m_keyMap[wParam]; return m_keyMap[wParam];
return Fw::KeyUnknown;
} }
LRESULT WIN32Window::windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 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_Control_R] = Fw::KeyCtrl;
m_keyMap[XK_Shift_R] = Fw::KeyShift; m_keyMap[XK_Shift_R] = Fw::KeyShift;
m_keyMap[XK_Shift_L] = 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_Alt_L] = Fw::KeyAlt;
m_keyMap[XK_Meta_L] = Fw::KeyMeta; m_keyMap[XK_Meta_L] = Fw::KeyMeta;
m_keyMap[XK_Meta_R] = Fw::KeyMeta; m_keyMap[XK_Meta_R] = Fw::KeyMeta;
@ -545,6 +545,7 @@ void X11Window::poll()
char buf[32]; char buf[32];
int len = XLookupString(&xkey, buf, sizeof(buf), &keysym, 0); int len = XLookupString(&xkey, buf, sizeof(buf), &keysym, 0);
Fw::Key keyCode = Fw::KeyUnknown; Fw::Key keyCode = Fw::KeyUnknown;
if(m_keyMap.find(keysym) != m_keyMap.end()) if(m_keyMap.find(keysym) != m_keyMap.end())
keyCode = m_keyMap[keysym]; keyCode = m_keyMap[keysym];