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 - After calling the SDL_Delay(), the window bar is hidden and a white bar is shown instead.
Summary: After calling the SDL_Delay(), the window bar is hidden and a white bar is sh...
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: 2.0.4
Hardware: x86 Mac OS X 10.11
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-19 09:03 UTC by Feng
Modified: 2016-07-13 04:43 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.