tabbox: match Shift+Backtab against Shift+Tab

When users simultaneously press Shift and Tab, the keys are sometimes
registered as Shift+Tab, and sometimes as Shift+Backtab.
So we need to match received Shift+Tab against shortcuts containing
Shift+Backtab, and vice versa. Previously the code only checks for
the first case. This commit adds checks for the second case.

BUG: 438991
FIXED-IN: 6.0
This commit is contained in:
Yifan Zhu 2023-12-15 23:39:09 -08:00 committed by Vlad Zahorodnii
parent a02545e8f5
commit bc73e14e68

View file

@ -998,15 +998,16 @@ void TabBox::keyPress(int keyQt)
return Steady;
}
// Before testing the unshifted key (Ctrl+A vs. Ctrl+Shift+a etc.), see whether this is +Shift+Tab
// and check that against +Shift+Backtab (as well)
// Before testing the unshifted key (Ctrl+A vs. Ctrl+Shift+a etc.),
// see whether this is +Shift+Tab/Backtab and test that against
// +Shift+Backtab/Tab as well
Qt::KeyboardModifiers mods = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier | Qt::GroupSwitchModifier;
mods &= keyQt;
if ((keyQt & ~mods) == Qt::Key_Tab) {
if (contains(forward, mods | Qt::Key_Backtab)) {
if (((keyQt & ~mods) == Qt::Key_Tab) || ((keyQt & ~mods) == Qt::Key_Backtab)) {
if (contains(forward, mods | Qt::Key_Backtab) || contains(forward, mods | Qt::Key_Tab)) {
return Forward;
}
if (contains(backward, mods | Qt::Key_Backtab)) {
if (contains(backward, mods | Qt::Key_Backtab) || contains(backward, mods | Qt::Key_Tab)) {
return Backward;
}
}