Re: [AD] new window hooks patch |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> Oh I see now!
> You rely on escape being a hotkey that quits the allegro program ?
> So basically every Allegro program using the windows version should
> allow esc to quit ?
> Is this what you mean ?
The program can also ignore the ESC keypress, but when the user tries to
close the window, nothing will happen (unless you hooked the event).
The choice of simulating an ESC keypress is more a comfort than anything
else: normally ESC has special behaviours, like terminating a program or
bringing up a menu... So it seems like the best default action to simulate it
when the user clicks on the window close button, as this fits perfectly in
the way Allegro test programs/examples currently works: almost all them end
when ESC is pressed, so with this patch applied when the user closes the
window, the program will actually quit.
If you think simulating a keypress when the user closes the window is bad, we
could make that selectable: what about modifying set_window_close_hook to
something like
set_window_close_hook(int keypress, void (*proc)())
Where "keypress" is the keypress to simulate (in the format of readkey()), 0
for none?
--
Angelo Mottola
a.mottola@xxxxxxxxxx
ICQ UIN #66972680