changeset 4977:85969cc5098c

Use a valid window when creating the default renderer
author Sam Lantinga <slouken@libsdl.org>
date Wed, 12 Jan 2011 13:38:10 -0800
parents 3811132c584f
children 4a7f284a82b2
files src/video/SDL_video.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;
         }
     }