[AD] Support for non-blocking menus |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
The following patch
http://www.multimania.com/ebotcazou/dev/update_menu.zip
implements the support for non-blocking menus we discussed some time ago.
It splits the former do_menu() into init_menu(), update_menu() and
shutdown_menu() and reimplements it by means of these three new functions. It
basically transforms recursive allocations on the stack by do_menu() into
successive allocations on the heap of a MENU_PLAYER structure that holds the
state of each nested menu and is updated on each call to update_menu().
Following Bob's suggestion, it also redirects update_dialog() to update_menu()
whenever a d_menu_proc dialog is activated, thus turning update_dialog() into
a true non-blocking function too.
Tested under DOS, Windows, Linux and commited. The code is probably not
reentrant, but its current shape is IMHO good enough for a first try.
--
Eric Botcazou