diff options
author | Ruslan Nigmatullin <euroelessar@yandex.ru> | 2014-09-27 00:19:36 +0300 |
---|---|---|
committer | Gatis Paeglis <gatis.paeglis@digia.com> | 2014-10-22 23:18:00 +0200 |
commit | 449b62ed436a8e45d1064b76dc9cc3201966bd91 (patch) | |
tree | f1974a04eacf4ed5cc340e7e51d35576edb81b7a | |
parent | 047f4c4d799f46c8c0aa44b594d3afe416758280 (diff) |
XCB: Don't trigger less specific shortcuts
Without this patch some keycodes like Ctrl+Shift+= may generate several
similar key sequences like Ctrl++ and + but only more specific keys
should be returned by QXcbKeyboard::possibleKeys.
Task-number: QTBUG-38137
Change-Id: I23f6522eefaa3b83cfa639f76bdc6a19b450c6f9
Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
-rw-r--r-- | src/plugins/platforms/xcb/qxcbkeyboard.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index fc3443aba5..dae3a79628 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -910,6 +910,18 @@ QList<int> QXcbKeyboard::possibleKeys(const QKeyEvent *event) const if (qtKey == baseQtKey || qtKey == 0) continue; + // catch only more specific shortcuts, i.e. Ctrl+Shift+= also generates Ctrl++ and +, + // but Ctrl++ is more specific than +, so we should skip the last one + bool ambiguous = false; + foreach (int shortcut, result) { + if (int(shortcut & ~Qt::KeyboardModifierMask) == qtKey && (shortcut & mods) == mods) { + ambiguous = true; + break; + } + } + if (ambiguous) + continue; + result += (qtKey + mods); } } |