1
1

tweaks: elide an 'if', by moving the relevant code to a better place

Этот коммит содержится в:
Benno Schulenberg 2020-01-17 19:11:06 +01:00
родитель 7567a67cdd
Коммит 486d4956ff

Просмотреть файл

@ -1617,7 +1617,6 @@ int get_mouseinput(int *mouse_y, int *mouse_x, bool allow_shortcuts)
{ {
MEVENT mevent; MEVENT mevent;
bool in_bottomwin; bool in_bottomwin;
funcstruct *f;
/* First, get the actual mouse event. */ /* First, get the actual mouse event. */
if (getmouse(&mevent) == ERR) if (getmouse(&mevent) == ERR)
@ -1675,25 +1674,24 @@ int get_mouseinput(int *mouse_y, int *mouse_x, bool allow_shortcuts)
if (index > number) if (index > number)
return 2; return 2;
/* Go through the list of functions to determine which /* Search through the list of functions to determine which
* shortcut in the current menu we clicked/released on. */ * shortcut in the current menu the user clicked on; then
for (f = allfuncs; f != NULL; f = f->next) { * put the corresponding keystroke into the keyboard buffer. */
for (funcstruct *f = allfuncs; f != NULL; f = f->next) {
if ((f->menus & currmenu) == 0) if ((f->menus & currmenu) == 0)
continue; continue;
if (first_sc_for(currmenu, f->func) == NULL) if (first_sc_for(currmenu, f->func) == NULL)
continue; continue;
/* Tick off an actually shown shortcut. */ if (--index == 0) {
if (--index == 0) const keystruct *shortcut = first_sc_for(currmenu, f->func);
put_back(shortcut->keycode);
if (shortcut->meta)
put_back(ESC_CODE);
break; break;
}
} }
/* And put the corresponding key into the keyboard buffer. */
if (f != NULL) {
const keystruct *s = first_sc_for(currmenu, f->func);
put_back(s->keycode);
if (s->meta)
put_back(ESC_CODE);
}
return 1; return 1;
} else } else
/* Clicks outside of bottomwin are handled elsewhere. */ /* Clicks outside of bottomwin are handled elsewhere. */