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 <abcdjdj@gmail.com>
This commit is contained in:
Madhav Kanbur 2020-10-13 11:02:58 +05:30
parent f8c4bf6db1
commit dc46da0e24
1 changed files with 6 additions and 2 deletions

View File

@ -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])