|
@@ -648,36 +648,48 @@ int Menu::choose(Door &door) {
|
|
unsigned int previous_choice = chosen;
|
|
unsigned int previous_choice = chosen;
|
|
changed.clear();
|
|
changed.clear();
|
|
|
|
|
|
- // od_get_input(&event, OD_NO_TIMEOUT, GETIN_NORMAL);
|
|
|
|
-
|
|
|
|
- if (event > XKEY_START) {
|
|
|
|
- switch (event) {
|
|
|
|
- case XKEY_UP_ARROW:
|
|
|
|
- if (chosen > 0) {
|
|
|
|
- chosen--;
|
|
|
|
- updated = true;
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
- case XKEY_DOWN_ARROW:
|
|
|
|
- if (chosen < lines.size() - 1) {
|
|
|
|
- chosen++;
|
|
|
|
- updated = true;
|
|
|
|
- }
|
|
|
|
|
|
+ bool use_numberpad = true;
|
|
|
|
+
|
|
|
|
+ // Don't use the numberpad, if some of the options are 8 or 2 (up/down)
|
|
|
|
+ for (const char &c : options) {
|
|
|
|
+ if ((c == '8') or (c == '2'))
|
|
|
|
+ use_numberpad = false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ switch (event) {
|
|
|
|
+ case '8':
|
|
|
|
+ if (!use_numberpad)
|
|
break;
|
|
break;
|
|
|
|
+ case XKEY_UP_ARROW:
|
|
|
|
+ if (chosen > 0) {
|
|
|
|
+ chosen--;
|
|
|
|
+ updated = true;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
|
|
- case XKEY_HOME:
|
|
|
|
- if (chosen != 0) {
|
|
|
|
- chosen = 0;
|
|
|
|
- updated = true;
|
|
|
|
- }
|
|
|
|
|
|
+ case '2':
|
|
|
|
+ if (!use_numberpad)
|
|
break;
|
|
break;
|
|
- case XKEY_END:
|
|
|
|
- if (chosen != lines.size() - 1) {
|
|
|
|
- chosen = lines.size() - 1;
|
|
|
|
- updated = true;
|
|
|
|
- }
|
|
|
|
|
|
+ case XKEY_DOWN_ARROW:
|
|
|
|
+ if (chosen < lines.size() - 1) {
|
|
|
|
+ chosen++;
|
|
|
|
+ updated = true;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case XKEY_HOME:
|
|
|
|
+ if (chosen != 0) {
|
|
|
|
+ chosen = 0;
|
|
|
|
+ updated = true;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case XKEY_END:
|
|
|
|
+ if (chosen != lines.size() - 1) {
|
|
|
|
+ chosen = lines.size() - 1;
|
|
|
|
+ updated = true;
|
|
}
|
|
}
|
|
- } else if (event == 0x0d) {
|
|
|
|
|
|
+ }
|
|
|
|
+ if (event == 0x0d) {
|
|
// ENTER -- use current selection
|
|
// ENTER -- use current selection
|
|
return chosen + 1;
|
|
return chosen + 1;
|
|
}
|
|
}
|