Implemented X11 OpenGL support.
authorSam Lantinga <slouken@libsdl.org>
Fri, 28 Jul 2006 08:43:17 +0000
changeset 1952420716272158
parent 1951 7177581dc9fa
child 1953 214880ed48c3
Implemented X11 OpenGL support.
Added support for the SDL_VIDEO_OPENGL environment variable.
configure.in
include/SDL_config.h.in
src/video/SDL_renderer_gl.c
src/video/SDL_video.c
src/video/cocoa/SDL_cocoaopengl.h
src/video/cocoa/SDL_cocoaopengl.m
src/video/cocoa/SDL_cocoavideo.m
src/video/cocoa/SDL_cocoawindow.m
src/video/win32/SDL_win32opengl.c
src/video/win32/SDL_win32opengl.h
src/video/win32/SDL_win32video.c
src/video/win32/SDL_win32window.c
src/video/x11/SDL_x11opengl.c
src/video/x11/SDL_x11opengl.h
src/video/x11/SDL_x11sym.h
src/video/x11/SDL_x11video.c
src/video/x11/SDL_x11video.h
src/video/x11/SDL_x11window.c
     1.1 --- a/configure.in	Thu Jul 27 06:53:23 2006 +0000
     1.2 +++ b/configure.in	Fri Jul 28 08:43:17 2006 +0000
     1.3 @@ -1359,7 +1359,7 @@
     1.4  
     1.5  dnl Check to see if OpenGL support is desired
     1.6  AC_ARG_ENABLE(video-opengl,
     1.7 -AC_HELP_STRING([--enable-video-opengl], [include OpenGL context creation [[default=yes]]]),
     1.8 +AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
     1.9                , enable_video_opengl=yes)
    1.10  
    1.11  dnl Find OpenGL
    1.12 @@ -1379,6 +1379,7 @@
    1.13          if test x$video_opengl = xyes; then
    1.14              AC_DEFINE(SDL_VIDEO_OPENGL)
    1.15              AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
    1.16 +            AC_DEFINE(SDL_VIDEO_RENDER_OGL)
    1.17          fi
    1.18      fi
    1.19  }
    1.20 @@ -1398,6 +1399,7 @@
    1.21          AC_MSG_RESULT($video_opengl)
    1.22          if test x$video_opengl = xyes; then
    1.23              AC_DEFINE(SDL_VIDEO_OPENGL)
    1.24 +            AC_DEFINE(SDL_VIDEO_RENDER_OGL)
    1.25              EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
    1.26          fi
    1.27      fi
    1.28 @@ -1409,6 +1411,7 @@
    1.29      if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
    1.30          AC_DEFINE(SDL_VIDEO_OPENGL)
    1.31          AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
    1.32 +        AC_DEFINE(SDL_VIDEO_RENDER_OGL)
    1.33      fi
    1.34  }
    1.35  
    1.36 @@ -1417,6 +1420,8 @@
    1.37  {
    1.38      if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
    1.39          AC_DEFINE(SDL_VIDEO_OPENGL)
    1.40 +        AC_DEFINE(SDL_VIDEO_OPENGL_BGL)
    1.41 +        AC_DEFINE(SDL_VIDEO_RENDER_OGL)
    1.42          EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
    1.43      fi
    1.44  }
    1.45 @@ -1426,6 +1431,8 @@
    1.46  {
    1.47      if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
    1.48          AC_DEFINE(SDL_VIDEO_OPENGL)
    1.49 +        AC_DEFINE(SDL_VIDEO_OPENGL_CGL)
    1.50 +        AC_DEFINE(SDL_VIDEO_RENDER_OGL)
    1.51          case "$host" in
    1.52              *-*-darwin*)
    1.53                  if test x$enable_video_cocoa = xyes; then
    1.54 @@ -1456,6 +1463,7 @@
    1.55          fi
    1.56          AC_DEFINE(SDL_VIDEO_OPENGL)
    1.57          AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
    1.58 +        AC_DEFINE(SDL_VIDEO_RENDER_OGL)
    1.59          SDL_CFLAGS="$SDL_CFLAGS $OSMESA_CFLAGS"
    1.60          SDL_LIBS="$SDL_LIBS $OSMESA_LIBS"
    1.61  
     2.1 --- a/include/SDL_config.h.in	Thu Jul 27 06:53:23 2006 +0000
     2.2 +++ b/include/SDL_config.h.in	Fri Jul 28 08:43:17 2006 +0000
     2.3 @@ -292,6 +292,8 @@
     2.4  
     2.5  /* Enable OpenGL support */
     2.6  #undef SDL_VIDEO_OPENGL
     2.7 +#undef SDL_VIDEO_OPENGL_BGL
     2.8 +#undef SDL_VIDEO_OPENGL_CGL
     2.9  #undef SDL_VIDEO_OPENGL_GLX
    2.10  #undef SDL_VIDEO_OPENGL_WGL
    2.11  #undef SDL_VIDEO_OPENGL_OSMESA
     3.1 --- a/src/video/SDL_renderer_gl.c	Thu Jul 27 06:53:23 2006 +0000
     3.2 +++ b/src/video/SDL_renderer_gl.c	Fri Jul 28 08:43:17 2006 +0000
     3.3 @@ -21,7 +21,7 @@
     3.4  */
     3.5  #include "SDL_config.h"
     3.6  
     3.7 -#if SDL_VIDEO_OPENGL
     3.8 +#if SDL_VIDEO_RENDER_OGL
     3.9  
    3.10  #include "SDL_video.h"
    3.11  #include "SDL_opengl.h"
    3.12 @@ -197,6 +197,7 @@
    3.13  {
    3.14      SDL_Renderer *renderer;
    3.15      GL_RenderData *data;
    3.16 +    GLint value;
    3.17  
    3.18      if (!(window->flags & SDL_WINDOW_OPENGL)) {
    3.19          if (SDL_RecreateWindow(window, window->flags | SDL_WINDOW_OPENGL) < 0) {
    3.20 @@ -261,10 +262,10 @@
    3.21          renderer->info.flags |= SDL_Renderer_PresentVSync;
    3.22      }
    3.23  
    3.24 -    data->glGetIntegerv(GL_MAX_TEXTURE_SIZE,
    3.25 -                        &renderer->info.max_texture_width);
    3.26 -    data->glGetIntegerv(GL_MAX_TEXTURE_SIZE,
    3.27 -                        &renderer->info.max_texture_height);
    3.28 +    data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
    3.29 +    renderer->info.max_texture_width = value;
    3.30 +    data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
    3.31 +    renderer->info.max_texture_height = value;
    3.32  
    3.33      if (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle")
    3.34          || SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) {
    3.35 @@ -706,6 +707,6 @@
    3.36      SDL_free(renderer);
    3.37  }
    3.38  
    3.39 -#endif /* SDL_VIDEO_OPENGL */
    3.40 +#endif /* SDL_VIDEO_RENDER_OGL */
    3.41  
    3.42  /* vi: set ts=4 sw=4 expandtab: */
     4.1 --- a/src/video/SDL_video.c	Thu Jul 27 06:53:23 2006 +0000
     4.2 +++ b/src/video/SDL_video.c	Fri Jul 28 08:43:17 2006 +0000
     4.3 @@ -276,7 +276,7 @@
     4.4  
     4.5      /* The software renderer is always available */
     4.6      for (i = 0; i < _this->num_displays; ++i) {
     4.7 -#if SDL_VIDEO_OPENGL
     4.8 +#if SDL_VIDEO_RENDER_OGL
     4.9          SDL_AddRenderDriver(i, &GL_RenderDriver);
    4.10  #endif
    4.11          if (_this->displays[i].num_render_drivers > 0) {
     5.1 --- a/src/video/cocoa/SDL_cocoaopengl.h	Thu Jul 27 06:53:23 2006 +0000
     5.2 +++ b/src/video/cocoa/SDL_cocoaopengl.h	Fri Jul 28 08:43:17 2006 +0000
     5.3 @@ -24,7 +24,7 @@
     5.4  #ifndef _SDL_cocoaopengl_h
     5.5  #define _SDL_cocoaopengl_h
     5.6  
     5.7 -#if SDL_VIDEO_OPENGL
     5.8 +#if SDL_VIDEO_OPENGL_CGL
     5.9  
    5.10  struct SDL_GLDriverData
    5.11  {
    5.12 @@ -44,7 +44,7 @@
    5.13  extern void Cocoa_GL_SwapWindow(_THIS, SDL_Window * window);
    5.14  extern void Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context);
    5.15  
    5.16 -#endif /* SDL_VIDEO_OPENGL */
    5.17 +#endif /* SDL_VIDEO_OPENGL_CGL */
    5.18  
    5.19  #endif /* _SDL_cocoaopengl_h */
    5.20  
     6.1 --- a/src/video/cocoa/SDL_cocoaopengl.m	Thu Jul 27 06:53:23 2006 +0000
     6.2 +++ b/src/video/cocoa/SDL_cocoaopengl.m	Fri Jul 28 08:43:17 2006 +0000
     6.3 @@ -25,14 +25,14 @@
     6.4  
     6.5  /* NSOpenGL implementation of SDL OpenGL support */
     6.6  
     6.7 -#if SDL_VIDEO_OPENGL
     6.8 +#if SDL_VIDEO_OPENGL_CGL
     6.9  #include <OpenGL/CGLTypes.h>
    6.10  
    6.11  #include "SDL_loadso.h"
    6.12  #include "SDL_opengl.h"
    6.13  
    6.14  
    6.15 -#define DEFAULT_OPENGL_PATH  "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
    6.16 +#define DEFAULT_OPENGL  "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
    6.17  
    6.18  /* This is implemented in Mac OS X 10.3 and above */
    6.19  #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3
    6.20 @@ -57,7 +57,10 @@
    6.21          }
    6.22      }
    6.23      if (path == NULL) {
    6.24 -        path = DEFAULT_OPENGL_PATH;
    6.25 +        path = SDL_getenv("SDL_OPENGL_LIBRARY");
    6.26 +    }
    6.27 +    if (path == NULL) {
    6.28 +        path = DEFAULT_OPENGL;
    6.29      }
    6.30      _this->gl_config.dll_handle = SDL_LoadObject(path);
    6.31      if (!_this->gl_config.dll_handle) {
    6.32 @@ -87,19 +90,6 @@
    6.33      }
    6.34  }
    6.35  
    6.36 -static void
    6.37 -Cocoa_GL_Shutdown(_THIS)
    6.38 -{
    6.39 -    if (!_this->gl_data || (--_this->gl_data->initialized > 0)) {
    6.40 -        return;
    6.41 -    }
    6.42 -
    6.43 -    Cocoa_GL_UnloadLibrary(_this);
    6.44 -
    6.45 -    SDL_free(_this->gl_data);
    6.46 -    _this->gl_data = NULL;
    6.47 -}
    6.48 -
    6.49  static int
    6.50  Cocoa_GL_Initialize(_THIS)
    6.51  {
    6.52 @@ -124,6 +114,19 @@
    6.53      return 0;
    6.54  }
    6.55  
    6.56 +static void
    6.57 +Cocoa_GL_Shutdown(_THIS)
    6.58 +{
    6.59 +    if (!_this->gl_data || (--_this->gl_data->initialized > 0)) {
    6.60 +        return;
    6.61 +    }
    6.62 +
    6.63 +    Cocoa_GL_UnloadLibrary(_this);
    6.64 +
    6.65 +    SDL_free(_this->gl_data);
    6.66 +    _this->gl_data = NULL;
    6.67 +}
    6.68 +
    6.69  int
    6.70  Cocoa_GL_SetupWindow(_THIS, SDL_Window * window)
    6.71  {
    6.72 @@ -352,6 +355,6 @@
    6.73      [pool release];
    6.74  }
    6.75  
    6.76 -#endif /* SDL_VIDEO_OPENGL */
    6.77 +#endif /* SDL_VIDEO_OPENGL_CGL */
    6.78  
    6.79  /* vi: set ts=4 sw=4 expandtab: */
     7.1 --- a/src/video/cocoa/SDL_cocoavideo.m	Thu Jul 27 06:53:23 2006 +0000
     7.2 +++ b/src/video/cocoa/SDL_cocoavideo.m	Fri Jul 28 08:43:17 2006 +0000
     7.3 @@ -87,7 +87,7 @@
     7.4      device->SetWindowGrab = Cocoa_SetWindowGrab;
     7.5      device->DestroyWindow = Cocoa_DestroyWindow;
     7.6      device->GetWindowWMInfo = Cocoa_GetWindowWMInfo;
     7.7 -#ifdef SDL_VIDEO_OPENGL
     7.8 +#ifdef SDL_VIDEO_OPENGL_CGL
     7.9      device->GL_LoadLibrary = Cocoa_GL_LoadLibrary;
    7.10      device->GL_GetProcAddress = Cocoa_GL_GetProcAddress;
    7.11      device->GL_CreateContext = Cocoa_GL_CreateContext;
     8.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Thu Jul 27 06:53:23 2006 +0000
     8.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Fri Jul 28 08:43:17 2006 +0000
     8.3 @@ -385,7 +385,7 @@
     8.4          [nswindow release];
     8.5          return -1;
     8.6      }
     8.7 -#ifdef SDL_VIDEO_OPENGL
     8.8 +#ifdef SDL_VIDEO_OPENGL_CGL
     8.9      if (window->flags & SDL_WINDOW_OPENGL) {
    8.10          if (Cocoa_GL_SetupWindow(_this, window) < 0) {
    8.11              Cocoa_DestroyWindow(_this, window);
    8.12 @@ -535,7 +535,7 @@
    8.13      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
    8.14  
    8.15      if (data) {
    8.16 -#ifdef SDL_VIDEO_OPENGL
    8.17 +#ifdef SDL_VIDEO_OPENGL_CGL
    8.18          if (window->flags & SDL_WINDOW_OPENGL) {
    8.19              Cocoa_GL_CleanupWindow(_this, window);
    8.20          }
     9.1 --- a/src/video/win32/SDL_win32opengl.c	Thu Jul 27 06:53:23 2006 +0000
     9.2 +++ b/src/video/win32/SDL_win32opengl.c	Fri Jul 28 08:43:17 2006 +0000
     9.3 @@ -25,10 +25,10 @@
     9.4  
     9.5  /* WGL implementation of SDL OpenGL support */
     9.6  
     9.7 -#if SDL_VIDEO_OPENGL
     9.8 +#if SDL_VIDEO_OPENGL_WGL
     9.9  #include "SDL_opengl.h"
    9.10  
    9.11 -#define DEFAULT_OPENGL_PATH "OPENGL32.DLL"
    9.12 +#define DEFAULT_OPENGL "OPENGL32.DLL"
    9.13  
    9.14  
    9.15  int
    9.16 @@ -47,7 +47,10 @@
    9.17          }
    9.18      }
    9.19      if (path == NULL) {
    9.20 -        path = DEFAULT_OPENGL_PATH;
    9.21 +        path = SDL_getenv("SDL_OPENGL_LIBRARY");
    9.22 +    }
    9.23 +    if (path == NULL) {
    9.24 +        path = DEFAULT_OPENGL;
    9.25      }
    9.26      wpath = WIN_UTF8ToString(path);
    9.27      handle = LoadLibrary(wpath);
    9.28 @@ -257,19 +260,6 @@
    9.29      WIN_PumpEvents(_this);
    9.30  }
    9.31  
    9.32 -static void
    9.33 -WIN_GL_Shutdown(_THIS)
    9.34 -{
    9.35 -    if (!_this->gl_data || (--_this->gl_data->initialized > 0)) {
    9.36 -        return;
    9.37 -    }
    9.38 -
    9.39 -    WIN_GL_UnloadLibrary(_this);
    9.40 -
    9.41 -    SDL_free(_this->gl_data);
    9.42 -    _this->gl_data = NULL;
    9.43 -}
    9.44 -
    9.45  static int
    9.46  WIN_GL_Initialize(_THIS)
    9.47  {
    9.48 @@ -298,6 +288,19 @@
    9.49      return 0;
    9.50  }
    9.51  
    9.52 +static void
    9.53 +WIN_GL_Shutdown(_THIS)
    9.54 +{
    9.55 +    if (!_this->gl_data || (--_this->gl_data->initialized > 0)) {
    9.56 +        return;
    9.57 +    }
    9.58 +
    9.59 +    WIN_GL_UnloadLibrary(_this);
    9.60 +
    9.61 +    SDL_free(_this->gl_data);
    9.62 +    _this->gl_data = NULL;
    9.63 +}
    9.64 +
    9.65  int
    9.66  WIN_GL_SetupWindow(_THIS, SDL_Window * window)
    9.67  {
    9.68 @@ -479,7 +482,6 @@
    9.69      _this->gl_data->wglDeleteContext((HGLRC) context);
    9.70  }
    9.71  
    9.72 -#endif /* SDL_VIDEO_OPENGL */
    9.73 -
    9.74 +#endif /* SDL_VIDEO_OPENGL_WGL */
    9.75  
    9.76  /* vi: set ts=4 sw=4 expandtab: */
    10.1 --- a/src/video/win32/SDL_win32opengl.h	Thu Jul 27 06:53:23 2006 +0000
    10.2 +++ b/src/video/win32/SDL_win32opengl.h	Fri Jul 28 08:43:17 2006 +0000
    10.3 @@ -24,7 +24,7 @@
    10.4  #ifndef _SDL_win32opengl_h
    10.5  #define _SDL_win32opengl_h
    10.6  
    10.7 -#if SDL_VIDEO_OPENGL
    10.8 +#if SDL_VIDEO_OPENGL_WGL
    10.9  
   10.10  struct SDL_GLDriverData
   10.11  {
   10.12 @@ -120,7 +120,7 @@
   10.13  #define WGL_SAMPLES_ARB                0x2042
   10.14  #endif
   10.15  
   10.16 -#endif /* SDL_VIDEO_OPENGL */
   10.17 +#endif /* SDL_VIDEO_OPENGL_WGL */
   10.18  
   10.19  #endif /* _SDL_win32opengl_h */
   10.20  
    11.1 --- a/src/video/win32/SDL_win32video.c	Thu Jul 27 06:53:23 2006 +0000
    11.2 +++ b/src/video/win32/SDL_win32video.c	Fri Jul 28 08:43:17 2006 +0000
    11.3 @@ -123,7 +123,7 @@
    11.4      device->SetWindowGrab = WIN_SetWindowGrab;
    11.5      device->DestroyWindow = WIN_DestroyWindow;
    11.6      device->GetWindowWMInfo = WIN_GetWindowWMInfo;
    11.7 -#ifdef SDL_VIDEO_OPENGL
    11.8 +#ifdef SDL_VIDEO_OPENGL_WGL
    11.9      device->GL_LoadLibrary = WIN_GL_LoadLibrary;
   11.10      device->GL_GetProcAddress = WIN_GL_GetProcAddress;
   11.11      device->GL_CreateContext = WIN_GL_CreateContext;
    12.1 --- a/src/video/win32/SDL_win32window.c	Thu Jul 27 06:53:23 2006 +0000
    12.2 +++ b/src/video/win32/SDL_win32window.c	Fri Jul 28 08:43:17 2006 +0000
    12.3 @@ -213,7 +213,7 @@
    12.4          DestroyWindow(hwnd);
    12.5          return -1;
    12.6      }
    12.7 -#ifdef SDL_VIDEO_OPENGL
    12.8 +#ifdef SDL_VIDEO_OPENGL_WGL
    12.9      if (window->flags & SDL_WINDOW_OPENGL) {
   12.10          if (WIN_GL_SetupWindow(_this, window) < 0) {
   12.11              WIN_DestroyWindow(_this, window);
   12.12 @@ -419,7 +419,7 @@
   12.13      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   12.14  
   12.15      if (data) {
   12.16 -#ifdef SDL_VIDEO_OPENGL
   12.17 +#ifdef SDL_VIDEO_OPENGL_WGL
   12.18          if (window->flags & SDL_WINDOW_OPENGL) {
   12.19              WIN_GL_CleanupWindow(_this, window);
   12.20          }
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/src/video/x11/SDL_x11opengl.c	Fri Jul 28 08:43:17 2006 +0000
    13.3 @@ -0,0 +1,507 @@
    13.4 +/*
    13.5 +    SDL - Simple DirectMedia Layer
    13.6 +    Copyright (C) 1997-2006 Sam Lantinga
    13.7 +
    13.8 +    This library is free software; you can redistribute it and/or
    13.9 +    modify it under the terms of the GNU Lesser General Public
   13.10 +    License as published by the Free Software Foundation; either
   13.11 +    version 2.1 of the License, or (at your option) any later version.
   13.12 +
   13.13 +    This library is distributed in the hope that it will be useful,
   13.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   13.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13.16 +    Lesser General Public License for more details.
   13.17 +
   13.18 +    You should have received a copy of the GNU Lesser General Public
   13.19 +    License along with _this library; if not, write to the Free Software
   13.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   13.21 +
   13.22 +    Sam Lantinga
   13.23 +    slouken@libsdl.org
   13.24 +*/
   13.25 +#include "SDL_config.h"
   13.26 +
   13.27 +#include "SDL_x11video.h"
   13.28 +
   13.29 +/* GLX implementation of SDL OpenGL support */
   13.30 +
   13.31 +#if SDL_VIDEO_OPENGL_GLX
   13.32 +#include "SDL_loadso.h"
   13.33 +
   13.34 +#if defined(__IRIX__)
   13.35 +/* IRIX doesn't have a GL library versioning system */
   13.36 +#define DEFAULT_OPENGL	"libGL.so"
   13.37 +#elif defined(__MACOSX__)
   13.38 +#define DEFAULT_OPENGL	"/usr/X11R6/lib/libGL.1.dylib"
   13.39 +#elif defined(__QNXNTO__)
   13.40 +#define DEFAULT_OPENGL	"libGL.so.3"
   13.41 +#else
   13.42 +#define DEFAULT_OPENGL	"libGL.so.1"
   13.43 +#endif
   13.44 +
   13.45 +#ifndef GLX_ARB_multisample
   13.46 +#define GLX_ARB_multisample
   13.47 +#define GLX_SAMPLE_BUFFERS_ARB             100000
   13.48 +#define GLX_SAMPLES_ARB                    100001
   13.49 +#endif
   13.50 +
   13.51 +#ifndef GLX_EXT_visual_rating
   13.52 +#define GLX_EXT_visual_rating
   13.53 +#define GLX_VISUAL_CAVEAT_EXT              0x20
   13.54 +#define GLX_NONE_EXT                       0x8000
   13.55 +#define GLX_SLOW_VISUAL_EXT                0x8001
   13.56 +#define GLX_NON_CONFORMANT_VISUAL_EXT      0x800D
   13.57 +#endif
   13.58 +
   13.59 +#define OPENGL_REQUIRS_DLOPEN
   13.60 +#if defined(OPENGL_REQUIRS_DLOPEN) && defined(SDL_LOADSO_DLOPEN)
   13.61 +#include <dlfcn.h>
   13.62 +#define GL_LoadObject(X)	dlopen(X, (RTLD_NOW|RTLD_GLOBAL))
   13.63 +#define GL_LoadFunction		dlsym
   13.64 +#define GL_UnloadObject		dlclose
   13.65 +#else
   13.66 +#define GL_LoadObject	SDL_LoadObject
   13.67 +#define GL_LoadFunction	SDL_LoadFunction
   13.68 +#define GL_UnloadObject	SDL_UnloadObject
   13.69 +#endif
   13.70 +
   13.71 +int
   13.72 +X11_GL_LoadLibrary(_THIS, const char *path)
   13.73 +{
   13.74 +    void *handle;
   13.75 +
   13.76 +    if (_this->gl_config.driver_loaded) {
   13.77 +        if (path) {
   13.78 +            SDL_SetError("OpenGL library already loaded");
   13.79 +            return -1;
   13.80 +        } else {
   13.81 +            ++_this->gl_config.driver_loaded;
   13.82 +            return 0;
   13.83 +        }
   13.84 +    }
   13.85 +    if (path == NULL) {
   13.86 +        path = SDL_getenv("SDL_OPENGL_LIBRARY");
   13.87 +    }
   13.88 +    if (path == NULL) {
   13.89 +        path = DEFAULT_OPENGL;
   13.90 +    }
   13.91 +    handle = GL_LoadObject(path);
   13.92 +    if (!handle) {
   13.93 +        return -1;
   13.94 +    }
   13.95 +
   13.96 +    /* Load new function pointers */
   13.97 +    _this->gl_data->glXGetProcAddress =
   13.98 +        (void *(*)(const GLubyte *)) GL_LoadFunction(handle,
   13.99 +                                                     "glXGetProcAddressARB");
  13.100 +    _this->gl_data->glXChooseVisual =
  13.101 +        (XVisualInfo * (*)(Display *, int, int *)) GL_LoadFunction(handle,
  13.102 +                                                                   "glXChooseVisual");
  13.103 +    _this->gl_data->glXCreateContext =
  13.104 +        (GLXContext(*)(Display *, XVisualInfo *, GLXContext, int))
  13.105 +        GL_LoadFunction(handle, "glXCreateContext");
  13.106 +    _this->gl_data->glXDestroyContext =
  13.107 +        (void (*)(Display *, GLXContext)) GL_LoadFunction(handle,
  13.108 +                                                          "glXDestroyContext");
  13.109 +    _this->gl_data->glXMakeCurrent =
  13.110 +        (int (*)(Display *, GLXDrawable, GLXContext)) GL_LoadFunction(handle,
  13.111 +                                                                      "glXMakeCurrent");
  13.112 +    _this->gl_data->glXSwapBuffers =
  13.113 +        (void (*)(Display *, GLXDrawable)) GL_LoadFunction(handle,
  13.114 +                                                           "glXSwapBuffers");
  13.115 +    _this->gl_data->glXGetConfig =
  13.116 +        (int (*)(Display *, XVisualInfo *, int, int *))
  13.117 +        GL_LoadFunction(handle, "glXGetConfig");
  13.118 +
  13.119 +    if (!_this->gl_data->glXChooseVisual ||
  13.120 +        !_this->gl_data->glXCreateContext ||
  13.121 +        !_this->gl_data->glXDestroyContext ||
  13.122 +        !_this->gl_data->glXMakeCurrent ||
  13.123 +        !_this->gl_data->glXSwapBuffers || !_this->gl_data->glXGetConfig) {
  13.124 +        SDL_SetError("Could not retrieve OpenGL functions");
  13.125 +        return -1;
  13.126 +    }
  13.127 +
  13.128 +    _this->gl_config.dll_handle = handle;
  13.129 +    SDL_strlcpy(_this->gl_config.driver_path, path,
  13.130 +                SDL_arraysize(_this->gl_config.driver_path));
  13.131 +    _this->gl_config.driver_loaded = 1;
  13.132 +    return 0;
  13.133 +}
  13.134 +
  13.135 +void *
  13.136 +X11_GL_GetProcAddress(_THIS, const char *proc)
  13.137 +{
  13.138 +    void *handle;
  13.139 +
  13.140 +    handle = _this->gl_config.dll_handle;
  13.141 +    if (_this->gl_data->glXGetProcAddress) {
  13.142 +        return _this->gl_data->glXGetProcAddress((const GLubyte *) proc);
  13.143 +    }
  13.144 +    return GL_LoadFunction(handle, proc);
  13.145 +}
  13.146 +
  13.147 +static void
  13.148 +X11_GL_UnloadLibrary(_THIS)
  13.149 +{
  13.150 +    if (_this->gl_config.driver_loaded > 0) {
  13.151 +        if (--_this->gl_config.driver_loaded > 0) {
  13.152 +            return;
  13.153 +        }
  13.154 +        GL_UnloadObject(_this->gl_config.dll_handle);
  13.155 +        _this->gl_config.dll_handle = NULL;
  13.156 +    }
  13.157 +}
  13.158 +
  13.159 +static SDL_bool
  13.160 +HasExtension(const char *extension, const char *extensions)
  13.161 +{
  13.162 +    const char *start;
  13.163 +    const char *where, *terminator;
  13.164 +
  13.165 +    /* Extension names should not have spaces. */
  13.166 +    where = SDL_strchr(extension, ' ');
  13.167 +    if (where || *extension == '\0')
  13.168 +        return SDL_FALSE;
  13.169 +
  13.170 +    if (!extensions)
  13.171 +        return SDL_FALSE;
  13.172 +
  13.173 +    /* It takes a bit of care to be fool-proof about parsing the
  13.174 +     * OpenGL extensions string. Don't be fooled by sub-strings,
  13.175 +     * etc. */
  13.176 +
  13.177 +    start = extensions;
  13.178 +
  13.179 +    for (;;) {
  13.180 +        where = SDL_strstr(start, extension);
  13.181 +        if (!where)
  13.182 +            break;
  13.183 +
  13.184 +        terminator = where + SDL_strlen(extension);
  13.185 +        if (where == start || *(where - 1) == ' ')
  13.186 +            if (*terminator == ' ' || *terminator == '\0')
  13.187 +                return SDL_TRUE;
  13.188 +
  13.189 +        start = terminator;
  13.190 +    }
  13.191 +    return SDL_FALSE;
  13.192 +}
  13.193 +
  13.194 +static void
  13.195 +X11_GL_InitExtensions(_THIS)
  13.196 +{
  13.197 +    Display *display = ((SDL_VideoData *) _this->driverdata)->display;
  13.198 +    int screen = ((SDL_DisplayData *) SDL_CurrentDisplay.driverdata)->screen;
  13.199 +    XVisualInfo *vinfo;
  13.200 +    XSetWindowAttributes xattr;
  13.201 +    Window w;
  13.202 +    GLXContext context;
  13.203 +    const char *(*glXQueryExtensionsStringFunc) (Display *, int);
  13.204 +    const char *extensions;
  13.205 +
  13.206 +    vinfo = X11_GL_GetVisual(_this, display, screen);
  13.207 +    if (!vinfo) {
  13.208 +        return;
  13.209 +    }
  13.210 +    xattr.background_pixel = 0;
  13.211 +    xattr.border_pixel = 0;
  13.212 +    xattr.colormap =
  13.213 +        XCreateColormap(display, RootWindow(display, screen), vinfo->visual,
  13.214 +                        AllocNone);
  13.215 +    w = XCreateWindow(display, RootWindow(display, screen), 0, 0, 32, 32, 0,
  13.216 +                      vinfo->depth, InputOutput, vinfo->visual,
  13.217 +                      (CWBackPixel | CWBorderPixel | CWColormap), &xattr);
  13.218 +    context = _this->gl_data->glXCreateContext(display, vinfo, NULL, True);
  13.219 +    if (context) {
  13.220 +        _this->gl_data->glXMakeCurrent(display, w, context);
  13.221 +    }
  13.222 +    XFree(vinfo);
  13.223 +
  13.224 +    glXQueryExtensionsStringFunc =
  13.225 +        (const char *(*)(Display *, int)) X11_GL_GetProcAddress(_this,
  13.226 +                                                                "glXQueryExtensionsString");
  13.227 +    if (glXQueryExtensionsStringFunc) {
  13.228 +        extensions = glXQueryExtensionsStringFunc(display, screen);
  13.229 +    } else {
  13.230 +        extensions = NULL;
  13.231 +    }
  13.232 +
  13.233 +    /* Check for SGI_swap_control */
  13.234 +    if (HasExtension("SGI_swap_control", extensions)) {
  13.235 +        _this->gl_data->glXSwapIntervalSGI =
  13.236 +            (int (*)(int)) X11_GL_GetProcAddress(_this, "glXSwapIntervalSGI");
  13.237 +    }
  13.238 +
  13.239 +    /* Check for GLX_MESA_swap_control */
  13.240 +    if (HasExtension("GLX_MESA_swap_control", extensions)) {
  13.241 +        _this->gl_data->glXSwapIntervalMESA =
  13.242 +            (GLint(*)(unsigned)) X11_GL_GetProcAddress(_this,
  13.243 +                                                       "glXSwapIntervalMESA");
  13.244 +        _this->gl_data->glXGetSwapIntervalMESA =
  13.245 +            (GLint(*)(void)) X11_GL_GetProcAddress(_this,
  13.246 +                                                   "glXGetSwapIntervalMESA");
  13.247 +    }
  13.248 +
  13.249 +    /* Check for GLX_EXT_visual_rating */
  13.250 +    if (HasExtension("GLX_EXT_visual_rating", extensions)) {
  13.251 +        _this->gl_data->HAS_GLX_EXT_visual_rating = SDL_TRUE;
  13.252 +    }
  13.253 +
  13.254 +    if (context) {
  13.255 +        _this->gl_data->glXMakeCurrent(display, None, NULL);
  13.256 +        _this->gl_data->glXDestroyContext(display, context);
  13.257 +    }
  13.258 +    XDestroyWindow(display, w);
  13.259 +    X11_PumpEvents(_this);
  13.260 +}
  13.261 +
  13.262 +int
  13.263 +X11_GL_Initialize(_THIS)
  13.264 +{
  13.265 +    if (_this->gl_data) {
  13.266 +        ++_this->gl_data->initialized;
  13.267 +        return 0;
  13.268 +    }
  13.269 +
  13.270 +    _this->gl_data =
  13.271 +        (struct SDL_GLDriverData *) SDL_calloc(1,
  13.272 +                                               sizeof(struct
  13.273 +                                                      SDL_GLDriverData));
  13.274 +    if (!_this->gl_data) {
  13.275 +        SDL_OutOfMemory();
  13.276 +        return -1;
  13.277 +    }
  13.278 +    _this->gl_data->initialized = 1;
  13.279 +
  13.280 +    if (X11_GL_LoadLibrary(_this, NULL) < 0) {
  13.281 +        return -1;
  13.282 +    }
  13.283 +
  13.284 +    /* Initialize extensions */
  13.285 +    X11_GL_InitExtensions(_this);
  13.286 +
  13.287 +    return 0;
  13.288 +}
  13.289 +
  13.290 +void
  13.291 +X11_GL_Shutdown(_THIS)
  13.292 +{
  13.293 +    if (!_this->gl_data || (--_this->gl_data->initialized > 0)) {
  13.294 +        return;
  13.295 +    }
  13.296 +
  13.297 +    X11_GL_UnloadLibrary(_this);
  13.298 +
  13.299 +    SDL_free(_this->gl_data);
  13.300 +    _this->gl_data = NULL;
  13.301 +}
  13.302 +
  13.303 +XVisualInfo *
  13.304 +X11_GL_GetVisual(_THIS, Display * display, int screen)
  13.305 +{
  13.306 +    XVisualInfo *vinfo;
  13.307 +
  13.308 +    /* 64 seems nice. */
  13.309 +    int attribs[64];
  13.310 +    int i;
  13.311 +
  13.312 +    /* Setup our GLX attributes according to the gl_config. */
  13.313 +    i = 0;
  13.314 +    attribs[i++] = GLX_RGBA;
  13.315 +    attribs[i++] = GLX_RED_SIZE;
  13.316 +    attribs[i++] = _this->gl_config.red_size;
  13.317 +    attribs[i++] = GLX_GREEN_SIZE;
  13.318 +    attribs[i++] = _this->gl_config.green_size;
  13.319 +    attribs[i++] = GLX_BLUE_SIZE;
  13.320 +    attribs[i++] = _this->gl_config.blue_size;
  13.321 +
  13.322 +    if (_this->gl_config.alpha_size) {
  13.323 +        attribs[i++] = GLX_ALPHA_SIZE;
  13.324 +        attribs[i++] = _this->gl_config.alpha_size;
  13.325 +    }
  13.326 +
  13.327 +    if (_this->gl_config.buffer_size) {
  13.328 +        attribs[i++] = GLX_BUFFER_SIZE;
  13.329 +        attribs[i++] = _this->gl_config.buffer_size;
  13.330 +    }
  13.331 +
  13.332 +    if (_this->gl_config.double_buffer) {
  13.333 +        attribs[i++] = GLX_DOUBLEBUFFER;
  13.334 +    }
  13.335 +
  13.336 +    attribs[i++] = GLX_DEPTH_SIZE;
  13.337 +    attribs[i++] = _this->gl_config.depth_size;
  13.338 +
  13.339 +    if (_this->gl_config.stencil_size) {
  13.340 +        attribs[i++] = GLX_STENCIL_SIZE;
  13.341 +        attribs[i++] = _this->gl_config.stencil_size;
  13.342 +    }
  13.343 +
  13.344 +    if (_this->gl_config.accum_red_size) {
  13.345 +        attribs[i++] = GLX_ACCUM_RED_SIZE;
  13.346 +        attribs[i++] = _this->gl_config.accum_red_size;
  13.347 +    }
  13.348 +
  13.349 +    if (_this->gl_config.accum_green_size) {
  13.350 +        attribs[i++] = GLX_ACCUM_GREEN_SIZE;
  13.351 +        attribs[i++] = _this->gl_config.accum_green_size;
  13.352 +    }
  13.353 +
  13.354 +    if (_this->gl_config.accum_blue_size) {
  13.355 +        attribs[i++] = GLX_ACCUM_BLUE_SIZE;
  13.356 +        attribs[i++] = _this->gl_config.accum_blue_size;
  13.357 +    }
  13.358 +
  13.359 +    if (_this->gl_config.accum_alpha_size) {
  13.360 +        attribs[i++] = GLX_ACCUM_ALPHA_SIZE;
  13.361 +        attribs[i++] = _this->gl_config.accum_alpha_size;
  13.362 +    }
  13.363 +
  13.364 +    if (_this->gl_config.stereo) {
  13.365 +        attribs[i++] = GLX_STEREO;
  13.366 +    }
  13.367 +
  13.368 +    if (_this->gl_config.multisamplebuffers) {
  13.369 +        attribs[i++] = GLX_SAMPLE_BUFFERS_ARB;
  13.370 +        attribs[i++] = _this->gl_config.multisamplebuffers;
  13.371 +    }
  13.372 +
  13.373 +    if (_this->gl_config.multisamplesamples) {
  13.374 +        attribs[i++] = GLX_SAMPLES_ARB;
  13.375 +        attribs[i++] = _this->gl_config.multisamplesamples;
  13.376 +    }
  13.377 +
  13.378 +    if (_this->gl_config.accelerated >= 0
  13.379 +        && _this->gl_data->HAS_GLX_EXT_visual_rating) {
  13.380 +        attribs[i++] = GLX_VISUAL_CAVEAT_EXT;
  13.381 +        attribs[i++] = GLX_NONE_EXT;
  13.382 +    }
  13.383 +#ifdef GLX_DIRECT_COLOR         /* Try for a DirectColor visual for gamma support */
  13.384 +    if (!SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR")) {
  13.385 +        attribs[i++] = GLX_X_VISUAL_TYPE;
  13.386 +        attribs[i++] = GLX_DIRECT_COLOR;
  13.387 +    }
  13.388 +#endif
  13.389 +    attribs[i++] = None;
  13.390 +
  13.391 +    vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs);
  13.392 +#ifdef GLX_DIRECT_COLOR
  13.393 +    if (!vinfo && !SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR")) { /* No DirectColor visual?  Try again.. */
  13.394 +        attribs[i - 3] = None;
  13.395 +        vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs);
  13.396 +    }
  13.397 +#endif
  13.398 +    if (!vinfo) {
  13.399 +        SDL_SetError("Couldn't find matching GLX visual");
  13.400 +    }
  13.401 +    return vinfo;
  13.402 +}
  13.403 +
  13.404 +SDL_GLContext
  13.405 +X11_GL_CreateContext(_THIS, SDL_Window * window)
  13.406 +{
  13.407 +    SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
  13.408 +    Display *display = data->videodata->display;
  13.409 +    int screen =
  13.410 +        ((SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata)->
  13.411 +        screen;
  13.412 +    XWindowAttributes xattr;
  13.413 +    XVisualInfo v, *vinfo;
  13.414 +    int n;
  13.415 +    GLXContext context = NULL;
  13.416 +
  13.417 +    /* We do _this to create a clean separation between X and GLX errors. */
  13.418 +    XSync(display, False);
  13.419 +    XGetWindowAttributes(display, data->window, &xattr);
  13.420 +    v.screen = screen;
  13.421 +    v.visualid = XVisualIDFromVisual(xattr.visual);
  13.422 +    vinfo = XGetVisualInfo(display, VisualScreenMask | VisualIDMask, &v, &n);
  13.423 +    if (vinfo) {
  13.424 +        context =
  13.425 +            _this->gl_data->glXCreateContext(display, vinfo, NULL, True);
  13.426 +        XFree(vinfo);
  13.427 +    }
  13.428 +    XSync(display, False);
  13.429 +
  13.430 +    if (!context) {
  13.431 +        SDL_SetError("Could not create GL context");
  13.432 +    }
  13.433 +    return (SDL_GLContext) context;
  13.434 +}
  13.435 +
  13.436 +int
  13.437 +X11_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
  13.438 +{
  13.439 +    Display *display = ((SDL_VideoData *) _this->driverdata)->display;
  13.440 +    Window drawable =
  13.441 +        (window ? ((SDL_WindowData *) window->driverdata)->window : None);
  13.442 +    GLXContext glx_context = (GLXContext) context;
  13.443 +    int status;
  13.444 +
  13.445 +    status = 0;
  13.446 +    if (!_this->gl_data->glXMakeCurrent(display, drawable, glx_context)) {
  13.447 +        SDL_SetError("Unable to make GL context current");
  13.448 +        status = -1;
  13.449 +    }
  13.450 +    XSync(display, False);
  13.451 +
  13.452 +    return (status);
  13.453 +}
  13.454 +
  13.455 +int
  13.456 +X11_GL_SetSwapInterval(_THIS, int interval)
  13.457 +{
  13.458 +    int status;
  13.459 +
  13.460 +    if (_this->gl_data->glXSwapIntervalMESA) {
  13.461 +        status = _this->gl_data->glXSwapIntervalMESA(interval);
  13.462 +        if (status != 0) {
  13.463 +            SDL_SetError("glxSwapIntervalMESA failed");
  13.464 +            status = -1;
  13.465 +        }
  13.466 +    } else if (_this->gl_data->glXSwapIntervalSGI) {
  13.467 +        status = _this->gl_data->glXSwapIntervalSGI(interval);
  13.468 +        if (status != 0) {
  13.469 +            SDL_SetError("glxSwapIntervalSGI failed");
  13.470 +            status = -1;
  13.471 +        }
  13.472 +    } else {
  13.473 +        SDL_Unsupported();
  13.474 +        status = -1;
  13.475 +    }
  13.476 +    return status;
  13.477 +}
  13.478 +
  13.479 +int
  13.480 +X11_GL_GetSwapInterval(_THIS)
  13.481 +{
  13.482 +    if (_this->gl_data->glXGetSwapIntervalMESA) {
  13.483 +        return _this->gl_data->glXGetSwapIntervalMESA();
  13.484 +    } else {
  13.485 +        SDL_Unsupported();
  13.486 +        return -1;
  13.487 +    }
  13.488 +}
  13.489 +
  13.490 +void
  13.491 +X11_GL_SwapWindow(_THIS, SDL_Window * window)
  13.492 +{
  13.493 +    SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
  13.494 +    Display *display = data->videodata->display;
  13.495 +
  13.496 +    _this->gl_data->glXSwapBuffers(display, data->window);
  13.497 +}
  13.498 +
  13.499 +void
  13.500 +X11_GL_DeleteContext(_THIS, SDL_GLContext context)
  13.501 +{
  13.502 +    Display *display = ((SDL_VideoData *) _this->driverdata)->display;
  13.503 +    GLXContext glx_context = (GLXContext) context;
  13.504 +
  13.505 +    _this->gl_data->glXDestroyContext(display, glx_context);
  13.506 +}
  13.507 +
  13.508 +#endif /* SDL_VIDEO_OPENGL_GLX */
  13.509 +
  13.510 +/* vi: set ts=4 sw=4 expandtab: */
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/src/video/x11/SDL_x11opengl.h	Fri Jul 28 08:43:17 2006 +0000
    14.3 @@ -0,0 +1,79 @@
    14.4 +/*
    14.5 +    SDL - Simple DirectMedia Layer
    14.6 +    Copyright (C) 1997-2006 Sam Lantinga
    14.7 +
    14.8 +    This library is free software; you can redistribute it and/or
    14.9 +    modify it under the terms of the GNU Lesser General Public
   14.10 +    License as published by the Free Software Foundation; either
   14.11 +    version 2.1 of the License, or (at your option) any later version.
   14.12 +
   14.13 +    This library is distributed in the hope that it will be useful,
   14.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
   14.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   14.16 +    Lesser General Public License for more details.
   14.17 +
   14.18 +    You should have received a copy of the GNU Lesser General Public
   14.19 +    License along with this library; if not, write to the Free Software
   14.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   14.21 +
   14.22 +    Sam Lantinga
   14.23 +    slouken@libsdl.org
   14.24 +*/
   14.25 +#include "SDL_config.h"
   14.26 +
   14.27 +#ifndef _SDL_x11opengl_h
   14.28 +#define _SDL_x11opengl_h
   14.29 +
   14.30 +#if SDL_VIDEO_OPENGL_GLX
   14.31 +#include "SDL_opengl.h"
   14.32 +#include <GL/glx.h>
   14.33 +
   14.34 +struct SDL_GLDriverData
   14.35 +{
   14.36 +    int initialized;
   14.37 +    SDL_bool HAS_GLX_EXT_visual_rating;
   14.38 +
   14.39 +    void *(*glXGetProcAddress) (const GLubyte * procName);
   14.40 +
   14.41 +    XVisualInfo *(*glXChooseVisual)
   14.42 +      (Display * dpy, int screen, int *attribList);
   14.43 +
   14.44 +      GLXContext(*glXCreateContext)
   14.45 +      (Display * dpy, XVisualInfo * vis, GLXContext shareList, Bool direct);
   14.46 +
   14.47 +    void (*glXDestroyContext)
   14.48 +      (Display * dpy, GLXContext ctx);
   14.49 +
   14.50 +      Bool(*glXMakeCurrent)
   14.51 +      (Display * dpy, GLXDrawable drawable, GLXContext ctx);
   14.52 +
   14.53 +    void (*glXSwapBuffers)
   14.54 +      (Display * dpy, GLXDrawable drawable);
   14.55 +
   14.56 +    int (*glXGetConfig)
   14.57 +      (Display * dpy, XVisualInfo * visual_info, int attrib, int *value);
   14.58 +
   14.59 +    int (*glXSwapIntervalSGI) (int interval);
   14.60 +      GLint(*glXSwapIntervalMESA) (unsigned interval);
   14.61 +      GLint(*glXGetSwapIntervalMESA) (void);
   14.62 +};
   14.63 +
   14.64 +/* OpenGL functions */
   14.65 +extern int X11_GL_LoadLibrary(_THIS, const char *path);
   14.66 +extern void *X11_GL_GetProcAddress(_THIS, const char *proc);
   14.67 +extern int X11_GL_Initialize(_THIS);
   14.68 +extern void X11_GL_Shutdown(_THIS);
   14.69 +extern XVisualInfo *X11_GL_GetVisual(_THIS, Display * display, int screen);
   14.70 +extern SDL_GLContext X11_GL_CreateContext(_THIS, SDL_Window * window);
   14.71 +extern int X11_GL_MakeCurrent(_THIS, SDL_Window * window,
   14.72 +                              SDL_GLContext context);
   14.73 +extern int X11_GL_SetSwapInterval(_THIS, int interval);
   14.74 +extern int X11_GL_GetSwapInterval(_THIS);
   14.75 +extern void X11_GL_SwapWindow(_THIS, SDL_Window * window);
   14.76 +extern void X11_GL_DeleteContext(_THIS, SDL_GLContext context);
   14.77 +
   14.78 +#endif /* SDL_VIDEO_OPENGL_GLX */
   14.79 +
   14.80 +#endif /* _SDL_x11opengl_h */
   14.81 +
   14.82 +/* vi: set ts=4 sw=4 expandtab: */
    15.1 --- a/src/video/x11/SDL_x11sym.h	Thu Jul 27 06:53:23 2006 +0000
    15.2 +++ b/src/video/x11/SDL_x11sym.h	Fri Jul 28 08:43:17 2006 +0000
    15.3 @@ -20,499 +20,185 @@
    15.4      slouken@libsdl.org
    15.5  */
    15.6  
    15.7 +/* *INDENT-OFF* */
    15.8 +
    15.9  SDL_X11_MODULE(BASEXLIB)
   15.10 -    SDL_X11_SYM(XClassHint *, XAllocClassHint, (void), (), return)
   15.11 -    SDL_X11_SYM(Status, XAllocColor, (Display * a, Colormap b, XColor * c),
   15.12 -            (a, b, c), return) SDL_X11_SYM(XSizeHints *, XAllocSizeHints,
   15.13 -                                           (void), (),
   15.14 -                                           return) SDL_X11_SYM(XWMHints *,
   15.15 -                                                               XAllocWMHints,
   15.16 -                                                               (void), (),
   15.17 -                                                               return)
   15.18 -    SDL_X11_SYM(int, XChangePointerControl,
   15.19 -            (Display * a, Bool b, Bool c, int d, int e, int f), (a, b, c, d,
   15.20 -                                                             e, f),
   15.21 -            return) SDL_X11_SYM(int, XChangeProperty, (Display * a,
   15.22 -                                                       Window b, Atom c,
   15.23 -                                                       Atom d, int e, int f,
   15.24 -                                                       _Xconst unsigned char
   15.25 -                                                       *g, int h), (a, b, c,
   15.26 -                                                                    d, e, f,
   15.27 -                                                                    g, h),
   15.28 -                                return) SDL_X11_SYM(int,
   15.29 -                                                    XChangeWindowAttributes,
   15.30 -                                                    (Display * a, Window b,
   15.31 -                                                     unsigned long c,
   15.32 -                                                     XSetWindowAttributes *
   15.33 -                                                     d), (a, b, c, d), return)
   15.34 -    SDL_X11_SYM(Bool, XCheckTypedEvent, (Display * a, int b, XEvent * c),
   15.35 -            (a, b, c), return) SDL_X11_SYM(int, XClearWindow, (Display * a,
   15.36 -                                                               Window b),
   15.37 -                                           (a, b), return) SDL_X11_SYM(int,
   15.38 -                                                                       XCloseDisplay,
   15.39 -                                                                       (Display
   15.40 -                                                                        *
   15.41 -                                                                        a),
   15.42 -                                                                       (a),
   15.43 -                                                                       return)
   15.44 -    SDL_X11_SYM(Colormap, XCreateColormap,
   15.45 -            (Display * a, Window b, Visual * c, int d), (a, b, c, d),
   15.46 -            return) SDL_X11_SYM(Cursor, XCreatePixmapCursor, (Display * a,
   15.47 -                                                              Pixmap b,
   15.48 -                                                              Pixmap c,
   15.49 -                                                              XColor * d,
   15.50 -                                                              XColor * e,
   15.51 -                                                              unsigned int
   15.52 -                                                              f,
   15.53 -                                                              unsigned int
   15.54 -                                                              g), (a, b, c,
   15.55 -                                                                   d, e, f,
   15.56 -                                                                   g),
   15.57 -                                return) SDL_X11_SYM(GC, XCreateGC,
   15.58 -                                                    (Display * a,
   15.59 -                                                     Drawable b,
   15.60 -                                                     unsigned long c,
   15.61 -                                                     XGCValues * d), (a, b,
   15.62 -                                                                      c,
   15.63 -                                                                      d),
   15.64 -                                                    return)
   15.65 -    SDL_X11_SYM(XImage *, XCreateImage,
   15.66 -            (Display * a, Visual * b, unsigned int c, int d, int e, char *f,
   15.67 -         unsigned int g, unsigned int h, int i, int j), (a, b, c, d, e,
   15.68 -                                                     f, g, h, i, j),
   15.69 -return) SDL_X11_SYM(Pixmap, XCreatePixmap, (Display * a,
   15.70 -Drawable b,
   15.71 -unsigned int c,
   15.72 -unsigned int d,
   15.73 -unsigned int e), (a,
   15.74 -      b,
   15.75 -      c,
   15.76 -      d,
   15.77 -      e),
   15.78 -return) SDL_X11_SYM(Pixmap,
   15.79 -XCreatePixmapFromBitmapData,
   15.80 -(Display * a,
   15.81 -Drawable b, char *c,
   15.82 -unsigned int d,
   15.83 -unsigned int e,
   15.84 -unsigned long f, unsigned long g, unsigned int h), (a, b, c, d, e, f, g, h), return)
   15.85 -    SDL_X11_SYM(Window, XCreateSimpleWindow,
   15.86 -            (Display * a, Window b, int c, int d, unsigned int e,
   15.87 -         unsigned int f, unsigned int g, unsigned long h,
   15.88 -         unsigned long i), (a, b, c, d, e, f, g, h, i),
   15.89 -return) SDL_X11_SYM(Window, XCreateWindow, (Display * a,
   15.90 -Window b, int c,
   15.91 -int d,
   15.92 -unsigned int e,
   15.93 -unsigned int f,
   15.94 -unsigned int g,
   15.95 -int h,
   15.96 -unsigned int i,
   15.97 -Visual * j,
   15.98 -unsigned long k,
   15.99 -XSetWindowAttributes
  15.100 -* l), (a, b, c, d,
  15.101 -      e, f, g, h,
  15.102 -      i, j, k, l),
  15.103 -return) SDL_X11_SYM(int, XDefineCursor, (Display * a, Window b, Cursor c), (a, b, c), return)
  15.104 -    SDL_X11_SYM(int, XDeleteProperty, (Display * a, Window b, Atom c), (a, b, c),
  15.105 -            return) SDL_X11_SYM(int, XDestroyWindow, (Display * a,
  15.106 -                                                      Window b), (a, b),
  15.107 -                                return) SDL_X11_SYM(char *, XDisplayName,
  15.108 -                                                    (_Xconst char *a), (a),
  15.109 -                                                    return)
  15.110 -    SDL_X11_SYM(int, XEventsQueued, (Display * a, int b), (a, b),
  15.111 -            return) SDL_X11_SYM(Bool, XFilterEvent, (XEvent * event,
  15.112 -                                                     Window w), (event, w),
  15.113 -                                return) SDL_X11_SYM(int, XFlush,
  15.114 -                                                    (Display * a), (a),
  15.115 -                                                    return)
  15.116 -    SDL_X11_SYM(int, XFree, (void *a), (a), return) SDL_X11_SYM(int,
  15.117 -                                                                XFreeColormap,
  15.118 -                                                                (Display *
  15.119 -                                                                 a,
  15.120 -                                                                 Colormap
  15.121 -                                                                 b), (a, b),
  15.122 -                                                                return)
  15.123 -    SDL_X11_SYM(int, XFreeColors,
  15.124 -            (Display * a, Colormap b, unsigned long *c, int d, unsigned long e),
  15.125 -            (a, b, c, d, e), return) SDL_X11_SYM(int, XFreeCursor,
  15.126 -                                                 (Display * a, Cursor b),
  15.127 -                                                 (a, b), return)
  15.128 -    SDL_X11_SYM(int, XFreeGC, (Display * a, GC b), (a, b),
  15.129 -            return) SDL_X11_SYM(int, XFreeModifiermap,
  15.130 -                                (XModifierKeymap * a), (a),
  15.131 -                                return) SDL_X11_SYM(int, XFreePixmap,
  15.132 -                                                    (Display * a,
  15.133 -                                                     Pixmap b), (a, b),
  15.134 -                                                    return)
  15.135 -    SDL_X11_SYM(int, XGetErrorDatabaseText,
  15.136 -            (Display * a, _Xconst char *b, _Xconst char *c, _Xconst char *d,
  15.137 -         char *e, int f), (a, b, c, d, e, f),
  15.138 -return) SDL_X11_SYM(XModifierKeymap *, XGetModifierMapping, (Display * a), (a), return) SDL_X11_SYM(int, XGetPointerControl,
  15.139 -                                            (Display * a, int *b, int *c,
  15.140 -                                             int *d), (a, b, c, d), return)
  15.141 -    SDL_X11_SYM(int, XGetScreenSaver,
  15.142 -            (Display * a, int *b, int *c, int *d, int *e), (a, b, c, d, e),
  15.143 -            return) SDL_X11_SYM(XVisualInfo *, XGetVisualInfo, (Display * a,
  15.144 -                                                                long b,
  15.145 -                                                                XVisualInfo
  15.146 -                                                                * c,
  15.147 -                                                                int *d), (a,
  15.148 -                                                                          b,
  15.149 -                                                                          c,
  15.150 -                                                                          d),
  15.151 -                                return) SDL_X11_SYM(XWMHints *,
  15.152 -                                                    XGetWMHints,
  15.153 -                                                    (Display * a,
  15.154 -                                                     Window b), (a, b),
  15.155 -                                                    return)
  15.156 -    SDL_X11_SYM(Status, XGetWindowAttributes,
  15.157 -            (Display * a, Window b, XWindowAttributes * c), (a, b, c),
  15.158 -            return) SDL_X11_SYM(int, XGrabKeyboard, (Display * a, Window b,
  15.159 -                                                     Bool c, int d, int e,
  15.160 -                                                     Time f), (a, b, c, d,
  15.161 -                                                               e, f),
  15.162 -                                return) SDL_X11_SYM(int, XGrabPointer,
  15.163 -                                                    (Display * a, Window b,
  15.164 -                                                     Bool c,
  15.165 -                                                     unsigned int d, int e,
  15.166 -                                                     int f, Window g,
  15.167 -                                                     Cursor h, Time i), (a,
  15.168 -                                                                         b,
  15.169 -                                                                         c,
  15.170 -                                                                         d,
  15.171 -                                                                         e,
  15.172 -                                                                         f,
  15.173 -                                                                         g,
  15.174 -                                                                         h,
  15.175 -                                                                         i),
  15.176 -                                                    return)
  15.177 -    SDL_X11_SYM(Status, XIconifyWindow, (Display * a, Window b, int c),
  15.178 -            (a, b, c), return) SDL_X11_SYM(int, XInstallColormap,
  15.179 -                                           (Display * a, Colormap b), (a,
  15.180 -                                                                       b),
  15.181 -                                           return) SDL_X11_SYM(KeyCode,
  15.182 -                                                               XKeysymToKeycode,
  15.183 -                                                               (Display *
  15.184 -                                                                a,
  15.185 -                                                                KeySym b),
  15.186 -                                                               (a, b), return)
  15.187 -    SDL_X11_SYM(Atom, XInternAtom, (Display * a, _Xconst char *b, Bool c),
  15.188 -            (a, b, c), return) SDL_X11_SYM(XPixmapFormatValues *,
  15.189 -                                           XListPixmapFormats, (Display * a,
  15.190 -                                                                int *b), (a,
  15.191 -                                                                          b),
  15.192 -                                           return) SDL_X11_SYM(int,
  15.193 -                                                               XLookupString,
  15.194 -                                                               (XKeyEvent *
  15.195 -                                                                a, char *b,
  15.196 -                                                                int c,
  15.197 -                                                                KeySym * d,
  15.198 -                                                                XComposeStatus
  15.199 -                                                                * e), (a,
  15.200 -                                                                       b,
  15.201 -                                                                       c,
  15.202 -                                                                       d,
  15.203 -                                                                       e),
  15.204 -                                                               return)
  15.205 -    SDL_X11_SYM(int, XMapRaised, (Display * a, Window b), (a, b),
  15.206 -            return) SDL_X11_SYM(int, XMapWindow, (Display * a, Window b),
  15.207 -                                (a, b), return) SDL_X11_SYM(int,
  15.208 -                                                            XMaskEvent,
  15.209 -                                                            (Display * a,
  15.210 -                                                             long b,
  15.211 -                                                             XEvent * c),
  15.212 -                                                            (a, b, c), return)
  15.213 -    SDL_X11_SYM(Status, XMatchVisualInfo,
  15.214 -            (Display * a, int b, int c, int d, XVisualInfo * e), (a, b, c, d, e),
  15.215 -            return) SDL_X11_SYM(int, XMissingExtension, (Display * a,
  15.216 -                                                         _Xconst char *b),
  15.217 -                                (a, b), return) SDL_X11_SYM(int,
  15.218 -                                                            XMoveResizeWindow,
  15.219 -                                                            (Display * a,
  15.220 -                                                             Window b,
  15.221 -                                                             int c, int d,
  15.222 -                                                             unsigned int
  15.223 -                                                             e,
  15.224 -                                                             unsigned int
  15.225 -                                                             f), (a, b, c,
  15.226 -                                                                  d, e, f),
  15.227 -                                                            return)
  15.228 -    SDL_X11_SYM(int, XMoveWindow, (Display * a, Window b, int c, int d),
  15.229 -            (a, b, c, d), return) SDL_X11_SYM(int, XNextEvent, (Display * a,
  15.230 -                                                                XEvent * b),
  15.231 -                                              (a, b),
  15.232 -                                              return) SDL_X11_SYM(Display
  15.233 -                                                                  *,
  15.234 -                                                                  XOpenDisplay,
  15.235 -                                                                  (_Xconst
  15.236 -                                                                   char
  15.237 -                                                                   *a),
  15.238 -                                                                  (a), return)
  15.239 -    SDL_X11_SYM(int, XPeekEvent, (Display * a, XEvent * b), (a, b),
  15.240 -            return) SDL_X11_SYM(int, XPending, (Display * a), (a),
  15.241 -                                return) SDL_X11_SYM(int, XPutImage,
  15.242 -                                                    (Display * a,
  15.243 -                                                     Drawable b, GC c,
  15.244 -                                                     XImage * d, int e,
  15.245 -                                                     int f, int g, int h,
  15.246 -                                                     unsigned int i,
  15.247 -                                                     unsigned int j), (a,
  15.248 -                                                                       b,
  15.249 -                                                                       c,
  15.250 -                                                                       d,
  15.251 -                                                                       e,
  15.252 -                                                                       f,
  15.253 -                                                                       g,
  15.254 -                                                                       h,
  15.255 -                                                                       i,
  15.256 -                                                                       j),
  15.257 -                                                    return)
  15.258 -    SDL_X11_SYM(int, XQueryColors, (Display * a, Colormap b, XColor * c, int d),
  15.259 -            (a, b, c, d), return) SDL_X11_SYM(int, XQueryKeymap,
  15.260 -                                              (Display * a, char *b), (a,
  15.261 -                                                                       b),
  15.262 -                                              return) SDL_X11_SYM(Bool,
  15.263 -                                                                  XQueryPointer,
  15.264 -                                                                  (Display
  15.265 -                                                                   * a,
  15.266 -                                                                   Window
  15.267 -                                                                   b,
  15.268 -                                                                   Window *
  15.269 -                                                                   c,
  15.270 -                                                                   Window *
  15.271 -                                                                   d,
  15.272 -                                                                   int *e,
  15.273 -                                                                   int *f,
  15.274 -                                                                   int *g,
  15.275 -                                                                   int *h,
  15.276 -                                                                   unsigned
  15.277 -                                                                   int *i),
  15.278 -                                                                  (a, b, c,
  15.279 -                                                                   d, e, f,
  15.280 -                                                                   g, h,
  15.281 -                                                                   i), return)
  15.282 -    SDL_X11_SYM(int, XRaiseWindow, (Display * a, Window b), (a, b),
  15.283 -            return) SDL_X11_SYM(int, XReparentWindow, (Display * a,
  15.284 -                                                       Window b, Window c,
  15.285 -                                                       int d, int e), (a, b,
  15.286 -                                                                       c, d,
  15.287 -                                                                       e),
  15.288 -                                return) SDL_X11_SYM(int, XResizeWindow,
  15.289 -                                                    (Display * a, Window b,
  15.290 -                                                     unsigned int c,
  15.291 -                                                     unsigned int d), (a,
  15.292 -                                                                       b,
  15.293 -                                                                       c,
  15.294 -                                                                       d),
  15.295 -                                                    return)
  15.296 -    SDL_X11_SYM(int, XSelectInput, (Display * a, Window b, long c), (a, b, c),
  15.297 -            return) SDL_X11_SYM(Status, XSendEvent, (Display * a, Window b,
  15.298 -                                                     Bool c, long d,
  15.299 -                                                     XEvent * e), (a, b, c,
  15.300 -                                                                   d, e),
  15.301 -                                return) SDL_X11_SYM(int, XSetClassHint,
  15.302 -                                                    (Display * a, Window b,
  15.303 -                                                     XClassHint * c), (a,
  15.304 -                                                                       b,
  15.305 -                                                                       c),
  15.306 -                                                    return)
  15.307 -    SDL_X11_SYM(XErrorHandler, XSetErrorHandler, (XErrorHandler a), (a),
  15.308 -            return) SDL_X11_SYM(XIOErrorHandler, XSetIOErrorHandler,
  15.309 -                                (XIOErrorHandler a), (a),
  15.310 -                                return) SDL_X11_SYM(int, XSetScreenSaver,
  15.311 -                                                    (Display * a, int b,
  15.312 -                                                     int c, int d, int e),
  15.313 -                                                    (a, b, c, d, e), return)
  15.314 -    SDL_X11_SYM(int, XSetTransientForHint, (Display * a, Window b, Window c),
  15.315 -            (a, b, c), return) SDL_X11_SYM(int, XSetWMHints, (Display * a,
  15.316 -                                                              Window b,
  15.317 -                                                              XWMHints * c),
  15.318 -                                           (a, b, c),
  15.319 -                                           return) SDL_X11_SYM(void,
  15.320 -                                                               XSetTextProperty,
  15.321 -                                                               (Display *
  15.322 -                                                                a,
  15.323 -                                                                Window b,
  15.324 -                                                                XTextProperty
  15.325 -                                                                * c,
  15.326 -                                                                Atom d),
  15.327 -                                                               (a, b, c, d),)
  15.328 -SDL_X11_SYM(void, XSetWMNormalHints, (Display * a, Window b, XSizeHints * c),
  15.329 -            (a, b, c),)
  15.330 -SDL_X11_SYM(Status, XSetWMProtocols,
  15.331 -            (Display * a, Window b, Atom * c, int d), (a, b, c, d), return)
  15.332 -SDL_X11_SYM(int, XSetWindowBackground,
  15.333 -            (Display * a, Window b, unsigned long c), (a, b, c), return)
  15.334 -SDL_X11_SYM(int, XSetWindowBackgroundPixmap,
  15.335 -            (Display * a, Window b, Pixmap c), (a, b, c), return)
  15.336 -SDL_X11_SYM(int, XSetWindowColormap, (Display * a, Window b, Colormap c),
  15.337 -            (a, b, c), return)
  15.338 -SDL_X11_SYM(int, XStoreColors, (Display * a, Colormap b, XColor * c, int d),
  15.339 -            (a, b, c, d), return)
  15.340 -SDL_X11_SYM(Status, XStringListToTextProperty,
  15.341 -            (char **a, int b, XTextProperty * c), (a, b, c), return)
  15.342 -SDL_X11_SYM(int, XSync, (Display * a, Bool b), (a, b), return)
  15.343 -SDL_X11_SYM(int, XUngrabKeyboard, (Display * a, Time b), (a, b), return)
  15.344 -SDL_X11_SYM(int, XUngrabPointer, (Display * a, Time b), (a, b), return)
  15.345 -SDL_X11_SYM(int, XUnmapWindow, (Display * a, Window b), (a, b), return)
  15.346 -SDL_X11_SYM(int, XWarpPointer,
  15.347 -            (Display * a, Window b, Window c, int d, int e, unsigned int f,
  15.348 -             unsigned int g, int h, int i), (a, b, c, d, e, f, g, h, i),
  15.349 -            return)
  15.350 -SDL_X11_SYM(VisualID, XVisualIDFromVisual, (Visual * a), (a), return)
  15.351 -SDL_X11_SYM(XExtDisplayInfo *, XextAddDisplay,
  15.352 -            (XExtensionInfo * a, Display * b, char *c, XExtensionHooks * d,
  15.353 -             int e, XPointer f), (a, b, c, d, e, f), return)
  15.354 -SDL_X11_SYM(XExtensionInfo *, XextCreateExtension, (void), (), return)
  15.355 -SDL_X11_SYM(void, XextDestroyExtension, (XExtensionInfo * a), (a),)
  15.356 -SDL_X11_SYM(XExtDisplayInfo *, XextFindDisplay,
  15.357 -            (XExtensionInfo * a, Display * b), (a, b), return)
  15.358 -SDL_X11_SYM(int, XextRemoveDisplay, (XExtensionInfo * a, Display * b),
  15.359 -            (a, b), return)
  15.360 -SDL_X11_SYM(Bool, XQueryExtension,
  15.361 -            (Display * a, _Xconst char *b, int *c, int *d, int *e), (a, b, c,
  15.362 -                                                                     d, e),
  15.363 -            return)
  15.364 -SDL_X11_SYM(char *, XDisplayString, (Display * a), (a), return)
  15.365 -SDL_X11_SYM(int, XGetErrorText, (Display * a, int b, char *c, int d),
  15.366 -            (a, b, c, d), return)
  15.367 -SDL_X11_SYM(void, _XEatData, (Display * a, unsigned long b), (a, b),)
  15.368 -SDL_X11_SYM(void, _XFlush, (Display * a), (a),)
  15.369 -SDL_X11_SYM(void, _XFlushGCCache, (Display * a, GC b), (a, b),)
  15.370 -SDL_X11_SYM(int, _XRead, (Display * a, char *b, long c), (a, b, c), return)
  15.371 -SDL_X11_SYM(void, _XReadPad, (Display * a, char *b, long c), (a, b, c),)
  15.372 -SDL_X11_SYM(void, _XSend, (Display * a, _Xconst char *b, long c), (a, b, c),)
  15.373 -SDL_X11_SYM(Status, _XReply, (Display * a, xReply * b, int c, Bool d),
  15.374 -            (a, b, c, d), return)
  15.375 -SDL_X11_SYM(unsigned long, _XSetLastRequestRead,
  15.376 -            (Display * a, xGenericReply * b), (a, b), return)
  15.377 -SDL_X11_SYM(SDL_X11_XSynchronizeRetType, XSynchronize, (Display * a, Bool b),
  15.378 -            (a, b), return)
  15.379 -SDL_X11_SYM(SDL_X11_XESetWireToEventRetType, XESetWireToEvent,
  15.380 -            (Display * a, int b, SDL_X11_XESetWireToEventRetType c), (a, b,
  15.381 -                                                                      c),
  15.382 -            return)
  15.383 -SDL_X11_SYM(SDL_X11_XESetEventToWireRetType, XESetEventToWire,
  15.384 -            (Display * a, int b, SDL_X11_XESetEventToWireRetType c), (a, b,
  15.385 -                                                                      c),
  15.386 -            return)
  15.387 -SDL_X11_SYM(XExtensionErrorHandler, XSetExtensionErrorHandler,
  15.388 -            (XExtensionErrorHandler a), (a), return)
  15.389 +SDL_X11_SYM(XClassHint*,XAllocClassHint,(void),(),return)
  15.390 +SDL_X11_SYM(Status,XAllocColor,(Display* a,Colormap b,XColor* c),(a,b,c),return)
  15.391 +SDL_X11_SYM(XSizeHints*,XAllocSizeHints,(void),(),return)
  15.392 +SDL_X11_SYM(XWMHints*,XAllocWMHints,(void),(),return)
  15.393 +SDL_X11_SYM(int,XChangePointerControl,(Display* a,Bool b,Bool c,int d,int e,int f),(a,b,c,d,e,f),return)
  15.394 +SDL_X11_SYM(int,XChangeProperty,(Display* a,Window b,Atom c,Atom d,int e,int f,_Xconst unsigned char* g,int h),(a,b,c,d,e,f,g,h),return)
  15.395 +SDL_X11_SYM(int,XChangeWindowAttributes,(Display* a,Window b,unsigned long c,XSetWindowAttributes* d),(a,b,c,d),return)
  15.396 +SDL_X11_SYM(Bool,XCheckWindowEvent,(Display* a,Window b,long c,XEvent* d),(a,b,c,d),return)
  15.397 +SDL_X11_SYM(int,XClearWindow,(Display* a,Window b),(a,b),return)
  15.398 +SDL_X11_SYM(int,XCloseDisplay,(Display* a),(a),return)
  15.399 +SDL_X11_SYM(Colormap,XCreateColormap,(Display* a,Window b,Visual* c,int d),(a,b,c,d),return)
  15.400 +SDL_X11_SYM(Cursor,XCreatePixmapCursor,(Display* a,Pixmap b,Pixmap c,XColor* d,XColor* e,unsigned int f,unsigned int g),(a,b,c,d,e,f,g),return)
  15.401 +SDL_X11_SYM(GC,XCreateGC,(Display* a,Drawable b,unsigned long c,XGCValues* d),(a,b,c,d),return)
  15.402 +SDL_X11_SYM(XImage*,XCreateImage,(Display* a,Visual* b,unsigned int c,int d,int e,char* f,unsigned int g,unsigned int h,int i,int j),(a,b,c,d,e,f,g,h,i,j),return)
  15.403 +SDL_X11_SYM(Pixmap,XCreatePixmap,(Display* a,Drawable b,unsigned int c,unsigned int d,unsigned int e),(a,b,c,d,e),return)
  15.404 +SDL_X11_SYM(Pixmap,XCreatePixmapFromBitmapData,(Display* a,Drawable b,char* c,unsigned int d,unsigned int e,unsigned long f,unsigned long g,unsigned int h),(a,b,c,d,e,f,g,h),return)
  15.405 +SDL_X11_SYM(Window,XCreateSimpleWindow,(Display* a,Window b,int c,int d,unsigned int e,unsigned int f,unsigned int g,unsigned long h,unsigned long i),(a,b,c,d,e,f,g,h,i),return)
  15.406 +SDL_X11_SYM(Window,XCreateWindow,(Display* a,Window b,int c,int d,unsigned int e,unsigned int f,unsigned int g,int h,unsigned int i,Visual* j,unsigned long k,XSetWindowAttributes* l),(a,b,c,d,e,f,g,h,i,j,k,l),return)
  15.407 +SDL_X11_SYM(int,XDefineCursor,(Display* a,Window b,Cursor c),(a,b,c),return)
  15.408 +SDL_X11_SYM(int,XDeleteProperty,(Display* a,Window b,Atom c),(a,b,c),return)
  15.409 +SDL_X11_SYM(int,XDestroyWindow,(Display* a,Window b),(a,b),return)
  15.410 +SDL_X11_SYM(char*,XDisplayName,(_Xconst char* a),(a),return)
  15.411 +SDL_X11_SYM(int,XEventsQueued,(Display* a,int b),(a,b),return)
  15.412 +SDL_X11_SYM(Bool,XFilterEvent,(XEvent *event, Window w),(event,w),return)
  15.413 +SDL_X11_SYM(int,XFlush,(Display* a),(a),return)
  15.414 +SDL_X11_SYM(int,XFree,(void*a),(a),return)
  15.415 +SDL_X11_SYM(int,XFreeColormap,(Display* a,Colormap b),(a,b),return)
  15.416 +SDL_X11_SYM(int,XFreeColors,(Display* a,Colormap b,unsigned long* c,int d,unsigned long e),(a,b,c,d,e),return)
  15.417 +SDL_X11_SYM(int,XFreeCursor,(Display* a,Cursor b),(a,b),return)
  15.418 +SDL_X11_SYM(int,XFreeGC,(Display* a,GC b),(a,b),return)
  15.419 +SDL_X11_SYM(int,XFreeModifiermap,(XModifierKeymap* a),(a),return)
  15.420 +SDL_X11_SYM(int,XFreePixmap,(Display* a,Pixmap b),(a,b),return)
  15.421 +SDL_X11_SYM(int,XGetErrorDatabaseText,(Display* a,_Xconst char* b,_Xconst char* c,_Xconst char* d,char* e,int f),(a,b,c,d,e,f),return)
  15.422 +SDL_X11_SYM(XModifierKeymap*,XGetModifierMapping,(Display* a),(a),return)
  15.423 +SDL_X11_SYM(int,XGetPointerControl,(Display* a,int* b,int* c,int* d),(a,b,c,d),return)
  15.424 +SDL_X11_SYM(int,XGetScreenSaver,(Display* a,int* b,int* c,int* d, int* e),(a,b,c,d,e),return)
  15.425 +SDL_X11_SYM(XVisualInfo*,XGetVisualInfo,(Display* a,long b,XVisualInfo* c,int* d),(a,b,c,d),return)
  15.426 +SDL_X11_SYM(XWMHints*,XGetWMHints,(Display* a,Window b),(a,b),return)
  15.427 +SDL_X11_SYM(Status,XGetWindowAttributes,(Display* a,Window b,XWindowAttributes* c),(a,b,c),return)
  15.428 +SDL_X11_SYM(int,XGrabKeyboard,(Display* a,Window b,Bool c,int d,int e,Time f),(a,b,c,d,e,f),return)
  15.429 +SDL_X11_SYM(int,XGrabPointer,(Display* a,Window b,Bool c,unsigned int d,int e,int f,Window g,Cursor h,Time i),(a,b,c,d,e,f,g,h,i),return)
  15.430 +SDL_X11_SYM(Status,XIconifyWindow,(Display* a,Window b,int c),(a,b,c),return)
  15.431 +SDL_X11_SYM(int,XInstallColormap,(Display* a,Colormap b),(a,b),return)
  15.432 +SDL_X11_SYM(KeyCode,XKeysymToKeycode,(Display* a,KeySym b),(a,b),return)
  15.433 +SDL_X11_SYM(Atom,XInternAtom,(Display* a,_Xconst char* b,Bool c),(a,b,c),return)
  15.434 +SDL_X11_SYM(XPixmapFormatValues*,XListPixmapFormats,(Display* a,int* b),(a,b),return)
  15.435 +SDL_X11_SYM(int,XLookupString,(XKeyEvent* a,char* b,int c,KeySym* d,XComposeStatus* e),(a,b,c,d,e),return)
  15.436 +SDL_X11_SYM(int,XMapRaised,(Display* a,Window b),(a,b),return)
  15.437 +SDL_X11_SYM(int,XMapWindow,(Display* a,Window b),(a,b),return)
  15.438 +SDL_X11_SYM(int,XMaskEvent,(Display* a,long b,XEvent* c),(a,b,c),return)
  15.439 +SDL_X11_SYM(Status,XMatchVisualInfo,(Display* a,int b,int c,int d,XVisualInfo* e),(a,b,c,d,e),return)
  15.440 +SDL_X11_SYM(int,XMissingExtension,(Display* a,_Xconst char* b),(a,b),return)
  15.441 +SDL_X11_SYM(int,XMoveResizeWindow,(Display* a,Window b,int c,int d,unsigned int e,unsigned int f),(a,b,c,d,e,f),return)
  15.442 +SDL_X11_SYM(int,XMoveWindow,(Display* a,Window b,int c,int d),(a,b,c,d),return)
  15.443 +SDL_X11_SYM(int,XNextEvent,(Display* a,XEvent* b),(a,b),return)
  15.444 +SDL_X11_SYM(Display*,XOpenDisplay,(_Xconst char* a),(a),return)
  15.445 +SDL_X11_SYM(int,XPeekEvent,(Display* a,XEvent* b),(a,b),return)
  15.446 +SDL_X11_SYM(int,XPending,(Display* a),(a),return)
  15.447 +SDL_X11_SYM(int,XPutImage,(Display* a,Drawable b,GC c,XImage* d,int e,int f,int g,int h,unsigned int i,unsigned int j),(a,b,c,d,e,f,g,h,i,j),return)
  15.448 +SDL_X11_SYM(int,XQueryColors,(Display* a,Colormap b,XColor* c,int d),(a,b,c,d),return)
  15.449 +SDL_X11_SYM(int,XQueryKeymap,(Display* a,char *b),(a,b),return)
  15.450 +SDL_X11_SYM(Bool,XQueryPointer,(Display* a,Window b,Window* c,Window* d,int* e,int* f,int* g,int* h,unsigned int* i),(a,b,c,d,e,f,g,h,i),return)
  15.451 +SDL_X11_SYM(int,XRaiseWindow,(Display* a,Window b),(a,b),return)
  15.452 +SDL_X11_SYM(int,XReparentWindow,(Display* a,Window b,Window c,int d,int e),(a,b,c,d,e),return)
  15.453 +SDL_X11_SYM(int,XResizeWindow,(Display* a,Window b,unsigned int c,unsigned int d),(a,b,c,d),return)
  15.454 +SDL_X11_SYM(int,XSelectInput,(Display* a,Window b,long c),(a,b,c),return)
  15.455 +SDL_X11_SYM(Status,XSendEvent,(Display* a,Window b,Bool c,long d,XEvent* e),(a,b,c,d,e),return)
  15.456 +SDL_X11_SYM(int,XSetClassHint,(Display* a,Window b,XClassHint* c),(a,b,c),return)
  15.457 +SDL_X11_SYM(XErrorHandler,XSetErrorHandler,(XErrorHandler a),(a),return)
  15.458 +SDL_X11_SYM(XIOErrorHandler,XSetIOErrorHandler,(XIOErrorHandler a),(a),return)
  15.459 +SDL_X11_SYM(int,XSetScreenSaver,(Display* a,int b,int c,int d,int e),(a,b,c,d,e),return)
  15.460 +SDL_X11_SYM(int,XSetTransientForHint,(Display* a,Window b,Window c),(a,b,c),return)
  15.461 +SDL_X11_SYM(int,XSetWMHints,(Display* a,Window b,XWMHints* c),(a,b,c),return)
  15.462 +SDL_X11_SYM(void,XSetTextProperty,(Display* a,Window b,XTextProperty* c,Atom d),(a,b,c,d),)
  15.463 +SDL_X11_SYM(void,XSetWMNormalHints,(Display* a,Window b,XSizeHints* c),(a,b,c),)
  15.464 +SDL_X11_SYM(Status,XSetWMProtocols,(Display* a,Window b,Atom* c,int d),(a,b,c,d),return)
  15.465 +SDL_X11_SYM(int,XSetWindowBackground,(Display* a,Window b,unsigned long c),(a,b,c),return)
  15.466 +SDL_X11_SYM(int,XSetWindowBackgroundPixmap,(Display* a,Window b,Pixmap c),(a,b,c),return)
  15.467 +SDL_X11_SYM(int,XSetWindowColormap,(Display* a,Window b,Colormap c),(a,b,c),return)
  15.468 +SDL_X11_SYM(int,XStoreColors,(Display* a,Colormap b,XColor* c,int d),(a,b,c,d),return)
  15.469 +SDL_X11_SYM(Status,XStringListToTextProperty,(char** a,int b,XTextProperty* c),(a,b,c),return)
  15.470 +SDL_X11_SYM(int,XSync,(Display* a,Bool b),(a,b),return)
  15.471 +SDL_X11_SYM(int,XUngrabKeyboard,(Display* a,Time b),(a,b),return)
  15.472 +SDL_X11_SYM(int,XUngrabPointer,(Display* a,Time b),(a,b),return)
  15.473 +SDL_X11_SYM(int,XUnmapWindow,(Display* a,Window b),(a,b),return)
  15.474 +SDL_X11_SYM(int,XWarpPointer,(Display* a,Window b,Window c,int d,int e,unsigned int f,unsigned int g,int h, int i),(a,b,c,d,e,f,g,h,i),return)
  15.475 +SDL_X11_SYM(VisualID,XVisualIDFromVisual,(Visual* a),(a),return)
  15.476 +SDL_X11_SYM(XExtDisplayInfo*,XextAddDisplay,(XExtensionInfo* a,Display* b,char* c,XExtensionHooks* d,int e,XPointer f),(a,b,c,d,e,f),return)
  15.477 +SDL_X11_SYM(XExtensionInfo*,XextCreateExtension,(void),(),return)
  15.478 +SDL_X11_SYM(void,XextDestroyExtension,(XExtensionInfo* a),(a),)
  15.479 +SDL_X11_SYM(XExtDisplayInfo*,XextFindDisplay,(XExtensionInfo* a,Display* b),(a,b),return)
  15.480 +SDL_X11_SYM(int,XextRemoveDisplay,(XExtensionInfo* a,Display* b),(a,b),return)
  15.481 +SDL_X11_SYM(Bool,XQueryExtension,(Display* a,_Xconst char* b,int* c,int* d,int* e),(a,b,c,d,e),return)
  15.482 +SDL_X11_SYM(char *,XDisplayString,(Display* a),(a),return)
  15.483 +SDL_X11_SYM(int,XGetErrorText,(Display* a,int b,char* c,int d),(a,b,c,d),return)
  15.484 +SDL_X11_SYM(void,_XEatData,(Display* a,unsigned long b),(a,b),)
  15.485 +SDL_X11_SYM(void,_XFlush,(Display* a),(a),)
  15.486 +SDL_X11_SYM(void,_XFlushGCCache,(Display* a,GC b),(a,b),)
  15.487 +SDL_X11_SYM(int,_XRead,(Display* a,char* b,long c),(a,b,c),return)
  15.488 +SDL_X11_SYM(void,_XReadPad,(Display* a,char* b,long c),(a,b,c),)
  15.489 +SDL_X11_SYM(void,_XSend,(Display* a,_Xconst char* b,long c),(a,b,c),)
  15.490 +SDL_X11_SYM(Status,_XReply,(Display* a,xReply* b,int c,Bool d),(a,b,c,d),return)
  15.491 +SDL_X11_SYM(unsigned long,_XSetLastRequestRead,(Display* a,xGenericReply* b),(a,b),return)
  15.492 +SDL_X11_SYM(SDL_X11_XSynchronizeRetType,XSynchronize,(Display* a,Bool b),(a,b),return)
  15.493 +SDL_X11_SYM(SDL_X11_XESetWireToEventRetType,XESetWireToEvent,(Display* a,int b,SDL_X11_XESetWireToEventRetType c),(a,b,c),return)
  15.494 +SDL_X11_SYM(SDL_X11_XESetEventToWireRetType,XESetEventToWire,(Display* a,int b,SDL_X11_XESetEventToWireRetType c),(a,b,c),return)
  15.495 +SDL_X11_SYM(XExtensionErrorHandler,XSetExtensionErrorHandler,(XExtensionErrorHandler a),(a),return)
  15.496 +
  15.497  #if NeedWidePrototypes
  15.498 -SDL_X11_SYM(KeySym, XKeycodeToKeysym, (Display * a, unsigned int b, int c),
  15.499 -            (a, b, c), return)
  15.500 +SDL_X11_SYM(KeySym,XKeycodeToKeysym,(Display* a,unsigned int b,int c),(a,b,c),return)
  15.501  #else
  15.502 -SDL_X11_SYM(KeySym, XKeycodeToKeysym, (Display * a, KeyCode b, int c),
  15.503 -            (a, b, c), return)
  15.504 +SDL_X11_SYM(KeySym,XKeycodeToKeysym,(Display* a,KeyCode b,int c),(a,b,c),return)
  15.505  #endif
  15.506 +
  15.507  #ifdef X_HAVE_UTF8_STRING
  15.508  SDL_X11_MODULE(UTF8)
  15.509 -SDL_X11_SYM(int, Xutf8TextListToTextProperty,
  15.510 -            (Display * a, char **b, int c, XICCEncodingStyle d,
  15.511 -             XTextProperty * e), (a, b, c, d, e), return)
  15.512 -SDL_X11_SYM(int, Xutf8LookupString,
  15.513 -            (XIC a, XKeyPressedEvent * b, char *c, int d, KeySym * e,
  15.514 -             Status * f), (a, b, c, d, e, f), return)
  15.515 +SDL_X11_SYM(int,Xutf8TextListToTextProperty,(Display* a,char** b,int c,XICCEncodingStyle d,XTextProperty* e),(a,b,c,d,e),return)
  15.516 +SDL_X11_SYM(int,Xutf8LookupString,(XIC a,XKeyPressedEvent* b,char* c,int d,KeySym* e,Status* f),(a,b,c,d,e,f),return)
  15.517  /*SDL_X11_SYM(XIC,XCreateIC,(XIM, ...),return)  !!! ARGH! */
  15.518 -SDL_X11_SYM(void, XDestroyIC, (XIC a), (a),)
  15.519 -SDL_X11_SYM(void, XSetICFocus, (XIC a), (a),)
  15.520 -SDL_X11_SYM(void, XUnsetICFocus, (XIC a), (a),)
  15.521 -SDL_X11_SYM(XIM, XOpenIM,
  15.522 -            (Display * a, struct _XrmHashBucketRec * b, char *c, char *d),
  15.523 -            (a, b, c, d), return)
  15.524 -SDL_X11_SYM(Status, XCloseIM, (XIM a), (a), return)
  15.525 +SDL_X11_SYM(void,XDestroyIC,(XIC a),(a),)
  15.526 +SDL_X11_SYM(void,XSetICFocus,(XIC a),(a),)
  15.527 +SDL_X11_SYM(void,XUnsetICFocus,(XIC a),(a),)
  15.528 +SDL_X11_SYM(XIM,XOpenIM,(Display* a,struct _XrmHashBucketRec* b,char* c,char* d),(a,b,c,d),return)
  15.529 +SDL_X11_SYM(Status,XCloseIM,(XIM a),(a),return)
  15.530  #endif
  15.531 +
  15.532  #ifndef NO_SHARED_MEMORY
  15.533  SDL_X11_MODULE(SHM)
  15.534 -SDL_X11_SYM(Status, XShmAttach, (Display * a, XShmSegmentInfo * b), (a, b),
  15.535 -            return)
  15.536 -SDL_X11_SYM(Status, XShmDetach, (Display * a, XShmSegmentInfo * b), (a, b),
  15.537 -            return)
  15.538 -SDL_X11_SYM(Status, XShmPutImage,
  15.539 -            (Display * a, Drawable b, GC c, XImage * d, int e, int f, int g,
  15.540 -             int h, unsigned int i, unsigned int j, Bool k), (a, b, c, d, e,
  15.541 -                                                              f, g, h, i, j,
  15.542 -                                                              k), return)
  15.543 -SDL_X11_SYM(XImage *, XShmCreateImage,
  15.544 -            (Display * a, Visual * b, unsigned int c, int d, char *e,
  15.545 -             XShmSegmentInfo * f, unsigned int g, unsigned int h), (a, b, c,
  15.546 -                                                                    d, e, f,
  15.547 -                                                                    g, h),
  15.548 -            return)
  15.549 -SDL_X11_SYM(Bool, XShmQueryExtension, (Display * a), (a), return)
  15.550 +SDL_X11_SYM(Status,XShmAttach,(Display* a,XShmSegmentInfo* b),(a,b),return)
  15.551 +SDL_X11_SYM(Status,XShmDetach,(Display* a,XShmSegmentInfo* b),(a,b),return)
  15.552 +SDL_X11_SYM(Status,XShmPutImage,(Display* a,Drawable b,GC c,XImage* d,int e,int f,int g,int h,unsigned int i,unsigned int j,Bool k),(a,b,c,d,e,f,g,h,i,j,k),return)
  15.553 +SDL_X11_SYM(XImage*,XShmCreateImage,(Display* a,Visual* b,unsigned int c,int d,char* e,XShmSegmentInfo* f,unsigned int g,unsigned int h),(a,b,c,d,e,f,g,h),return)
  15.554 +SDL_X11_SYM(Bool,XShmQueryExtension,(Display* a),(a),return)
  15.555  #endif
  15.556 +
  15.557  /*
  15.558   * Not required...these only exist in code in headers on some 64-bit platforms,
  15.559   *  and are removed via macros elsewhere, so it's safe for them to be missing.
  15.560   */
  15.561  #ifdef LONG64
  15.562  SDL_X11_MODULE(IO_32BIT)
  15.563 -SDL_X11_SYM(int, _XData32,
  15.564 -            (Display * dpy, register long *data, unsigned len), (dpy, data,
  15.565 -                                                                 len), return)
  15.566 -SDL_X11_SYM(void, _XRead32, (Display * dpy, register long *data, long len),
  15.567 -            (dpy, data, len),)
  15.568 +SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
  15.569 +SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,len),)
  15.570  #endif
  15.571 +
  15.572  /*
  15.573   * These only show up on some variants of Unix.
  15.574   */
  15.575  #if defined(__osf__)
  15.576  SDL_X11_MODULE(OSF_ENTRY_POINTS)
  15.577 -SDL_X11_SYM(void, _SmtBufferOverflow,
  15.578 -            (Display * dpy, register smtDisplayPtr p), (dpy, p),)
  15.579 -SDL_X11_SYM(void, _SmtIpError,
  15.580 -            (Display * dpy, register smtDisplayPtr p, int i), (dpy, p, i),)
  15.581 -SDL_X11_SYM(int, ipAllocateData, (ChannelPtr a, IPCard b, IPDataPtr * c),
  15.582 -            (a, b, c), return)
  15.583 -SDL_X11_SYM(int, ipUnallocateAndSendData, (ChannelPtr a, IPCard b), (a, b),
  15.584 -            return)
  15.585 +SDL_X11_SYM(void,_SmtBufferOverflow,(Display *dpy,register smtDisplayPtr p),(dpy,p),)
  15.586 +SDL_X11_SYM(void,_SmtIpError,(Display *dpy,register smtDisplayPtr p, int i),(dpy,p,i),)
  15.587 +SDL_X11_SYM(int,ipAllocateData,(ChannelPtr a, IPCard b, IPDataPtr * c),(a,b,c),return)
  15.588 +SDL_X11_SYM(int,ipUnallocateAndSendData,(ChannelPtr a, IPCard b),(a,b),return)
  15.589  #endif
  15.590 +
  15.591  /* Xrandr support. */
  15.592  #if SDL_VIDEO_DRIVER_X11_XRANDR
  15.593  SDL_X11_MODULE(XRANDR)
  15.594 -SDL_X11_SYM(Status, XRRQueryVersion,
  15.595 -            (Display * dpy, int *major_versionp, int *minor_versionp), (dpy,
  15.596 -                                                                        major_versionp,
  15.597 -                                                                        minor_versionp),
  15.598 -            return)
  15.599 -SDL_X11_SYM(XRRScreenConfiguration *, XRRGetScreenInfo,
  15.600 -            (Display * dpy, Drawable draw), (dpy, draw), return)
  15.601 -SDL_X11_SYM(SizeID, XRRConfigCurrentConfiguration,
  15.602 -            (XRRScreenConfiguration * config, Rotation * rotation), (config,
  15.603 -                                                                     rotation),
  15.604 -            return)
  15.605 -SDL_X11_SYM(XRRScreenSize *, XRRConfigSizes,
  15.606 -            (XRRScreenConfiguration * config, int *nsizes), (config, nsizes),
  15.607 -            return)
  15.608 -SDL_X11_SYM(short *, XRRConfigRates,
  15.609 -            (XRRScreenConfiguration * config, int sizeID, int *nrates),
  15.610 -            (config, sizeID, nrates), return)
  15.611 -SDL_X11_SYM(Status, XRRSetScreenConfig,
  15.612 -            (Display * dpy, XRRScreenConfiguration * config, Drawable draw,
  15.613 -             int size_index, Rotation rotation, Time timestamp), (dpy,
  15.614 -                                                                  config,
  15.615 -                                                                  draw,
  15.616 -                                                                  size_index,
  15.617 -                                                                  rotation,
  15.618 -                                                                  timestamp),
  15.619 -            return)
  15.620 -SDL_X11_SYM(void, XRRFreeScreenConfigInfo, (XRRScreenConfiguration * config),
  15.621 -            (config),)
  15.622 +SDL_X11_SYM(Status,XRRQueryVersion,(Display *dpy,int *major_versionp,int *minor_versionp),(dpy,major_versionp,minor_versionp),return)
  15.623 +SDL_X11_SYM(XRRScreenConfiguration *,XRRGetScreenInfo,(Display *dpy,Drawable draw),(dpy,draw),return)
  15.624 +SDL_X11_SYM(SizeID,XRRConfigCurrentConfiguration,(XRRScreenConfiguration *config,Rotation *rotation),(config,rotation),return)
  15.625 +SDL_X11_SYM(XRRScreenSize *,XRRConfigSizes,(XRRScreenConfiguration *config, int *nsizes),(config,nsizes),return)
  15.626 +SDL_X11_SYM(Status,XRRSetScreenConfig,(Display *dpy, XRRScreenConfiguration *config, Drawable draw, int size_index, Rotation rotation, Time timestamp),(dpy,config,draw,size_index,rotation,timestamp),return)
  15.627 +SDL_X11_SYM(void,XRRFreeScreenConfigInfo,(XRRScreenConfiguration *config),(config),)
  15.628  #endif
  15.629 +
  15.630  /* DPMS support */
  15.631  #if SDL_VIDEO_DRIVER_X11_DPMS
  15.632  SDL_X11_MODULE(DPMS)
  15.633 -SDL_X11_SYM(Status, DPMSQueryExtension,
  15.634 -            (Display * dpy, int *major_versionp, int *minor_versionp), (dpy,
  15.635 -                                                                        major_versionp,
  15.636 -                                                                        minor_versionp),
  15.637 -            return)
  15.638 -SDL_X11_SYM(Status, DPMSInfo, (Display * dpy, CARD16 * state, BOOL * onoff),
  15.639 -            (dpy, state, onoff), return)
  15.640 -SDL_X11_SYM(Status, DPMSEnable, (Display * dpy), (dpy), return)
  15.641 -SDL_X11_SYM(Status, DPMSDisable, (Display * dpy), (dpy), return)
  15.642 +SDL_X11_SYM(Status,DPMSQueryExtension,(Display *dpy,int *major_versionp,int *minor_versionp),(dpy,major_versionp,minor_versionp),return)
  15.643 +SDL_X11_SYM(Status,DPMSInfo,(Display *dpy,CARD16 *state,BOOL *onoff),(dpy,state,onoff),return)
  15.644 +SDL_X11_SYM(Status,DPMSEnable,(Display *dpy),(dpy),return)
  15.645 +SDL_X11_SYM(Status,DPMSDisable,(Display *dpy),(dpy),return)
  15.646  #endif
  15.647 -/* end of SDL_x11sym.h ... */
  15.648 +
  15.649 +/* *INDENT-ON* */
  15.650 +
  15.651  /* vi: set ts=4 sw=4 expandtab: */
    16.1 --- a/src/video/x11/SDL_x11video.c	Thu Jul 27 06:53:23 2006 +0000
    16.2 +++ b/src/video/x11/SDL_x11video.c	Fri Jul 28 08:43:17 2006 +0000
    16.3 @@ -186,8 +186,7 @@
    16.4      device->SetWindowGrab = X11_SetWindowGrab;
    16.5      device->DestroyWindow = X11_DestroyWindow;
    16.6      device->GetWindowWMInfo = X11_GetWindowWMInfo;
    16.7 -/*
    16.8 -#ifdef SDL_VIDEO_OPENGL
    16.9 +#ifdef SDL_VIDEO_OPENGL_GLX
   16.10      device->GL_LoadLibrary = X11_GL_LoadLibrary;
   16.11      device->GL_GetProcAddress = X11_GL_GetProcAddress;
   16.12      device->GL_CreateContext = X11_GL_CreateContext;
   16.13 @@ -197,7 +196,6 @@
   16.14      device->GL_SwapWindow = X11_GL_SwapWindow;
   16.15      device->GL_DeleteContext = X11_GL_DeleteContext;
   16.16  #endif
   16.17 -*/
   16.18  
   16.19      device->free = X11_DeleteDevice;
   16.20  
    17.1 --- a/src/video/x11/SDL_x11video.h	Thu Jul 27 06:53:23 2006 +0000
    17.2 +++ b/src/video/x11/SDL_x11video.h	Fri Jul 28 08:43:17 2006 +0000
    17.3 @@ -53,7 +53,7 @@
    17.4  #include "SDL_x11keyboard.h"
    17.5  #include "SDL_x11modes.h"
    17.6  #include "SDL_x11mouse.h"
    17.7 -//#include "SDL_x11opengl.h"
    17.8 +#include "SDL_x11opengl.h"
    17.9  #include "SDL_x11window.h"
   17.10  
   17.11  /* Private display data */
    18.1 --- a/src/video/x11/SDL_x11window.c	Thu Jul 27 06:53:23 2006 +0000
    18.2 +++ b/src/video/x11/SDL_x11window.c	Fri Jul 28 08:43:17 2006 +0000
    18.3 @@ -135,7 +135,7 @@
    18.4  {
    18.5      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    18.6      SDL_DisplayData *displaydata =
    18.7 -        (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
    18.8 +        (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
    18.9      Visual *visual;
   18.10      int depth;
   18.11      XSetWindowAttributes xattr;
   18.12 @@ -153,9 +153,23 @@
   18.13      }
   18.14  */
   18.15  #endif
   18.16 +#ifdef SDL_VIDEO_OPENGL_GLX
   18.17      if (window->flags & SDL_WINDOW_OPENGL) {
   18.18 -        /* FIXME: get the glx visual */
   18.19 -    } else {
   18.20 +        XVisualInfo *vinfo;
   18.21 +
   18.22 +        if (X11_GL_Initialize(_this) < 0) {
   18.23 +            return -1;
   18.24 +        }
   18.25 +        vinfo = X11_GL_GetVisual(_this, data->display, displaydata->screen);
   18.26 +        if (!vinfo) {
   18.27 +            return -1;
   18.28 +        }
   18.29 +        visual = vinfo->visual;
   18.30 +        depth = vinfo->depth;
   18.31 +        XFree(vinfo);
   18.32 +    } else
   18.33 +#endif
   18.34 +    {
   18.35          visual = displaydata->visual;
   18.36          depth = displaydata->depth;
   18.37      }
   18.38 @@ -203,6 +217,15 @@
   18.39                        window->w, window->h, 0, depth, InputOutput, visual,
   18.40                        (CWOverrideRedirect | CWBackPixel | CWBorderPixel |
   18.41                         CWColormap), &xattr);
   18.42 +    if (!w) {
   18.43 +#ifdef SDL_VIDEO_OPENGL_GLX
   18.44 +        if (window->flags & SDL_WINDOW_OPENGL) {
   18.45 +            X11_GL_Shutdown(_this);
   18.46 +        }
   18.47 +#endif
   18.48 +        SDL_SetError("Couldn't create window");
   18.49 +        return -1;
   18.50 +    }
   18.51  
   18.52      sizehints = XAllocSizeHints();
   18.53      if (sizehints) {
   18.54 @@ -370,27 +393,26 @@
   18.55  
   18.56      /* Finally, show the window */
   18.57      if (window->flags & SDL_WINDOW_SHOWN) {
   18.58 +        XEvent event;
   18.59 +
   18.60          XMapRaised(data->display, w);
   18.61 +        do {
   18.62 +            XCheckWindowEvent(data->display, w, StructureNotifyMask, &event);
   18.63 +        } while (event.type != MapNotify);
   18.64      }
   18.65 -    XSync(data->display, False);
   18.66  
   18.67      if (SetupWindowData(_this, window, w, SDL_TRUE) < 0) {
   18.68 +#ifdef SDL_VIDEO_OPENGL_GLX
   18.69 +        if (window->flags & SDL_WINDOW_OPENGL) {
   18.70 +            X11_GL_Shutdown(_this);
   18.71 +        }
   18.72 +#endif
   18.73          XDestroyWindow(data->display, w);
   18.74          return -1;
   18.75      }
   18.76  
   18.77      X11_SetWindowTitle(_this, window);
   18.78  
   18.79 -#ifdef SDL_VIDEO_OPENGL
   18.80 -    /*
   18.81 -       if (window->flags & SDL_WINDOW_OPENGL) {
   18.82 -       if (X11_GL_SetupWindow(_this, window) < 0) {
   18.83 -       X11_DestroyWindow(_this, window);
   18.84 -       return -1;
   18.85 -       }
   18.86 -       }
   18.87 -     */
   18.88 -#endif
   18.89      return 0;
   18.90  }
   18.91  
   18.92 @@ -486,7 +508,7 @@
   18.93  {
   18.94      SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
   18.95      SDL_DisplayData *displaydata =
   18.96 -        (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
   18.97 +        (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
   18.98      Display *display = data->videodata->display;
   18.99      int x, y;
  18.100  
  18.101 @@ -576,12 +598,10 @@
  18.102  
  18.103      if (data) {
  18.104          Display *display = data->videodata->display;
  18.105 -#ifdef SDL_VIDEO_OPENGL
  18.106 -        /*
  18.107 -           if (window->flags & SDL_WINDOW_OPENGL) {
  18.108 -           X11_GL_CleanupWindow(_this, window);
  18.109 -           }
  18.110 -         */
  18.111 +#ifdef SDL_VIDEO_OPENGL_GLX
  18.112 +        if (window->flags & SDL_WINDOW_OPENGL) {
  18.113 +            X11_GL_Shutdown(_this);
  18.114 +        }
  18.115  #endif
  18.116  #ifdef X_HAVE_UTF8_STRING
  18.117          if (data->ic) {