src/video/riscos/SDL_wimpvideo.c
changeset 634 44d574ed4780
parent 630 550bccdf04bd
child 769 b8d311d90021
equal deleted inserted replaced
633:873c2598f969 634:44d574ed4780
    78 
    78 
    79 extern int riscos_backbuffer;
    79 extern int riscos_backbuffer;
    80 extern int mouseInWindow;
    80 extern int mouseInWindow;
    81 extern int riscos_closeaction;
    81 extern int riscos_closeaction;
    82 
    82 
       
    83 /* Following needed to ensure window is shown immediately */
       
    84 extern int hasFocus;
       
    85 extern void WIMP_Poll(_THIS, int waitTime);
    83 
    86 
    84 SDL_Surface *WIMP_SetVideoMode(_THIS, SDL_Surface *current,
    87 SDL_Surface *WIMP_SetVideoMode(_THIS, SDL_Surface *current,
    85 				int width, int height, int bpp, Uint32 flags)
    88 				int width, int height, int bpp, Uint32 flags)
    86 {
    89 {
    87    Uint32 Rmask = 0;
    90    Uint32 Rmask = 0;
   175 	}
   178 	}
   176 
   179 
   177 	/* Reset device functions for the wimp */
   180 	/* Reset device functions for the wimp */
   178 	WIMP_SetDeviceMode(this);
   181 	WIMP_SetDeviceMode(this);
   179 
   182 
   180     /* Needs to set up plot info after window has been created */
   183 	/* Needs to set up plot info after window has been created */
   181     /* Not sure why, but plots don't work if I do it earlier */
   184 	/* Not sure why, but plots don't work if I do it earlier */
   182     WIMP_SetupPlotInfo(this);
   185 	WIMP_SetupPlotInfo(this);
       
   186 
       
   187 	/* Poll until window is shown */
       
   188 	{
       
   189 	   /* We wait until it gets the focus, but give up after 5 seconds
       
   190 	      in case the focus is prevented in any way.
       
   191 	   */
       
   192 	   Uint32 now = SDL_GetTicks();
       
   193 	   while (!hasFocus && SDL_GetTicks() - now < 5000)
       
   194 	   {
       
   195 	      WIMP_Poll(this, 0);
       
   196 	   }
       
   197 	}
   183 
   198 
   184 	/* We're done */
   199 	/* We're done */
   185 	return(current);
   200 	return(current);
   186 }
   201 }
   187 
   202