We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3365

Summary: After calling the SDL_Delay(), the window bar is hidden and a white bar is shown instead.
Product: SDL Reporter: Feng <santo.chan123>
Component: renderAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus
Version: 2.0.4   
Hardware: x86   
OS: Mac OS X 10.11   

Description Feng 2016-06-19 09:03:49 UTC
After calling the SDL_Delay(), the window bar is hidden and a white bar is shown instead. 
I'm not sure if this is a feature or bug. Or I missed something? 

Thank you! 

Here is my code: 

#include <stdio.h> 
#include <stdlib.h> 
#include <stdbool.h> 
#include <SDL2/SDL.h> 

const int SCREEN_WIDTH = 640; 
const int SCREEN_HEIGHT = 480; 

int main(int argc, const char *argv[]) 
{ 
  if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) 
  { 
    printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() ); 
  } 
  bool quit = false; 
  SDL_Event event; 
  SDL_Window* window = NULL; 
  window = SDL_CreateWindow("Test SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN); 
  SDL_Renderer * renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); 

  SDL_SetRenderDrawColor(renderer, 255, 254, 255, 255 ); 
  SDL_RenderClear(renderer); 

  SDL_RenderPresent(renderer); 
  SDL_Delay(5000); // window bar is hidden, a white blank bar is shown instead. 

  while (!quit) // window bar is shown right now. 
  { 
    SDL_WaitEvent(&event); 
    switch (event.type) 
    { 
      case SDL_QUIT: 
        quit = true; 
        break; 
    } 
  } 


  SDL_DestroyRenderer(renderer); 
  SDL_DestroyWindow(window); 

   SDL_Quit(); 
  return 0; 
}
Comment 1 Ryan C. Gordon 2016-07-11 04:17:43 UTC
By any chance, does sticking a call to SDL_PumpEvents() in there before the SDL_Delay() call fix this? We likely have to handle a Window redraw event or something to fix this up and the five-second delay prevents SDL from pumping the event queue to get that event.

--ryan.
Comment 2 Feng 2016-07-12 12:46:00 UTC
Yes. Adding SDL_PumpEvents() before the SDL_Delay() did fix this.
Thank you very much!

--feng,
Comment 3 Ryan C. Gordon 2016-07-13 04:43:09 UTC
Ok, closing this, since it appears to be resolved.

--ryan.