more little changes to typeahead (thanks Matteo, plus changes from me)
This commit is contained in:
parent
0d02b9bdf3
commit
b9e39764f3
1 changed files with 16 additions and 16 deletions
|
@ -352,20 +352,9 @@ void Menu::enterSubmenu() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::enterParent() {
|
void Menu::enterParent() {
|
||||||
if (parent() == 0)
|
internal_hide();
|
||||||
return;
|
|
||||||
|
|
||||||
if (validIndex(m_active_index)) {
|
|
||||||
Menu *submenu = menuitems[m_active_index]->submenu();
|
|
||||||
if (submenu)
|
|
||||||
submenu->internal_hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_active_index = -1;
|
|
||||||
// hide self
|
|
||||||
m_visible = false;
|
|
||||||
menu.window.hide();
|
|
||||||
// return focus to parent
|
// return focus to parent
|
||||||
|
if (parent())
|
||||||
parent()->grabInputFocus();
|
parent()->grabInputFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1038,6 +1027,11 @@ void Menu::keyPressEvent(XKeyEvent &event) {
|
||||||
hide();
|
hide();
|
||||||
break;
|
break;
|
||||||
case XK_BackSpace:
|
case XK_BackSpace:
|
||||||
|
if (m_type_ahead.stringSize() == 0) {
|
||||||
|
enterParent();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
m_type_ahead.putBackSpace();
|
m_type_ahead.putBackSpace();
|
||||||
drawTypeAheadItems();
|
drawTypeAheadItems();
|
||||||
break;
|
break;
|
||||||
|
@ -1059,8 +1053,14 @@ void Menu::keyPressEvent(XKeyEvent &event) {
|
||||||
break;
|
break;
|
||||||
case XK_Tab:
|
case XK_Tab:
|
||||||
case XK_ISO_Left_Tab:
|
case XK_ISO_Left_Tab:
|
||||||
|
if (validIndex(m_active_index) && isItemEnabled(m_active_index) &&
|
||||||
|
menuitems[m_active_index]->submenu() && m_matches.size() == 1) {
|
||||||
|
enterSubmenu();
|
||||||
|
m_type_ahead.reset();
|
||||||
|
} else {
|
||||||
m_type_ahead.seek();
|
m_type_ahead.seek();
|
||||||
cycleItems((bool)(event.state & ShiftMask));
|
cycleItems((bool)(event.state & ShiftMask));
|
||||||
|
}
|
||||||
drawTypeAheadItems();
|
drawTypeAheadItems();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue