Add more keyboard key codes assignable to hotkeys

F1-F12, CapsLock, Home, End, PgUp, PgDn, and some more numpad keys.
This commit is contained in:
Mat Sutcliffe
2021-11-13 01:13:52 +00:00
parent 7573d91854
commit b46d4c7bb9
6 changed files with 130 additions and 9 deletions

View File

@@ -73,16 +73,36 @@ namespace BlackInput
{ XK_period, Key_Period },
{ XK_KP_Divide, Key_Divide },
{ XK_KP_Multiply, Key_Multiply },
{ XK_KP_Subtract, Key_NumpadMinus },
{ XK_KP_Add, Key_NumpadPlus },
{ XK_KP_Delete, Key_NumpadDelete },
{ XK_BackSpace, Key_Back },
{ XK_Tab, Key_Tab },
{ XK_Escape, Key_Esc },
{ XK_space, Key_Space },
{ XK_dead_grave, Key_DeadGrave },
{ XK_comma, Key_Comma }
{ XK_comma, Key_Comma },
{ XK_Delete, Key_Delete },
{ XK_Insert, Key_Insert },
{ XK_Home, Key_Home },
{ XK_End, Key_End },
{ XK_Page_Up, Key_PageUp },
{ XK_Page_Down, Key_PageDown },
{ XK_Caps_Lock, Key_CapsLock },
{ XK_F1, Key_Function1 },
{ XK_F2, Key_Function2 },
{ XK_F3, Key_Function3 },
{ XK_F4, Key_Function4 },
{ XK_F5, Key_Function5 },
{ XK_F6, Key_Function6 },
{ XK_F7, Key_Function7 },
{ XK_F8, Key_Function8 },
{ XK_F9, Key_Function9 },
{ XK_F10, Key_Function10 },
{ XK_F11, Key_Function11 },
{ XK_F12, Key_Function12 },
/** fixme Missing ones
Key_Insert,
Key_Delete,
CKeyboardKey(Key_NumpadEqual),
CKeyboardKey(Key_OEM1),
CKeyboardKey(Key_OEM2),

View File

@@ -64,6 +64,9 @@ namespace BlackInput
{ kHIDUsage_KeyboardPeriod, Key_Period },
{ kHIDUsage_KeypadAsterisk, Key_Multiply },
{ kHIDUsage_KeypadSlash, Key_Divide },
{ kHIDUsage_KeypadHyphen, Key_NumpadMinus },
{ kHIDUsage_KeypadPlus, Key_NumpadPlus },
{ kHIDUsage_KeypadPeriod, Key_NumpadDelete },
{ kHIDUsage_KeyboardDeleteOrBackspace, Key_Back },
{ kHIDUsage_KeyboardTab, Key_Tab },
{ kHIDUsage_KeyboardEscape, Key_Esc },
@@ -83,11 +86,28 @@ namespace BlackInput
{ kHIDUsage_KeyboardRightControl, Key_ControlRight },
{ kHIDUsage_KeyboardLeftControl, Key_ControlLeft },
{ kHIDUsage_KeyboardRightAlt, Key_AltRight },
{ kHIDUsage_KeyboardLeftAlt, Key_AltLeft }
{ kHIDUsage_KeyboardLeftAlt, Key_AltLeft },
{ kHIDUsage_KeyboardInsert, Key_Insert },
{ kHIDUsage_KeyboardDeleteForward, Key_Delete },
{ kHIDUsage_KeyboardHome, Key_Home },
{ kHIDUsage_KeyboardEnd, Key_End },
{ kHIDUsage_KeyboardPageUp, Key_PageUp },
{ kHIDUsage_KeyboardPageDown, Key_PageDown },
{ kHIDUsage_KeyboardCapsLock, Key_CapsLock },
{ kHIDUsage_KeyboardF1, Key_Function1 },
{ kHIDUsage_KeyboardF2, Key_Function2 },
{ kHIDUsage_KeyboardF3, Key_Function3 },
{ kHIDUsage_KeyboardF4, Key_Function4 },
{ kHIDUsage_KeyboardF5, Key_Function5 },
{ kHIDUsage_KeyboardF6, Key_Function6 },
{ kHIDUsage_KeyboardF7, Key_Function7 },
{ kHIDUsage_KeyboardF8, Key_Function8 },
{ kHIDUsage_KeyboardF9, Key_Function9 },
{ kHIDUsage_KeyboardF10, Key_Function10 },
{ kHIDUsage_KeyboardF11, Key_Function11 },
{ kHIDUsage_KeyboardF12, Key_Function12 },
/** fixme Missing ones
Key_Insert,
Key_Delete,
CKeyboardKey(Key_NumpadEqual),
CKeyboardKey(Key_OEM1),
CKeyboardKey(Key_OEM2),

View File

@@ -70,7 +70,15 @@ namespace BlackInput
{ VK_SPACE, Key_Space },
{ VK_INSERT, Key_Insert },
{ VK_DELETE, Key_Delete },
{ VK_HOME, Key_Home },
{ VK_END, Key_End },
{ VK_PRIOR, Key_PageUp },
{ VK_NEXT, Key_PageDown },
{ VK_CAPITAL, Key_CapsLock },
{ VK_MULTIPLY, Key_Multiply },
{ VK_SUBTRACT, Key_NumpadMinus },
{ VK_ADD, Key_NumpadPlus },
{ VK_DECIMAL, Key_NumpadDelete },
{ VK_NUMPAD0, Key_Numpad0 },
{ VK_NUMPAD1, Key_Numpad1 },
{ VK_NUMPAD2, Key_Numpad2 },
@@ -91,7 +99,19 @@ namespace BlackInput
{ VK_OEM_6, Key_OEM6 },
{ VK_OEM_7, Key_OEM7 },
{ VK_OEM_8, Key_OEM8 },
{ VK_OEM_102, Key_OEM102 }
{ VK_OEM_102, Key_OEM102 },
{ VK_F1, Key_Function1 },
{ VK_F2, Key_Function2 },
{ VK_F3, Key_Function3 },
{ VK_F4, Key_Function4 },
{ VK_F5, Key_Function5 },
{ VK_F6, Key_Function6 },
{ VK_F7, Key_Function7 },
{ VK_F8, Key_Function8 },
{ VK_F9, Key_Function9 },
{ VK_F10, Key_Function10 },
{ VK_F11, Key_Function11 },
{ VK_F12, Key_Function12 },
};
return hash;
}

View File

@@ -68,12 +68,20 @@ namespace BlackMisc::Input
case Key_Numpad8: return QStringLiteral("Num8");
case Key_Numpad9: return QStringLiteral("Num9");
case Key_NumpadEqual: return QStringLiteral("Num=");
case Key_NumpadMinus: return QStringLiteral("Num-");
case Key_NumpadPlus: return QStringLiteral("Num+");
case Key_NumpadDelete: return QStringLiteral("Num.");
case Key_Esc: return QStringLiteral("Esc");
case Key_Space: return QStringLiteral("Space");
case Key_Tab: return QStringLiteral("Tab");
case Key_Back: return QStringLiteral("Bksp");
case Key_Insert: return QStringLiteral("Ins");
case Key_Delete: return QStringLiteral("Del");
case Key_Home: return QStringLiteral("Home");
case Key_End: return QStringLiteral("End");
case Key_PageUp: return QStringLiteral("PgUp");
case Key_PageDown: return QStringLiteral("PgDn");
case Key_CapsLock: return QStringLiteral("CapsLock");
case Key_OEM1: return QStringLiteral("OEM1");
case Key_OEM2: return QStringLiteral("OEM2");
case Key_OEM3: return QStringLiteral("OEM3");
@@ -84,6 +92,18 @@ namespace BlackMisc::Input
case Key_OEM8: return QStringLiteral("OEM8");
case Key_OEM102: return QStringLiteral("OEM102");
case Key_DeadGrave: return QStringLiteral("DeadGrave");
case Key_Function1: return QStringLiteral("F1");
case Key_Function2: return QStringLiteral("F2");
case Key_Function3: return QStringLiteral("F3");
case Key_Function4: return QStringLiteral("F4");
case Key_Function5: return QStringLiteral("F5");
case Key_Function6: return QStringLiteral("F6");
case Key_Function7: return QStringLiteral("F7");
case Key_Function8: return QStringLiteral("F8");
case Key_Function9: return QStringLiteral("F9");
case Key_Function10: return QStringLiteral("F10");
case Key_Function11: return QStringLiteral("F11");
case Key_Function12: return QStringLiteral("F12");
default: return QChar::fromLatin1(static_cast<char>(m_keyCode));
}
}

View File

@@ -51,6 +51,11 @@ namespace BlackMisc::Input
CKeyboardKey(Key_Space),
CKeyboardKey(Key_Delete),
CKeyboardKey(Key_Insert),
CKeyboardKey(Key_Home),
CKeyboardKey(Key_End),
CKeyboardKey(Key_PageUp),
CKeyboardKey(Key_PageDown),
CKeyboardKey(Key_CapsLock),
CKeyboardKey(Key_DeadGrave),
CKeyboardKey(Key_A),
CKeyboardKey(Key_B),
@@ -99,6 +104,9 @@ namespace BlackMisc::Input
CKeyboardKey(Key_Numpad8),
CKeyboardKey(Key_Numpad9),
CKeyboardKey(Key_NumpadEqual),
CKeyboardKey(Key_NumpadMinus),
CKeyboardKey(Key_NumpadPlus),
CKeyboardKey(Key_NumpadDelete),
CKeyboardKey(Key_OEM1),
CKeyboardKey(Key_OEM2),
CKeyboardKey(Key_OEM3),
@@ -107,7 +115,19 @@ namespace BlackMisc::Input
CKeyboardKey(Key_OEM6),
CKeyboardKey(Key_OEM7),
CKeyboardKey(Key_OEM8),
CKeyboardKey(Key_OEM102)
CKeyboardKey(Key_OEM102),
CKeyboardKey(Key_Function1),
CKeyboardKey(Key_Function2),
CKeyboardKey(Key_Function3),
CKeyboardKey(Key_Function4),
CKeyboardKey(Key_Function5),
CKeyboardKey(Key_Function6),
CKeyboardKey(Key_Function7),
CKeyboardKey(Key_Function8),
CKeyboardKey(Key_Function9),
CKeyboardKey(Key_Function10),
CKeyboardKey(Key_Function11),
CKeyboardKey(Key_Function12),
};
return allKeys;

View File

@@ -30,6 +30,11 @@ namespace BlackMisc::Input
Key_Tab,
Key_Insert,
Key_Delete,
Key_Home,
Key_End,
Key_PageUp,
Key_PageDown,
Key_CapsLock,
Key_Esc = 27,
Key_Space = ' ',
Key_DeadGrave, // message is sent for a combining key, such as a diacritic.
@@ -89,6 +94,9 @@ namespace BlackMisc::Input
Key_Numpad8,
Key_Numpad9,
Key_NumpadEqual,
Key_NumpadPlus,
Key_NumpadMinus,
Key_NumpadDelete,
// OEM Keys
Key_OEM1,
Key_OEM2,
@@ -98,7 +106,20 @@ namespace BlackMisc::Input
Key_OEM6,
Key_OEM7,
Key_OEM8,
Key_OEM102
Key_OEM102,
// Function keys
Key_Function1,
Key_Function2,
Key_Function3,
Key_Function4,
Key_Function5,
Key_Function6,
Key_Function7,
Key_Function8,
Key_Function9,
Key_Function10,
Key_Function11,
Key_Function12,
};
} // namespace