[AD] Non-blocking menus block when active, patch |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Greetings, all. I noticed some time ago (shortly after the non-blocking menu code was added to 4.1.6) that menu objects seem to block when active, i.e. when clicked or when the mouse moves over it.
Attached is a patch (against CVS gui.c:1.61, grabbed from CVS shortly before this e-mail) that works around that, though I'm not certain it's the most clean patch possible, as I'm not fluent in the GUI code.
Perhaps shutdown_menu() should be called before another object closes the dialog, or perhaps a message should be sent to the menu object to get it to shut itself down?
Also, I am more than a bit concerned about the usage of yield_timeslice() in all dialogs where a menu is active. If the menu is non-blocking, then the app may very well not be idle, despite the menu being active. If the app IS active, then it should know well enough to yield timeslices. A compromise would be to provide an alternate d_menu_proc() that does automatically yield timeslices. Forcing it for any case where menus are in use seems likely to cause reduced app responsiveness.
Charles Bilyue' (TRAC)
--- gui.c.old Wed Mar 5 11:48:34 2003
+++ gui.c Wed Mar 5 11:54:18 2003
@@ -880,17 +880,18 @@
if (active_menu_player) {
yield_timeslice();
- if (update_menu(active_menu_player))
- return TRUE;
+ if (!update_menu(active_menu_player))
+ {
- for (c=0; player->dialog[c].proc; c++)
- if (&player->dialog[c] == active_menu_player->dialog)
- break;
-
- MESSAGE(c, MSG_LOSTMOUSE, 0);
- goto getout;
+ for (c=0; player->dialog[c].proc; c++)
+ if (&player->dialog[c] == active_menu_player->dialog)
+ break;
+
+ MESSAGE(c, MSG_LOSTMOUSE, 0);
+ goto getout;
+ }
}
-
+
if (player->res & D_CLOSE)
return FALSE;