Move the fix for Bugzilla #1395 into WIN_GL_SetupWindow() directly.
It's a cleaner solution. --HG-- extra : rebase_source : efd29bea6e39b6aed73f78a0f119b3b4c2bbd498
This commit is contained in:
parent
44c4197243
commit
3d680115c7
2 changed files with 14 additions and 7 deletions
|
@ -418,8 +418,9 @@ WIN_GL_ChoosePixelFormatARB(_THIS, int *iAttribs, float *fAttribs)
|
||||||
return pixel_format;
|
return pixel_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
/* actual work of WIN_GL_SetupWindow() happens here. */
|
||||||
WIN_GL_SetupWindow(_THIS, SDL_Window * window)
|
static int
|
||||||
|
WIN_GL_SetupWindowInternal(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc;
|
HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc;
|
||||||
PIXELFORMATDESCRIPTOR pfd;
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
|
@ -529,6 +530,17 @@ WIN_GL_SetupWindow(_THIS, SDL_Window * window)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
WIN_GL_SetupWindow(_THIS, SDL_Window * window)
|
||||||
|
{
|
||||||
|
/* The current context is lost in here; save it and reset it. */
|
||||||
|
SDL_Window *current_win = SDL_GL_GetCurrentWindow();
|
||||||
|
SDL_GLContext current_ctx = SDL_GL_GetCurrentContext();
|
||||||
|
const int retval = WIN_GL_SetupWindowInternal(_this, window);
|
||||||
|
WIN_GL_MakeCurrent(_this, current_win, current_ctx);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_GLContext
|
SDL_GLContext
|
||||||
WIN_GL_CreateContext(_THIS, SDL_Window * window)
|
WIN_GL_CreateContext(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
|
|
|
@ -231,15 +231,10 @@ WIN_CreateWindow(_THIS, SDL_Window * window)
|
||||||
}
|
}
|
||||||
#if SDL_VIDEO_OPENGL_WGL
|
#if SDL_VIDEO_OPENGL_WGL
|
||||||
if (window->flags & SDL_WINDOW_OPENGL) {
|
if (window->flags & SDL_WINDOW_OPENGL) {
|
||||||
/* The current context is lost in SDL_GL_SetupWindow; recover it. */
|
|
||||||
SDL_Window *current_win = SDL_GL_GetCurrentWindow();
|
|
||||||
SDL_GLContext current_ctx = SDL_GL_GetCurrentContext();
|
|
||||||
if (WIN_GL_SetupWindow(_this, window) < 0) {
|
if (WIN_GL_SetupWindow(_this, window) < 0) {
|
||||||
WIN_DestroyWindow(_this, window);
|
WIN_DestroyWindow(_this, window);
|
||||||
WIN_GL_MakeCurrent(_this, current_win, current_ctx);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
WIN_GL_MakeCurrent(_this, current_win, current_ctx);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue