From dc46da0e24666c67c1780b24e58151d31d8ba34c Mon Sep 17 00:00:00 2001 From: Madhav Kanbur Date: Tue, 13 Oct 2020 11:02:58 +0530 Subject: [PATCH] Input : Treat numpad keys as keypresses Typically, modifiers are masked out of keypresses to distinguish between hotkeys and keypresses. This patch prevents the numpad modifier from getting masked out in KeyPress() and KeyRelease(). Signed-off-by: Madhav Kanbur --- src/frontend/qt_sdl/Input.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/frontend/qt_sdl/Input.cpp b/src/frontend/qt_sdl/Input.cpp index 84d20adf..11b64ccb 100644 --- a/src/frontend/qt_sdl/Input.cpp +++ b/src/frontend/qt_sdl/Input.cpp @@ -98,7 +98,9 @@ int GetEventKeyVal(QKeyEvent* event) void KeyPress(QKeyEvent* event) { int keyHK = GetEventKeyVal(event); - int keyKP = keyHK & ~event->modifiers(); + int keyKP = keyHK; + if (event->modifiers() != Qt::KeypadModifier) + keyKP &= ~event->modifiers(); for (int i = 0; i < 12; i++) if (keyKP == Config::KeyMapping[i]) @@ -112,7 +114,9 @@ void KeyPress(QKeyEvent* event) void KeyRelease(QKeyEvent* event) { int keyHK = GetEventKeyVal(event); - int keyKP = keyHK & ~event->modifiers(); + int keyKP = keyHK; + if (event->modifiers() != Qt::KeypadModifier) + keyKP &= ~event->modifiers(); for (int i = 0; i < 12; i++) if (keyKP == Config::KeyMapping[i])