- /* Return userdata as result */
- if (!menu->flags & MF_STICKY)
- {
- /* Store currently selected item before leaving. */
- if (menu->flags & MF_SAVESEL)
- CONST_CAST(struct Menu *, menu)->selected = selected;
- return item->userdata;
- }
+ /* Return immediately */
+ if (!(menu->flags & MF_STICKY))
+ break;
+
+ #if (CONFIG_MENU_TIMEOUT != 0)
+ /* Chain timeout */
+ if ((result == MENU_TIMEOUT) && !(menu->flags & MF_TOPLEVEL))
+ break;
+
+ /* Reset timeout */
+ menu_idle_time = timer_clock();
+ #endif