diff src/video/x11/SDL_x11window.c @ 3161:494559cc723b

OpenPandora support added by David Carré
author Sam Lantinga <slouken@libsdl.org>
date Sun, 31 May 2009 11:53:12 +0000
parents 81d15ace9129
children 5859d0a0c519
line wrap: on
line diff
--- a/src/video/x11/SDL_x11window.c	Thu May 28 09:39:14 2009 +0000
+++ b/src/video/x11/SDL_x11window.c	Sun May 31 11:53:12 2009 +0000
@@ -31,6 +31,10 @@
 #include "SDL_x11gamma.h"
 #include "../Xext/extensions/StdCmap.h"
 
+#ifdef SDL_VIDEO_DRIVER_PANDORA
+#include "SDL_x11opengles.h"
+#endif
+
 #define _NET_WM_STATE_REMOVE    0l
 #define _NET_WM_STATE_ADD       1l
 #define _NET_WM_STATE_TOGGLE    2l
@@ -241,6 +245,19 @@
         XFree(vinfo);
     } else
 #endif
+#ifdef SDL_VIDEO_DRIVER_PANDORA
+    if (window->flags & SDL_WINDOW_OPENGL) {
+        XVisualInfo *vinfo;
+
+        vinfo = X11_GLES_GetVisual(_this, data->display, displaydata->screen);
+        if (!vinfo) {
+            return -1;
+        }
+        visual = vinfo->visual;
+        depth = vinfo->depth;
+        XFree(vinfo);
+    } else
+#endif
     {
         visual = displaydata->visual;
         depth = displaydata->depth;
@@ -505,6 +522,19 @@
         SDL_SetError("Couldn't create window");
         return -1;
     }
+#if SDL_VIDEO_DRIVER_PANDORA
+    /* Create the GLES window surface */
+    _this->gles_data->egl_surface =
+        _this->gles_data->eglCreateWindowSurface(_this->gles_data->
+                                                 egl_display,
+                                                 _this->gles_data->egl_config,
+                                                 (NativeWindowType) w, NULL);
+
+    if (_this->gles_data->egl_surface == EGL_NO_SURFACE) {
+        SDL_SetError("Could not create GLES window surface");
+        return -1;
+    }
+#endif
 
     sizehints = XAllocSizeHints();
     if (sizehints) {