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>
This commit is contained in:
parent
047f4c4d79
commit
449b62ed43
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user