Don't send an EVENT_WINDOW_DEACTIVATED when closing a window if it wasn't the front window, now the game works properly after you're shown on the high scores

This commit is contained in:
kreatordxx 2010-02-08 06:08:55 +00:00
parent 224f3b1b35
commit 970fd8c2d2
2 changed files with 14 additions and 5 deletions

View file

@ -4,6 +4,7 @@ D1X-Rebirth Changelog
--------
main/menu.c, main/scores.c, main/scores.h: Move all globals in scores.c into struct members/local variables
main/game.c, main/newdemo.c: Don't make another Game_wind when advancing a level, fixing failed asserts / slow turning
arch/sdl/window.c: Don't send an EVENT_WINDOW_DEACTIVATED when closing a window if it wasn't the front window, now the game works properly after you're shown on the high scores
20100207
--------

View file

@ -68,14 +68,22 @@ int window_close(window *wind)
d_event event;
int (*w_callback)(window *wind, d_event *event, void *data) = wind->w_callback;
event.type = EVENT_WINDOW_DEACTIVATED; // Deactivate first
window_send_event(wind, &event);
if (wind == window_get_front())
{
event.type = EVENT_WINDOW_DEACTIVATED; // Deactivate first
window_send_event(wind, &event);
}
event.type = EVENT_WINDOW_CLOSE;
if (window_send_event(wind, &event))
{
event.type = EVENT_WINDOW_ACTIVATED; // Reactivate. May cause flashing of some sort, too bad
window_send_event(wind, &event);
return 0; // user 'handled' the event, cancelling close
// User 'handled' the event, cancelling close
if (wind == window_get_front())
{
event.type = EVENT_WINDOW_ACTIVATED; // Reactivate. May cause flashing of some sort, too bad
window_send_event(wind, &event);
}
return 0;
}
if (wind == FrontWindow)