summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-06-29 15:17:40 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-07-17 11:24:35 +0000
commit756266d01560157b7274e466b9ffc1b0e2ef9a1f (patch)
tree360e40c1de452931f3e6b30579aacc30e449a077 /src/platformsupport
parent26bcc0565f49c731a4f288f93f04056ca20136a5 (diff)
Map Shift+Tab to Shift+Backtab in evdevkeyboard
This mapping has to be done manually, like we do on Windows for example. libinput maps through xkbcommon, like xcb, so it is already correct. Task-number: QTBUG-46845 Change-Id: I61f3f1160e2581aae2ef43cc260f191f6d344fec Reviewed-by: Louai Al-Khanji <louai.al-khanji@theqtcompany.com>
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
index 16cb94dded..06751de0ef 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
@@ -379,17 +379,20 @@ QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint
}
if (!skip) {
- qCDebug(qLcEvdevKeyMap, "Processing: uni=%04x, qt=%08x, qtmod=%08x", unicode, qtcode & ~modmask, (qtcode & modmask));
- //If NumLockOff and keypad key pressed remap event sent
- if (!m_locks[1] &&
- (qtcode & Qt::KeypadModifier) &&
+ // Up until now qtcode contained both the key and modifiers. Split it.
+ Qt::KeyboardModifiers qtmods = Qt::KeyboardModifiers(qtcode & modmask);
+ qtcode &= ~modmask;
+
+ qCDebug(qLcEvdevKeyMap, "Processing: uni=%04x, qt=%08x, qtmod=%08x", unicode, qtcode, int(qtmods));
+
+ // If NumLockOff and keypad key pressed remap event sent
+ if (!m_locks[1] && (qtmods & Qt::KeypadModifier) &&
keycode >= 71 &&
keycode <= 83 &&
keycode != 74 &&
keycode != 78) {
unicode = 0xffff;
- int oldMask = (qtcode & modmask);
switch (keycode) {
case 71: //7 --> Home
qtcode = Qt::Key_Home;
@@ -425,11 +428,14 @@ QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint
qtcode = Qt::Key_Delete;
break;
}
- qtcode ^= oldMask;
}
- // send the result to the server
- processKeyEvent(keycode, unicode, qtcode & ~modmask, Qt::KeyboardModifiers(qtcode & modmask), pressed, autorepeat);
+ // Map SHIFT + Tab to SHIFT + Backtab, QShortcutMap knows about this translation
+ if (qtcode == Qt::Key_Tab && (qtmods & Qt::ShiftModifier) == Qt::ShiftModifier)
+ qtcode = Qt::Key_Backtab;
+
+ // Generate the QPA event.
+ processKeyEvent(keycode, unicode, qtcode, qtmods, pressed, autorepeat);
}
}
return result;