Wait until window is exposed before getting surface. (Initial screen

draw could be incomplete without this.)
This commit is contained in:
William McBrine
2021-10-10 02:40:21 -04:00
parent 74820e208a
commit debea8cfec

View File

@@ -159,6 +159,7 @@ int _get_displaynum(void)
int PDC_scr_open(void)
{
SDL_Event event;
int displaynum = 0;
PDC_LOG(("PDC_scr_open() - called\n"));
@@ -293,6 +294,13 @@ int PDC_scr_open(void)
SDL_PumpEvents();
/* Wait until window is exposed before getting surface */
while (SDL_PollEvent(&event))
if (SDL_WINDOWEVENT == event.type &&
SDL_WINDOWEVENT_EXPOSED == event.window.event)
break;
if (!pdc_screen)
{
pdc_screen = SDL_GetWindowSurface(pdc_window);