Re: [AD] d_menu_proc MSG_DRAW handling |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> I managed to get most of it working fairly well, but I was unable to get
> the popup menus from the menu bar to work as expected.
"popup menus from the menu bar" sounds contradictory to me: don't you mean
"scroll down menus from the menu bar" instead?
> Only the top-level menu bar is being redrawn. I checked the source, and
> realized that that is all it does handle; d_menu_proc will not redraw popup
> menus in response to a MSG_DRAW.
That's right. d_menu_proc knows only of the underlying static dialog object.
> I also noticed that there appears to be no way (in the external API, at
> least) to get a menu to redraw at all without using a d_menu_proc DIALOG?
That's right again. Redrawing is not a feature supported by menus themselves.
> I'll probably try my hand at figuring out how to modify the lib to redraw
> nested popup menus over the next few days, any input on any reasons for
> the current design or opinions on how I believe it should behave would be
> appreciated.
Dialogs and menus are two different beasts, driven by two different engines
that don't play nice with each other:
- the dialog engine assumes that the objects have fixed size and position and
_do not overlap_,
- the menu engine assumes that no other drawing operation is performed when a
menu is pulled down, so no need for redrawing.
The bridge between the two engines is d_menu_proc but it is only a bridge:
the two engines can't run simultaneously so:
- when a d_menu_proc is activated, the dialog engine is shut down and the
menu engine is woken up,
- when no d_menu_proc is activated, only the dialog engine is active.
What you want to do is to let the menu engine be driven by the dialog engine:
it means modifications of both engines. In particular, the dialog engine
should be taught the notion of z-order so that it knows that a menu is drawn
over another dialog object and sends its MSG_DRAW messages in the proper
order.
If you want to tackle this problem, I'd suggest you to use a very recent CVS
snapshots because there have been some modifications made to this code
recently.
--
Eric Botcazou