# HG changeset patch # User Sam Lantinga # Date 1294868290 28800 # Node ID 85969cc5098c4d5cd2a4c07a4a9d344e81bb538a # Parent 3811132c584f7929939624376315edd1554ce468 Use a valid window when creating the default renderer diff -r 3811132c584f -r 85969cc5098c src/video/SDL_video.c --- a/src/video/SDL_video.c Wed Jan 12 12:40:11 2011 -0800 +++ b/src/video/SDL_video.c Wed Jan 12 13:38:10 2011 -0800 @@ -1046,11 +1046,19 @@ return NULL; } if (!SDL_CurrentRenderer) { + SDL_Window *window = NULL; + if (!create) { SDL_SetError("Use SDL_CreateRenderer() to create a renderer"); return NULL; } - if (SDL_CreateRenderer(0, -1, 0) < 0) { + + /* Get the first window on the first display */ + if (_this->num_displays > 0) { + window = _this->displays[0].windows; + } + + if (SDL_CreateRenderer(window, -1, 0) < 0) { return NULL; } }