src/video/riscos/SDL_wimpvideo.c
changeset 634 44d574ed4780
parent 630 550bccdf04bd
child 769 b8d311d90021
     1.1 --- a/src/video/riscos/SDL_wimpvideo.c	Tue Jun 03 19:35:10 2003 +0000
     1.2 +++ b/src/video/riscos/SDL_wimpvideo.c	Sat Jun 14 07:18:40 2003 +0000
     1.3 @@ -80,6 +80,9 @@
     1.4  extern int mouseInWindow;
     1.5  extern int riscos_closeaction;
     1.6  
     1.7 +/* Following needed to ensure window is shown immediately */
     1.8 +extern int hasFocus;
     1.9 +extern void WIMP_Poll(_THIS, int waitTime);
    1.10  
    1.11  SDL_Surface *WIMP_SetVideoMode(_THIS, SDL_Surface *current,
    1.12  				int width, int height, int bpp, Uint32 flags)
    1.13 @@ -177,9 +180,21 @@
    1.14  	/* Reset device functions for the wimp */
    1.15  	WIMP_SetDeviceMode(this);
    1.16  
    1.17 -    /* Needs to set up plot info after window has been created */
    1.18 -    /* Not sure why, but plots don't work if I do it earlier */
    1.19 -    WIMP_SetupPlotInfo(this);
    1.20 +	/* Needs to set up plot info after window has been created */
    1.21 +	/* Not sure why, but plots don't work if I do it earlier */
    1.22 +	WIMP_SetupPlotInfo(this);
    1.23 +
    1.24 +	/* Poll until window is shown */
    1.25 +	{
    1.26 +	   /* We wait until it gets the focus, but give up after 5 seconds
    1.27 +	      in case the focus is prevented in any way.
    1.28 +	   */
    1.29 +	   Uint32 now = SDL_GetTicks();
    1.30 +	   while (!hasFocus && SDL_GetTicks() - now < 5000)
    1.31 +	   {
    1.32 +	      WIMP_Poll(this, 0);
    1.33 +	   }
    1.34 +	}
    1.35  
    1.36  	/* We're done */
    1.37  	return(current);