Browse Source

Filter out the keypad modifier from Keyboard input.

It's not really necessary to have the `Num+` string in the matching and
it doesn't make sense to map things differently depending on the keypad
or not.
Tobias Hieta 9 years ago
parent
commit
fe9a9cf0ef
2 changed files with 11 additions and 10 deletions
  1. 8 9
      resources/inputmaps/keyboard.json
  2. 3 1
      src/ui/KonvergoWindow.cpp

+ 8 - 9
resources/inputmaps/keyboard.json

@@ -3,17 +3,17 @@
   "idmatcher": "Keyboard.*",
   "mapping":
   {
-    // standard navigation, we allow num and shift modifiers
-    "(Num\\+|Shift\\+)?Left": "left",
-    "(Num\\+|Shift\\+)?Right": "right",
-    "(Num\\+|Shift\\+)?Up": "up",
-    "(Num\\+|Shift\\+)?Down": "down",
-    "(Num\\+)?(Return|Enter)": "enter",
+    // standard navigation, we allow shift modifiers
+    "(Shift\\+)?Left": "left",
+    "(Shift\\+)?Right": "right",
+    "(Shift\\+)?Up": "up",
+    "(Shift\\+)?Down": "down",
+    "(Return|Enter)": "enter",
     "Space": "space",
     "(Esc|Backspace)": "back",
 
-    // map Num+X and Shift+X to X. This allows normal number input
-    "(?:Num\\+|Shift\\+)?([0-9])": "%1",
+    // map X and Shift+X to X. This allows normal number input
+    "(?:Shift\\+)?([0-9])": "%1",
 
     // map some other normal buttons that might be useful
     "(?:Shift\\+)?(\\.|\\:|\\_)": "%1",
@@ -65,7 +65,6 @@
 
     // Windows Media Center keyboard shortcuts
     "Alt\\+(Return|Enter)": "host:fullscreen",
-    "Ctrl\\+P": "pause",
     "Ctrl\\+Shift\\+P": "play_pause",
     "Ctrl\\+Shift\\+S": "stop",
     "Ctrl\\+Shift\\+B": "seek_backward",

+ 3 - 1
src/ui/KonvergoWindow.cpp

@@ -44,7 +44,9 @@ bool MouseEventFilter::eventFilter(QObject* watched, QEvent* event)
       system.setCursorVisibility(false);
       if (kevent->spontaneous())
       {
-        InputKeyboard::Get().keyPress(QKeySequence(kevent->key() | kevent->modifiers()));
+        // We ignore the KeypadModifier here since it's practically useless
+        QKeySequence key(kevent->key() | (kevent->modifiers() &= ~Qt::KeypadModifier));
+        InputKeyboard::Get().keyPress(key);
         return true;
       }
     }