Send EVENT_WINDOW_DEACTIVATE before EVENT_WINDOW_ACTIVATE, ensuring cursor remains shown when appropriate
This commit is contained in:
parent
7c083d0834
commit
fa7ab97783
|
@ -4,6 +4,7 @@ D1X-Rebirth Changelog
|
||||||
--------
|
--------
|
||||||
main/game.c, main/gameseq.c, main/newdemo.c: Use palette_save and palette_restore for all windows displayed over Game_wind, not just for do_option
|
main/game.c, main/gameseq.c, main/newdemo.c: Use palette_save and palette_restore for all windows displayed over Game_wind, not just for do_option
|
||||||
main/gameseq.c, main/newmenu.c: No showing the main menu background between loading a level and playing it (syncing with D2X)
|
main/gameseq.c, main/newmenu.c: No showing the main menu background between loading a level and playing it (syncing with D2X)
|
||||||
|
main/window.c: Send EVENT_WINDOW_DEACTIVATE before EVENT_WINDOW_ACTIVATE, ensuring cursor remains shown when appropriate
|
||||||
|
|
||||||
20100202
|
20100202
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -30,7 +30,7 @@ window *window_create(grs_canvas *src, int x, int y, int w, int h, int (*event_c
|
||||||
{
|
{
|
||||||
window *wind;
|
window *wind;
|
||||||
window *prev = window_get_front();
|
window *prev = window_get_front();
|
||||||
d_event event = { EVENT_WINDOW_ACTIVATED };
|
d_event event;
|
||||||
|
|
||||||
wind = d_malloc(sizeof(window));
|
wind = d_malloc(sizeof(window));
|
||||||
if (wind == NULL)
|
if (wind == NULL)
|
||||||
|
@ -50,14 +50,15 @@ window *window_create(grs_canvas *src, int x, int y, int w, int h, int (*event_c
|
||||||
FrontWindow->next = wind;
|
FrontWindow->next = wind;
|
||||||
wind->next = NULL;
|
wind->next = NULL;
|
||||||
FrontWindow = wind;
|
FrontWindow = wind;
|
||||||
window_send_event(wind, &event);
|
|
||||||
|
|
||||||
if (prev)
|
if (prev)
|
||||||
{
|
{
|
||||||
event.type = EVENT_WINDOW_DEACTIVATED;
|
event.type = EVENT_WINDOW_DEACTIVATED;
|
||||||
window_send_event(prev, &event);
|
window_send_event(prev, &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event.type = EVENT_WINDOW_ACTIVATED;
|
||||||
|
window_send_event(wind, &event);
|
||||||
|
|
||||||
return wind;
|
return wind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +125,7 @@ window *window_get_next(window *wind)
|
||||||
void window_select(window *wind)
|
void window_select(window *wind)
|
||||||
{
|
{
|
||||||
window *prev = window_get_front();
|
window *prev = window_get_front();
|
||||||
d_event event = { EVENT_WINDOW_ACTIVATED };
|
d_event event;
|
||||||
|
|
||||||
Assert (wind != NULL);
|
Assert (wind != NULL);
|
||||||
|
|
||||||
|
@ -143,29 +144,31 @@ void window_select(window *wind)
|
||||||
|
|
||||||
if (window_is_visible(wind))
|
if (window_is_visible(wind))
|
||||||
{
|
{
|
||||||
window_send_event(wind, &event);
|
|
||||||
event.type = EVENT_WINDOW_DEACTIVATED;
|
event.type = EVENT_WINDOW_DEACTIVATED;
|
||||||
if (prev)
|
if (prev)
|
||||||
window_send_event(prev, &event);
|
window_send_event(prev, &event);
|
||||||
|
event.type = EVENT_WINDOW_ACTIVATED;
|
||||||
|
window_send_event(wind, &event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_set_visible(window *wind, int visible)
|
void window_set_visible(window *wind, int visible)
|
||||||
{
|
{
|
||||||
window *prev = window_get_front();
|
window *prev = window_get_front();
|
||||||
d_event event = { EVENT_WINDOW_ACTIVATED };
|
d_event event;
|
||||||
|
|
||||||
wind->w_visible = visible;
|
wind->w_visible = visible;
|
||||||
wind = window_get_front(); // get the new front window
|
wind = window_get_front(); // get the new front window
|
||||||
if (wind == prev)
|
if (wind == prev)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (wind)
|
|
||||||
window_send_event(wind, &event);
|
|
||||||
|
|
||||||
event.type = EVENT_WINDOW_DEACTIVATED;
|
event.type = EVENT_WINDOW_DEACTIVATED;
|
||||||
if (prev)
|
if (prev)
|
||||||
window_send_event(prev, &event);
|
window_send_event(prev, &event);
|
||||||
|
|
||||||
|
event.type = EVENT_WINDOW_ACTIVATED;
|
||||||
|
if (wind)
|
||||||
|
window_send_event(wind, &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
int window_is_visible(window *wind)
|
int window_is_visible(window *wind)
|
||||||
|
|
Loading…
Reference in a new issue