From 9287713cb8f80cd82a662db710eb444101a717bd Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sun, 14 Apr 2019 02:35:38 +0200 Subject: [PATCH] Ref T606, added back/tab/ESC as hotkeys --- src/blackgui/components/hotkeydialog.cpp | 1 + src/blackinput/linux/keyboardlinux.cpp | 3 +++ src/blackinput/macos/keyboardmacos.mm | 5 ++++- src/blackinput/win/keyboardwindows.cpp | 3 +++ src/blackmisc/input/keyboardkey.cpp | 5 ++++- src/blackmisc/input/keyboardkeylist.cpp | 3 +++ src/blackmisc/input/keycodes.h | 3 +++ 7 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/blackgui/components/hotkeydialog.cpp b/src/blackgui/components/hotkeydialog.cpp index 204818bdb..efbec6a86 100644 --- a/src/blackgui/components/hotkeydialog.cpp +++ b/src/blackgui/components/hotkeydialog.cpp @@ -314,6 +314,7 @@ namespace BlackGui void CHotkeyDialog::setupAdvancedFrame() { + if (!sGui || sGui->isShuttingDown()) { return; } this->clearAdvancedFrame(); const CKeyboardKeyList allSupportedKeys = CKeyboardKeyList::allSupportedKeys(); const CJoystickButtonList allAvailableButtons = sGui->getInputManager()->getAllAvailableJoystickButtons(); diff --git a/src/blackinput/linux/keyboardlinux.cpp b/src/blackinput/linux/keyboardlinux.cpp index b2b996bc0..dd2789195 100644 --- a/src/blackinput/linux/keyboardlinux.cpp +++ b/src/blackinput/linux/keyboardlinux.cpp @@ -73,6 +73,9 @@ namespace BlackInput { XK_period, Key_Period }, { XK_KP_Divide, Key_Divide }, { XK_KP_Multiply, Key_Multiply }, + { XK_BackSpace, Key_Back }, + { XK_Tab, Key_Tab }, + { XK_Escape, Key_Esc }, { XK_comma, Key_Comma }, }; diff --git a/src/blackinput/macos/keyboardmacos.mm b/src/blackinput/macos/keyboardmacos.mm index 1fce1f943..3cedf7c20 100644 --- a/src/blackinput/macos/keyboardmacos.mm +++ b/src/blackinput/macos/keyboardmacos.mm @@ -62,8 +62,11 @@ namespace BlackInput { kHIDUsage_KeypadHyphen, Key_Minus }, { kHIDUsage_KeyboardHyphen, Key_Minus }, { kHIDUsage_KeyboardPeriod, Key_Period }, - { kHIDUsage_KeypadSlash, Key_Divide }, { kHIDUsage_KeypadAsterisk, Key_Multiply }, + { kHIDUsage_KeypadSlash, Key_Divide }, + { kHIDUsage_KeyboardDeleteOrBackspace, Key_Back }, + { kHIDUsage_KeyboardTab, Key_Tab }, + { kHIDUsage_KeyboardEscape, Key_Esc }, { kHIDUsage_KeyboardComma, Key_Comma }, { kHIDUsage_Keypad0, Key_Numpad0 }, { kHIDUsage_Keypad1, Key_Numpad1 }, diff --git a/src/blackinput/win/keyboardwindows.cpp b/src/blackinput/win/keyboardwindows.cpp index a895aed01..c9b17fe75 100644 --- a/src/blackinput/win/keyboardwindows.cpp +++ b/src/blackinput/win/keyboardwindows.cpp @@ -64,6 +64,9 @@ namespace BlackInput { VK_OEM_MINUS, Key_Minus }, { VK_OEM_PERIOD, Key_Period }, { VK_DIVIDE, Key_Divide }, + { VK_BACK, Key_Back }, + { VK_TAB, Key_Tab }, + { VK_ESCAPE, Key_Esc }, { VK_MULTIPLY, Key_Multiply }, { VK_OEM_COMMA, Key_Comma }, { VK_NUMPAD0, Key_Numpad0 }, diff --git a/src/blackmisc/input/keyboardkey.cpp b/src/blackmisc/input/keyboardkey.cpp index bf51160b7..fb0492fd2 100644 --- a/src/blackmisc/input/keyboardkey.cpp +++ b/src/blackmisc/input/keyboardkey.cpp @@ -68,6 +68,9 @@ namespace BlackMisc case Key_Numpad7: return QStringLiteral("Num7"); case Key_Numpad8: return QStringLiteral("Num8"); case Key_Numpad9: return QStringLiteral("Num9"); + case Key_Esc: return QStringLiteral("ESC"); + case Key_Tab: return QStringLiteral("Tab"); + case Key_Back: return QStringLiteral("Backspace"); default: return QChar::fromLatin1(static_cast(m_keyCode)); } } @@ -105,7 +108,7 @@ namespace BlackMisc void CKeyboardKey::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) { if (index.isMyself()) { (*this) = variant.to(); return; } - ColumnIndex i = index.frontCasted(); + const ColumnIndex i = index.frontCasted(); switch (i) { case IndexKey: diff --git a/src/blackmisc/input/keyboardkeylist.cpp b/src/blackmisc/input/keyboardkeylist.cpp index eeef8bbf8..dd59b8575 100644 --- a/src/blackmisc/input/keyboardkeylist.cpp +++ b/src/blackmisc/input/keyboardkeylist.cpp @@ -45,6 +45,9 @@ namespace BlackMisc CKeyboardKey(Key_Comma), CKeyboardKey(Key_Multiply), CKeyboardKey(Key_Divide), + CKeyboardKey(Key_Back), + CKeyboardKey(Key_Tab), + CKeyboardKey(Key_Esc), CKeyboardKey(Key_A), CKeyboardKey(Key_B), CKeyboardKey(Key_C), diff --git a/src/blackmisc/input/keycodes.h b/src/blackmisc/input/keycodes.h index 38cde8cf4..bb5b88fa7 100644 --- a/src/blackmisc/input/keycodes.h +++ b/src/blackmisc/input/keycodes.h @@ -27,6 +27,9 @@ namespace BlackMisc Key_ControlRight, Key_AltLeft, Key_AltRight, + Key_Back, + Key_Tab, + Key_Esc, Key_Plus = 43, Key_Comma, Key_Minus,