summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-02-23 14:46:33 +0100
committerTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-02-25 11:38:18 +0000
commit26961e32f34c06f083fe441c23be6874f03446a3 (patch)
tree2531a6f4e6dd6b69fc88bb3ef795c3b860f52624 /src
parentb690fe7cfa4f0586648922ce96b890aab978fe61 (diff)
QCocoaKeyMapper - correctly update key layouts
QCocoaKeyMapper has 2 bugs: - fails to update layouts even if input source changed - while looking for the possible keys it clears bits for neededMods thus making later shortcut match impossible Change-Id: Ie230b973acd5ca6f50b97ca4901ede61b581d273 Task-number: QTBUG-50865 Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/cocoa/qcocoakeymapper.mm16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.mm b/src/plugins/platforms/cocoa/qcocoakeymapper.mm
index 250f3f3bf7..ebe547f64b 100644
--- a/src/plugins/platforms/cocoa/qcocoakeymapper.mm
+++ b/src/plugins/platforms/cocoa/qcocoakeymapper.mm
@@ -390,6 +390,11 @@ bool QCocoaKeyMapper::updateKeyboard()
keyboardInputLocale = QLocale::c();
keyboardInputDirection = Qt::LeftToRight;
}
+
+ const auto newMode = keyboard_mode;
+ deleteLayouts();
+ keyboard_mode = newMode;
+
return true;
}
@@ -412,10 +417,8 @@ void QCocoaKeyMapper::clearMappings()
void QCocoaKeyMapper::updateKeyMap(unsigned short macVirtualKey, QChar unicodeKey)
{
- if (updateKeyboard()) {
- // ### Qt 4 did this:
- // QKeyMapper::changeKeyboard();
- }
+ updateKeyboard();
+
if (keyLayout[macVirtualKey])
return;
@@ -471,9 +474,8 @@ QList<int> QCocoaKeyMapper::possibleKeys(const QKeyEvent *event) const
for (int i = 1; i < 8; ++i) {
Qt::KeyboardModifiers neededMods = ModsTbl[i];
int key = kbItem->qtKey[i];
- if (key && key != baseKey && ((keyMods & neededMods) == neededMods)) {
- ret << int(key + (keyMods & ~neededMods));
- }
+ if (key && key != baseKey && ((keyMods & neededMods) == neededMods))
+ ret << int(key + neededMods);
}
return ret;
}