src/video/windows/SDL_windowsopengl.c
changeset 7559 0dd3b05797f9
parent 7553 f0091f8eae33
child 7853 4861edda71d1
     1.1 --- a/src/video/windows/SDL_windowsopengl.c	Wed Jul 31 21:22:09 2013 -0700
     1.2 +++ b/src/video/windows/SDL_windowsopengl.c	Thu Aug 01 00:27:22 2013 -0400
     1.3 @@ -418,8 +418,9 @@
     1.4      return pixel_format;
     1.5  }
     1.6  
     1.7 -int
     1.8 -WIN_GL_SetupWindow(_THIS, SDL_Window * window)
     1.9 +/* actual work of WIN_GL_SetupWindow() happens here. */
    1.10 +static int
    1.11 +WIN_GL_SetupWindowInternal(_THIS, SDL_Window * window)
    1.12  {
    1.13      HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc;
    1.14      PIXELFORMATDESCRIPTOR pfd;
    1.15 @@ -529,6 +530,17 @@
    1.16      return 0;
    1.17  }
    1.18  
    1.19 +int
    1.20 +WIN_GL_SetupWindow(_THIS, SDL_Window * window)
    1.21 +{
    1.22 +    /* The current context is lost in here; save it and reset it. */
    1.23 +    SDL_Window *current_win = SDL_GL_GetCurrentWindow();
    1.24 +    SDL_GLContext current_ctx = SDL_GL_GetCurrentContext();
    1.25 +    const int retval = WIN_GL_SetupWindowInternal(_this, window);
    1.26 +    WIN_GL_MakeCurrent(_this, current_win, current_ctx);
    1.27 +    return retval;
    1.28 +}
    1.29 +
    1.30  SDL_GLContext
    1.31  WIN_GL_CreateContext(_THIS, SDL_Window * window)
    1.32  {