Commit 931e1c10 authored by Sam Lantinga's avatar Sam Lantinga

Implemented X11 OpenGL support.

Added support for the SDL_VIDEO_OPENGL environment variable.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401998
parent cc0b6550
...@@ -1359,7 +1359,7 @@ AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]) ...@@ -1359,7 +1359,7 @@ AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]])
dnl Check to see if OpenGL support is desired dnl Check to see if OpenGL support is desired
AC_ARG_ENABLE(video-opengl, AC_ARG_ENABLE(video-opengl,
AC_HELP_STRING([--enable-video-opengl], [include OpenGL context creation [[default=yes]]]), AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
, enable_video_opengl=yes) , enable_video_opengl=yes)
dnl Find OpenGL dnl Find OpenGL
...@@ -1379,6 +1379,7 @@ CheckOpenGLX11() ...@@ -1379,6 +1379,7 @@ CheckOpenGLX11()
if test x$video_opengl = xyes; then if test x$video_opengl = xyes; then
AC_DEFINE(SDL_VIDEO_OPENGL) AC_DEFINE(SDL_VIDEO_OPENGL)
AC_DEFINE(SDL_VIDEO_OPENGL_GLX) AC_DEFINE(SDL_VIDEO_OPENGL_GLX)
AC_DEFINE(SDL_VIDEO_RENDER_OGL)
fi fi
fi fi
} }
...@@ -1398,6 +1399,7 @@ CheckOpenGLQNX() ...@@ -1398,6 +1399,7 @@ CheckOpenGLQNX()
AC_MSG_RESULT($video_opengl) AC_MSG_RESULT($video_opengl)
if test x$video_opengl = xyes; then if test x$video_opengl = xyes; then
AC_DEFINE(SDL_VIDEO_OPENGL) AC_DEFINE(SDL_VIDEO_OPENGL)
AC_DEFINE(SDL_VIDEO_RENDER_OGL)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
fi fi
fi fi
...@@ -1409,6 +1411,7 @@ CheckWIN32GL() ...@@ -1409,6 +1411,7 @@ CheckWIN32GL()
if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
AC_DEFINE(SDL_VIDEO_OPENGL) AC_DEFINE(SDL_VIDEO_OPENGL)
AC_DEFINE(SDL_VIDEO_OPENGL_WGL) AC_DEFINE(SDL_VIDEO_OPENGL_WGL)
AC_DEFINE(SDL_VIDEO_RENDER_OGL)
fi fi
} }
...@@ -1417,6 +1420,8 @@ CheckBeGL() ...@@ -1417,6 +1420,8 @@ CheckBeGL()
{ {
if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
AC_DEFINE(SDL_VIDEO_OPENGL) AC_DEFINE(SDL_VIDEO_OPENGL)
AC_DEFINE(SDL_VIDEO_OPENGL_BGL)
AC_DEFINE(SDL_VIDEO_RENDER_OGL)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
fi fi
} }
...@@ -1426,6 +1431,8 @@ CheckMacGL() ...@@ -1426,6 +1431,8 @@ CheckMacGL()
{ {
if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
AC_DEFINE(SDL_VIDEO_OPENGL) AC_DEFINE(SDL_VIDEO_OPENGL)
AC_DEFINE(SDL_VIDEO_OPENGL_CGL)
AC_DEFINE(SDL_VIDEO_RENDER_OGL)
case "$host" in case "$host" in
*-*-darwin*) *-*-darwin*)
if test x$enable_video_cocoa = xyes; then if test x$enable_video_cocoa = xyes; then
...@@ -1456,6 +1463,7 @@ CheckAtariOSMesa() ...@@ -1456,6 +1463,7 @@ CheckAtariOSMesa()
fi fi
AC_DEFINE(SDL_VIDEO_OPENGL) AC_DEFINE(SDL_VIDEO_OPENGL)
AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA) AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
AC_DEFINE(SDL_VIDEO_RENDER_OGL)
SDL_CFLAGS="$SDL_CFLAGS $OSMESA_CFLAGS" SDL_CFLAGS="$SDL_CFLAGS $OSMESA_CFLAGS"
SDL_LIBS="$SDL_LIBS $OSMESA_LIBS" SDL_LIBS="$SDL_LIBS $OSMESA_LIBS"
......
...@@ -292,6 +292,8 @@ ...@@ -292,6 +292,8 @@
/* Enable OpenGL support */ /* Enable OpenGL support */
#undef SDL_VIDEO_OPENGL #undef SDL_VIDEO_OPENGL
#undef SDL_VIDEO_OPENGL_BGL
#undef SDL_VIDEO_OPENGL_CGL
#undef SDL_VIDEO_OPENGL_GLX #undef SDL_VIDEO_OPENGL_GLX
#undef SDL_VIDEO_OPENGL_WGL #undef SDL_VIDEO_OPENGL_WGL
#undef SDL_VIDEO_OPENGL_OSMESA #undef SDL_VIDEO_OPENGL_OSMESA
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#if SDL_VIDEO_OPENGL #if SDL_VIDEO_RENDER_OGL
#include "SDL_video.h" #include "SDL_video.h"
#include "SDL_opengl.h" #include "SDL_opengl.h"
...@@ -197,6 +197,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -197,6 +197,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
{ {
SDL_Renderer *renderer; SDL_Renderer *renderer;
GL_RenderData *data; GL_RenderData *data;
GLint value;
if (!(window->flags & SDL_WINDOW_OPENGL)) { if (!(window->flags & SDL_WINDOW_OPENGL)) {
if (SDL_RecreateWindow(window, window->flags | SDL_WINDOW_OPENGL) < 0) { if (SDL_RecreateWindow(window, window->flags | SDL_WINDOW_OPENGL) < 0) {
...@@ -261,10 +262,10 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -261,10 +262,10 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->info.flags |= SDL_Renderer_PresentVSync; renderer->info.flags |= SDL_Renderer_PresentVSync;
} }
data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
&renderer->info.max_texture_width); renderer->info.max_texture_width = value;
data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
&renderer->info.max_texture_height); renderer->info.max_texture_height = value;
if (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle") if (SDL_GL_ExtensionSupported("GL_ARB_texture_rectangle")
|| SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) { || SDL_GL_ExtensionSupported("GL_EXT_texture_rectangle")) {
...@@ -706,6 +707,6 @@ GL_DestroyRenderer(SDL_Renderer * renderer) ...@@ -706,6 +707,6 @@ GL_DestroyRenderer(SDL_Renderer * renderer)
SDL_free(renderer); SDL_free(renderer);
} }
#endif /* SDL_VIDEO_OPENGL */ #endif /* SDL_VIDEO_RENDER_OGL */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -276,7 +276,7 @@ SDL_VideoInit(const char *driver_name, Uint32 flags) ...@@ -276,7 +276,7 @@ SDL_VideoInit(const char *driver_name, Uint32 flags)
/* The software renderer is always available */ /* The software renderer is always available */
for (i = 0; i < _this->num_displays; ++i) { for (i = 0; i < _this->num_displays; ++i) {
#if SDL_VIDEO_OPENGL #if SDL_VIDEO_RENDER_OGL
SDL_AddRenderDriver(i, &GL_RenderDriver); SDL_AddRenderDriver(i, &GL_RenderDriver);
#endif #endif
if (_this->displays[i].num_render_drivers > 0) { if (_this->displays[i].num_render_drivers > 0) {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#ifndef _SDL_cocoaopengl_h #ifndef _SDL_cocoaopengl_h
#define _SDL_cocoaopengl_h #define _SDL_cocoaopengl_h
#if SDL_VIDEO_OPENGL #if SDL_VIDEO_OPENGL_CGL
struct SDL_GLDriverData struct SDL_GLDriverData
{ {
...@@ -44,7 +44,7 @@ extern int Cocoa_GL_GetSwapInterval(_THIS); ...@@ -44,7 +44,7 @@ extern int Cocoa_GL_GetSwapInterval(_THIS);
extern void Cocoa_GL_SwapWindow(_THIS, SDL_Window * window); extern void Cocoa_GL_SwapWindow(_THIS, SDL_Window * window);
extern void Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context); extern void Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context);
#endif /* SDL_VIDEO_OPENGL */ #endif /* SDL_VIDEO_OPENGL_CGL */
#endif /* _SDL_cocoaopengl_h */ #endif /* _SDL_cocoaopengl_h */
......
...@@ -25,14 +25,14 @@ ...@@ -25,14 +25,14 @@
/* NSOpenGL implementation of SDL OpenGL support */ /* NSOpenGL implementation of SDL OpenGL support */
#if SDL_VIDEO_OPENGL #if SDL_VIDEO_OPENGL_CGL
#include <OpenGL/CGLTypes.h> #include <OpenGL/CGLTypes.h>
#include "SDL_loadso.h" #include "SDL_loadso.h"
#include "SDL_opengl.h" #include "SDL_opengl.h"
#define DEFAULT_OPENGL_PATH "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib" #define DEFAULT_OPENGL "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
/* This is implemented in Mac OS X 10.3 and above */ /* This is implemented in Mac OS X 10.3 and above */
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3 #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3
...@@ -57,7 +57,10 @@ Cocoa_GL_LoadLibrary(_THIS, const char *path) ...@@ -57,7 +57,10 @@ Cocoa_GL_LoadLibrary(_THIS, const char *path)
} }
} }
if (path == NULL) { if (path == NULL) {
path = DEFAULT_OPENGL_PATH; path = SDL_getenv("SDL_OPENGL_LIBRARY");
}
if (path == NULL) {
path = DEFAULT_OPENGL;
} }
_this->gl_config.dll_handle = SDL_LoadObject(path); _this->gl_config.dll_handle = SDL_LoadObject(path);
if (!_this->gl_config.dll_handle) { if (!_this->gl_config.dll_handle) {
...@@ -87,19 +90,6 @@ Cocoa_GL_UnloadLibrary(_THIS) ...@@ -87,19 +90,6 @@ Cocoa_GL_UnloadLibrary(_THIS)
} }
} }
static void
Cocoa_GL_Shutdown(_THIS)
{
if (!_this->gl_data || (--_this->gl_data->initialized > 0)) {
return;
}
Cocoa_GL_UnloadLibrary(_this);
SDL_free(_this->gl_data);
_this->gl_data = NULL;
}
static int static int
Cocoa_GL_Initialize(_THIS) Cocoa_GL_Initialize(_THIS)
{ {
...@@ -124,6 +114,19 @@ Cocoa_GL_Initialize(_THIS) ...@@ -124,6 +114,19 @@ Cocoa_GL_Initialize(_THIS)
return 0; return 0;
} }
static void
Cocoa_GL_Shutdown(_THIS)
{
if (!_this->gl_data || (--_this->gl_data->initialized > 0)) {
return;
}
Cocoa_GL_UnloadLibrary(_this);
SDL_free(_this->gl_data);
_this->gl_data = NULL;
}
int int
Cocoa_GL_SetupWindow(_THIS, SDL_Window * window) Cocoa_GL_SetupWindow(_THIS, SDL_Window * window)
{ {
...@@ -352,6 +355,6 @@ Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context) ...@@ -352,6 +355,6 @@ Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context)
[pool release]; [pool release];
} }
#endif /* SDL_VIDEO_OPENGL */ #endif /* SDL_VIDEO_OPENGL_CGL */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -87,7 +87,7 @@ Cocoa_CreateDevice(int devindex) ...@@ -87,7 +87,7 @@ Cocoa_CreateDevice(int devindex)
device->SetWindowGrab = Cocoa_SetWindowGrab; device->SetWindowGrab = Cocoa_SetWindowGrab;
device->DestroyWindow = Cocoa_DestroyWindow; device->DestroyWindow = Cocoa_DestroyWindow;
device->GetWindowWMInfo = Cocoa_GetWindowWMInfo; device->GetWindowWMInfo = Cocoa_GetWindowWMInfo;
#ifdef SDL_VIDEO_OPENGL #ifdef SDL_VIDEO_OPENGL_CGL
device->GL_LoadLibrary = Cocoa_GL_LoadLibrary; device->GL_LoadLibrary = Cocoa_GL_LoadLibrary;
device->GL_GetProcAddress = Cocoa_GL_GetProcAddress; device->GL_GetProcAddress = Cocoa_GL_GetProcAddress;
device->GL_CreateContext = Cocoa_GL_CreateContext; device->GL_CreateContext = Cocoa_GL_CreateContext;
......
...@@ -385,7 +385,7 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) ...@@ -385,7 +385,7 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window)
[nswindow release]; [nswindow release];
return -1; return -1;
} }
#ifdef SDL_VIDEO_OPENGL #ifdef SDL_VIDEO_OPENGL_CGL
if (window->flags & SDL_WINDOW_OPENGL) { if (window->flags & SDL_WINDOW_OPENGL) {
if (Cocoa_GL_SetupWindow(_this, window) < 0) { if (Cocoa_GL_SetupWindow(_this, window) < 0) {
Cocoa_DestroyWindow(_this, window); Cocoa_DestroyWindow(_this, window);
...@@ -535,7 +535,7 @@ Cocoa_DestroyWindow(_THIS, SDL_Window * window) ...@@ -535,7 +535,7 @@ Cocoa_DestroyWindow(_THIS, SDL_Window * window)
SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
if (data) { if (data) {
#ifdef SDL_VIDEO_OPENGL #ifdef SDL_VIDEO_OPENGL_CGL
if (window->flags & SDL_WINDOW_OPENGL) { if (window->flags & SDL_WINDOW_OPENGL) {
Cocoa_GL_CleanupWindow(_this, window); Cocoa_GL_CleanupWindow(_this, window);
} }
......
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
/* WGL implementation of SDL OpenGL support */ /* WGL implementation of SDL OpenGL support */
#if SDL_VIDEO_OPENGL #if SDL_VIDEO_OPENGL_WGL
#include "SDL_opengl.h" #include "SDL_opengl.h"
#define DEFAULT_OPENGL_PATH "OPENGL32.DLL" #define DEFAULT_OPENGL "OPENGL32.DLL"
int int
...@@ -47,7 +47,10 @@ WIN_GL_LoadLibrary(_THIS, const char *path) ...@@ -47,7 +47,10 @@ WIN_GL_LoadLibrary(_THIS, const char *path)
} }
} }
if (path == NULL) { if (path == NULL) {
path = DEFAULT_OPENGL_PATH; path = SDL_getenv("SDL_OPENGL_LIBRARY");
}
if (path == NULL) {
path = DEFAULT_OPENGL;
} }
wpath = WIN_UTF8ToString(path); wpath = WIN_UTF8ToString(path);
handle = LoadLibrary(wpath); handle = LoadLibrary(wpath);
...@@ -257,19 +260,6 @@ WIN_GL_InitExtensions(_THIS) ...@@ -257,19 +260,6 @@ WIN_GL_InitExtensions(_THIS)
WIN_PumpEvents(_this); WIN_PumpEvents(_this);
} }
static void
WIN_GL_Shutdown(_THIS)
{
if (!_this->gl_data || (--_this->gl_data->initialized > 0)) {
return;
}
WIN_GL_UnloadLibrary(_this);
SDL_free(_this->gl_data);
_this->gl_data = NULL;
}
static int static int
WIN_GL_Initialize(_THIS) WIN_GL_Initialize(_THIS)
{ {
...@@ -298,6 +288,19 @@ WIN_GL_Initialize(_THIS) ...@@ -298,6 +288,19 @@ WIN_GL_Initialize(_THIS)
return 0; return 0;
} }
static void
WIN_GL_Shutdown(_THIS)
{
if (!_this->gl_data || (--_this->gl_data->initialized > 0)) {
return;
}
WIN_GL_UnloadLibrary(_this);
SDL_free(_this->gl_data);
_this->gl_data = NULL;
}
int int
WIN_GL_SetupWindow(_THIS, SDL_Window * window) WIN_GL_SetupWindow(_THIS, SDL_Window * window)
{ {
...@@ -479,7 +482,6 @@ WIN_GL_DeleteContext(_THIS, SDL_GLContext context) ...@@ -479,7 +482,6 @@ WIN_GL_DeleteContext(_THIS, SDL_GLContext context)
_this->gl_data->wglDeleteContext((HGLRC) context); _this->gl_data->wglDeleteContext((HGLRC) context);
} }
#endif /* SDL_VIDEO_OPENGL */ #endif /* SDL_VIDEO_OPENGL_WGL */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#ifndef _SDL_win32opengl_h #ifndef _SDL_win32opengl_h
#define _SDL_win32opengl_h #define _SDL_win32opengl_h
#if SDL_VIDEO_OPENGL #if SDL_VIDEO_OPENGL_WGL
struct SDL_GLDriverData struct SDL_GLDriverData
{ {
...@@ -120,7 +120,7 @@ extern void WIN_GL_DeleteContext(_THIS, SDL_GLContext context); ...@@ -120,7 +120,7 @@ extern void WIN_GL_DeleteContext(_THIS, SDL_GLContext context);
#define WGL_SAMPLES_ARB 0x2042 #define WGL_SAMPLES_ARB 0x2042
#endif #endif
#endif /* SDL_VIDEO_OPENGL */ #endif /* SDL_VIDEO_OPENGL_WGL */
#endif /* _SDL_win32opengl_h */ #endif /* _SDL_win32opengl_h */
......
...@@ -123,7 +123,7 @@ WIN_CreateDevice(int devindex) ...@@ -123,7 +123,7 @@ WIN_CreateDevice(int devindex)
device->SetWindowGrab = WIN_SetWindowGrab; device->SetWindowGrab = WIN_SetWindowGrab;
device->DestroyWindow = WIN_DestroyWindow; device->DestroyWindow = WIN_DestroyWindow;
device->GetWindowWMInfo = WIN_GetWindowWMInfo; device->GetWindowWMInfo = WIN_GetWindowWMInfo;
#ifdef SDL_VIDEO_OPENGL #ifdef SDL_VIDEO_OPENGL_WGL
device->GL_LoadLibrary = WIN_GL_LoadLibrary; device->GL_LoadLibrary = WIN_GL_LoadLibrary;
device->GL_GetProcAddress = WIN_GL_GetProcAddress; device->GL_GetProcAddress = WIN_GL_GetProcAddress;
device->GL_CreateContext = WIN_GL_CreateContext; device->GL_CreateContext = WIN_GL_CreateContext;
......
...@@ -213,7 +213,7 @@ WIN_CreateWindow(_THIS, SDL_Window * window) ...@@ -213,7 +213,7 @@ WIN_CreateWindow(_THIS, SDL_Window * window)
DestroyWindow(hwnd); DestroyWindow(hwnd);
return -1; return -1;
} }
#ifdef SDL_VIDEO_OPENGL #ifdef SDL_VIDEO_OPENGL_WGL
if (window->flags & SDL_WINDOW_OPENGL) { if (window->flags & SDL_WINDOW_OPENGL) {
if (WIN_GL_SetupWindow(_this, window) < 0) { if (WIN_GL_SetupWindow(_this, window) < 0) {
WIN_DestroyWindow(_this, window); WIN_DestroyWindow(_this, window);
...@@ -419,7 +419,7 @@ WIN_DestroyWindow(_THIS, SDL_Window * window) ...@@ -419,7 +419,7 @@ WIN_DestroyWindow(_THIS, SDL_Window * window)
SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
if (data) { if (data) {
#ifdef SDL_VIDEO_OPENGL #ifdef SDL_VIDEO_OPENGL_WGL
if (window->flags & SDL_WINDOW_OPENGL) { if (window->flags & SDL_WINDOW_OPENGL) {
WIN_GL_CleanupWindow(_this, window); WIN_GL_CleanupWindow(_this, window);
} }
......
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with _this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#include "SDL_x11video.h"
/* GLX implementation of SDL OpenGL support */
#if SDL_VIDEO_OPENGL_GLX
#include "SDL_loadso.h"
#if defined(__IRIX__)
/* IRIX doesn't have a GL library versioning system */
#define DEFAULT_OPENGL "libGL.so"
#elif defined(__MACOSX__)
#define DEFAULT_OPENGL "/usr/X11R6/lib/libGL.1.dylib"
#elif defined(__QNXNTO__)
#define DEFAULT_OPENGL "libGL.so.3"
#else
#define DEFAULT_OPENGL "libGL.so.1"
#endif
#ifndef GLX_ARB_multisample
#define GLX_ARB_multisample
#define GLX_SAMPLE_BUFFERS_ARB 100000
#define GLX_SAMPLES_ARB 100001
#endif
#ifndef GLX_EXT_visual_rating
#define GLX_EXT_visual_rating
#define GLX_VISUAL_CAVEAT_EXT 0x20
#define GLX_NONE_EXT 0x8000
#define GLX_SLOW_VISUAL_EXT 0x8001
#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
#endif
#define OPENGL_REQUIRS_DLOPEN
#if defined(OPENGL_REQUIRS_DLOPEN) && defined(SDL_LOADSO_DLOPEN)
#include <dlfcn.h>
#define GL_LoadObject(X) dlopen(X, (RTLD_NOW|RTLD_GLOBAL))
#define GL_LoadFunction dlsym
#define GL_UnloadObject dlclose
#else
#define GL_LoadObject SDL_LoadObject
#define GL_LoadFunction SDL_LoadFunction
#define GL_UnloadObject SDL_UnloadObject
#endif
int
X11_GL_LoadLibrary(_THIS, const char *path)
{
void *handle;
if (_this->gl_config.driver_loaded) {
if (path) {
SDL_SetError("OpenGL library already loaded");
return -1;
} else {
++_this->gl_config.driver_loaded;
return 0;
}
}
if (path == NULL) {
path = SDL_getenv("SDL_OPENGL_LIBRARY");
}
if (path == NULL) {
path = DEFAULT_OPENGL;
}
handle = GL_LoadObject(path);
if (!handle) {
return -1;
}
/* Load new function pointers */
_this->gl_data->glXGetProcAddress =
(void *(*)(const GLubyte *)) GL_LoadFunction(handle,
"glXGetProcAddressARB");
_this->gl_data->glXChooseVisual =
(XVisualInfo * (*)(Display *, int, int *)) GL_LoadFunction(handle,
"glXChooseVisual");
_this->gl_data->glXCreateContext =
(GLXContext(*)(Display *, XVisualInfo *, GLXContext, int))
GL_LoadFunction(handle, "glXCreateContext");
_this->gl_data->glXDestroyContext =
(void (*)(Display *, GLXContext)) GL_LoadFunction(handle,
"glXDestroyContext");
_this->gl_data->glXMakeCurrent =
(int (*)(Display *, GLXDrawable, GLXContext)) GL_LoadFunction(handle,
"glXMakeCurrent");
_this->gl_data->glXSwapBuffers =
(void (*)(Display *, GLXDrawable)) GL_LoadFunction(handle,
"glXSwapBuffers");
_this->gl_data->glXGetConfig =
(int (*)(Display *, XVisualInfo *, int, int *))
GL_LoadFunction(handle, "glXGetConfig");
if (!_this->gl_data->glXChooseVisual ||
!_this->gl_data->glXCreateContext ||
!_this->gl_data->glXDestroyContext ||
!_this->gl_data->glXMakeCurrent ||
!_this->gl_data->glXSwapBuffers || !_this->gl_data->glXGetConfig) {
SDL_SetError("Could not retrieve OpenGL functions");
return -1;
}
_this->gl_config.dll_handle = handle;
SDL_strlcpy(_this->gl_config.driver_path, path,
SDL_arraysize(_this->gl_config.driver_path));
_this->gl_config.driver_loaded = 1;
return 0;
}
void *
X11_GL_GetProcAddress(_THIS, const char *proc)
{
void *handle;
handle = _this->gl_config.dll_handle;
if (_this->gl_data->glXGetProcAddress) {
return _this->gl_data->glXGetProcAddress((const GLubyte *) proc);
}
return GL_LoadFunction(handle, proc);
}
static void
X11_GL_UnloadLibrary(_THIS)
{
if (_this->gl_config.driver_loaded > 0) {
if (--_this->gl_config.driver_loaded > 0) {
return;
}
GL_UnloadObject(_this->gl_config.dll_handle);
_this->gl_config.dll_handle = NULL;
}
}
static SDL_bool
HasExtension(const char *extension, const char *extensions)
{
const char *start;
const char *where, *terminator;
/* Extension names should not have spaces. */
where = SDL_strchr(extension, ' ');
if (where || *extension == '\0')
return SDL_FALSE;
if (!extensions)
return SDL_FALSE;
/* It takes a bit of care to be fool-proof about parsing the
* OpenGL extensions string. Don't be fooled by sub-strings,
* etc. */
start = extensions;
for (;;) {
where = SDL_strstr(start, extension);
if (!where)
break;
terminator = where + SDL_strlen(extension);
if (where == start || *(where - 1) == ' ')
if (*terminator == ' ' || *terminator == '\0')
return SDL_TRUE;
start = terminator;
}
return SDL_FALSE;
}
static void
X11_GL_InitExtensions(_THIS)
{
Display *display = ((SDL_VideoData *) _this->driverdata)->display;
int screen = ((SDL_DisplayData *) SDL_CurrentDisplay.driverdata)->screen;
XVisualInfo *vinfo;
XSetWindowAttributes xattr;
Window w;
GLXContext context;
const char *(*glXQueryExtensionsStringFunc) (Display *, int);
const char *extensions;
vinfo = X11_GL_GetVisual(_this, display, screen);
if (!vinfo) {
return;
}
xattr.background_pixel = 0;
xattr.border_pixel = 0;
xattr.colormap =
XCreateColormap(display, RootWindow(display, screen), vinfo->visual,
AllocNone);
w = XCreateWindow(display, RootWindow(display, screen), 0, 0, 32, 32, 0,
vinfo->depth, InputOutput, vinfo->visual,
(CWBackPixel | CWBorderPixel | CWColormap), &xattr);
context = _this->gl_data->glXCreateContext(display, vinfo, NULL, True);
if (context) {
_this->gl_data->glXMakeCurrent(display, w, context);
}
XFree(vinfo);
glXQueryExtensionsStringFunc =
(const char *(*)(Display *, int)) X11_GL_GetProcAddress(_this,
"glXQueryExtensionsString");
if (glXQueryExtensionsStringFunc) {
extensions = glXQueryExtensionsStringFunc(display, screen);
} else {
extensions = NULL;
}
/* Check for SGI_swap_control */
if (HasExtension("SGI_swap_control", extensions)) {
_this->gl_data->glXSwapIntervalSGI =
(int (*)(int)) X11_GL_GetProcAddress(_this, "glXSwapIntervalSGI");
}
/* Check for GLX_MESA_swap_control */
if (HasExtension("GLX_MESA_swap_control", extensions)) {
_this->gl_data->glXSwapIntervalMESA =
(GLint(*)(unsigned)) X11_GL_GetProcAddress(_this,
"glXSwapIntervalMESA");
_this->gl_data->glXGetSwapIntervalMESA =
(GLint(*)(void)) X11_GL_GetProcAddress(_this,
"glXGetSwapIntervalMESA");
}
/* Check for GLX_EXT_visual_rating */
if (HasExtension("GLX_EXT_visual_rating", extensions)) {
_this->gl_data->HAS_GLX_EXT_visual_rating = SDL_TRUE;
}
if (context) {
_this->gl_data->glXMakeCurrent(display, None, NULL);
_this->gl_data->glXDestroyContext(display, context);
}
XDestroyWindow(display, w);
X11_PumpEvents(_this);
}
int
X11_GL_Initialize(_THIS)
{
if (_this->gl_data) {
++_this->gl_data->initialized;
return 0;
}
_this->gl_data =
(struct SDL_GLDriverData *) SDL_calloc(1,
sizeof(struct
SDL_GLDriverData));
if (!_this->gl_data) {
SDL_OutOfMemory();
return -1;
}
_this->gl_data->initialized = 1;
if (X11_GL_LoadLibrary(_this, NULL) < 0) {
return -1;
}
/* Initialize extensions */
X11_GL_InitExtensions(_this);
return 0;
}
void
X11_GL_Shutdown(_THIS)
{
if (!_this->gl_data || (--_this->gl_data->initialized > 0)) {
return;
}
X11_GL_UnloadLibrary(_this);
SDL_free(_this->gl_data);
_this->gl_data = NULL;
}
XVisualInfo *
X11_GL_GetVisual(_THIS, Display * display, int screen)
{
XVisualInfo *vinfo;
/* 64 seems nice. */
int attribs[64];
int i;
/* Setup our GLX attributes according to the gl_config. */
i = 0;
attribs[i++] = GLX_RGBA;
attribs[i++] = GLX_RED_SIZE;
attribs[i++] = _this->gl_config.red_size;
attribs[i++] = GLX_GREEN_SIZE;
attribs[i++] = _this->gl_config.green_size;
attribs[i++] = GLX_BLUE_SIZE;
attribs[i++] = _this->gl_config.blue_size;
if (_this->gl_config.alpha_size) {
attribs[i++] = GLX_ALPHA_SIZE;
attribs[i++] = _this->gl_config.alpha_size;
}
if (_this->gl_config.buffer_size) {
attribs[i++] = GLX_BUFFER_SIZE;
attribs[i++] = _this->gl_config.buffer_size;
}
if (_this->gl_config.double_buffer) {
attribs[i++] = GLX_DOUBLEBUFFER;
}
attribs[i++] = GLX_DEPTH_SIZE;
attribs[i++] = _this->gl_config.depth_size;
if (_this->gl_config.stencil_size) {
attribs[i++] = GLX_STENCIL_SIZE;
attribs[i++] = _this->gl_config.stencil_size;
}
if (_this->gl_config.accum_red_size) {
attribs[i++] = GLX_ACCUM_RED_SIZE;
attribs[i++] = _this->gl_config.accum_red_size;
}
if (_this->gl_config.accum_green_size) {
attribs[i++] = GLX_ACCUM_GREEN_SIZE;
attribs[i++] = _this->gl_config.accum_green_size;
}
if (_this->gl_config.accum_blue_size) {
attribs[i++] = GLX_ACCUM_BLUE_SIZE;
attribs[i++] = _this->gl_config.accum_blue_size;
}
if (_this->gl_config.accum_alpha_size) {
attribs[i++] = GLX_ACCUM_ALPHA_SIZE;
attribs[i++] = _this->gl_config.accum_alpha_size;
}
if (_this->gl_config.stereo) {
attribs[i++] = GLX_STEREO;
}
if (_this->gl_config.multisamplebuffers) {
attribs[i++] = GLX_SAMPLE_BUFFERS_ARB;
attribs[i++] = _this->gl_config.multisamplebuffers;
}
if (_this->gl_config.multisamplesamples) {
attribs[i++] = GLX_SAMPLES_ARB;
attribs[i++] = _this->gl_config.multisamplesamples;
}
if (_this->gl_config.accelerated >= 0
&& _this->gl_data->HAS_GLX_EXT_visual_rating) {
attribs[i++] = GLX_VISUAL_CAVEAT_EXT;
attribs[i++] = GLX_NONE_EXT;
}
#ifdef GLX_DIRECT_COLOR /* Try for a DirectColor visual for gamma support */
if (!SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR")) {
attribs[i++] = GLX_X_VISUAL_TYPE;
attribs[i++] = GLX_DIRECT_COLOR;
}
#endif
attribs[i++] = None;
vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs);
#ifdef GLX_DIRECT_COLOR
if (!vinfo && !SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR")) { /* No DirectColor visual? Try again.. */
attribs[i - 3] = None;
vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs);
}
#endif
if (!vinfo) {
SDL_SetError("Couldn't find matching GLX visual");
}
return vinfo;
}
SDL_GLContext
X11_GL_CreateContext(_THIS, SDL_Window * window)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
Display *display = data->videodata->display;
int screen =
((SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata)->
screen;
XWindowAttributes xattr;
XVisualInfo v, *vinfo;
int n;
GLXContext context = NULL;
/* We do _this to create a clean separation between X and GLX errors. */
XSync(display, False);
XGetWindowAttributes(display, data->window, &xattr);
v.screen = screen;
v.visualid = XVisualIDFromVisual(xattr.visual);
vinfo = XGetVisualInfo(display, VisualScreenMask | VisualIDMask, &v, &n);
if (vinfo) {
context =
_this->gl_data->glXCreateContext(display, vinfo, NULL, True);
XFree(vinfo);
}
XSync(display, False);
if (!context) {
SDL_SetError("Could not create GL context");
}
return (SDL_GLContext) context;
}
int
X11_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
{
Display *display = ((SDL_VideoData *) _this->driverdata)->display;
Window drawable =
(window ? ((SDL_WindowData *) window->driverdata)->window : None);
GLXContext glx_context = (GLXContext) context;
int status;
status = 0;
if (!_this->gl_data->glXMakeCurrent(display, drawable, glx_context)) {
SDL_SetError("Unable to make GL context current");
status = -1;
}
XSync(display, False);
return (status);
}
int
X11_GL_SetSwapInterval(_THIS, int interval)
{
int status;
if (_this->gl_data->glXSwapIntervalMESA) {
status = _this->gl_data->glXSwapIntervalMESA(interval);
if (status != 0) {
SDL_SetError("glxSwapIntervalMESA failed");
status = -1;
}
} else if (_this->gl_data->glXSwapIntervalSGI) {
status = _this->gl_data->glXSwapIntervalSGI(interval);
if (status != 0) {
SDL_SetError("glxSwapIntervalSGI failed");
status = -1;
}
} else {
SDL_Unsupported();
status = -1;
}
return status;
}
int
X11_GL_GetSwapInterval(_THIS)
{
if (_this->gl_data->glXGetSwapIntervalMESA) {
return _this->gl_data->glXGetSwapIntervalMESA();
} else {
SDL_Unsupported();
return -1;
}
}
void
X11_GL_SwapWindow(_THIS, SDL_Window * window)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
Display *display = data->videodata->display;
_this->gl_data->glXSwapBuffers(display, data->window);
}
void
X11_GL_DeleteContext(_THIS, SDL_GLContext context)
{
Display *display = ((SDL_VideoData *) _this->driverdata)->display;
GLXContext glx_context = (GLXContext) context;
_this->gl_data->glXDestroyContext(display, glx_context);
}
#endif /* SDL_VIDEO_OPENGL_GLX */
/* vi: set ts=4 sw=4 expandtab: */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifndef _SDL_x11opengl_h
#define _SDL_x11opengl_h
#if SDL_VIDEO_OPENGL_GLX
#include "SDL_opengl.h"
#include <GL/glx.h>
struct SDL_GLDriverData
{
int initialized;
SDL_bool HAS_GLX_EXT_visual_rating;
void *(*glXGetProcAddress) (const GLubyte * procName);
XVisualInfo *(*glXChooseVisual)
(Display * dpy, int screen, int *attribList);
GLXContext(*glXCreateContext)
(Display * dpy, XVisualInfo * vis, GLXContext shareList, Bool direct);
void (*glXDestroyContext)
(Display * dpy, GLXContext ctx);
Bool(*glXMakeCurrent)
(Display * dpy, GLXDrawable drawable, GLXContext ctx);
void (*glXSwapBuffers)
(Display * dpy, GLXDrawable drawable);
int (*glXGetConfig)
(Display * dpy, XVisualInfo * visual_info, int attrib, int *value);
int (*glXSwapIntervalSGI) (int interval);
GLint(*glXSwapIntervalMESA) (unsigned interval);
GLint(*glXGetSwapIntervalMESA) (void);
};
/* OpenGL functions */
extern int X11_GL_LoadLibrary(_THIS, const char *path);
extern void *X11_GL_GetProcAddress(_THIS, const char *proc);
extern int X11_GL_Initialize(_THIS);
extern void X11_GL_Shutdown(_THIS);
extern XVisualInfo *X11_GL_GetVisual(_THIS, Display * display, int screen);
extern SDL_GLContext X11_GL_CreateContext(_THIS, SDL_Window * window);
extern int X11_GL_MakeCurrent(_THIS, SDL_Window * window,
SDL_GLContext context);
extern int X11_GL_SetSwapInterval(_THIS, int interval);
extern int X11_GL_GetSwapInterval(_THIS);
extern void X11_GL_SwapWindow(_THIS, SDL_Window * window);
extern void X11_GL_DeleteContext(_THIS, SDL_GLContext context);
#endif /* SDL_VIDEO_OPENGL_GLX */
#endif /* _SDL_x11opengl_h */
/* vi: set ts=4 sw=4 expandtab: */
...@@ -20,499 +20,185 @@ ...@@ -20,499 +20,185 @@
slouken@libsdl.org slouken@libsdl.org
*/ */
/* *INDENT-OFF* */
SDL_X11_MODULE(BASEXLIB) SDL_X11_MODULE(BASEXLIB)
SDL_X11_SYM(XClassHint *, XAllocClassHint, (void), (), return) SDL_X11_SYM(XClassHint*,XAllocClassHint,(void),(),return)
SDL_X11_SYM(Status, XAllocColor, (Display * a, Colormap b, XColor * c), SDL_X11_SYM(Status,XAllocColor,(Display* a,Colormap b,XColor* c),(a,b,c),return)
(a, b, c), return) SDL_X11_SYM(XSizeHints *, XAllocSizeHints, SDL_X11_SYM(XSizeHints*,XAllocSizeHints,(void),(),return)
(void), (), SDL_X11_SYM(XWMHints*,XAllocWMHints,(void),(),return)
return) SDL_X11_SYM(XWMHints *, SDL_X11_SYM(int,XChangePointerControl,(Display* a,Bool b,Bool c,int d,int e,int f),(a,b,c,d,e,f),return)
XAllocWMHints, 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)
(void), (), SDL_X11_SYM(int,XChangeWindowAttributes,(Display* a,Window b,unsigned long c,XSetWindowAttributes* d),(a,b,c,d),return)
return) SDL_X11_SYM(Bool,XCheckWindowEvent,(Display* a,Window b,long c,XEvent* d),(a,b,c,d),return)
SDL_X11_SYM(int, XChangePointerControl, SDL_X11_SYM(int,XClearWindow,(Display* a,Window b),(a,b),return)
(Display * a, Bool b, Bool c, int d, int e, int f), (a, b, c, d, SDL_X11_SYM(int,XCloseDisplay,(Display* a),(a),return)
e, f), SDL_X11_SYM(Colormap,XCreateColormap,(Display* a,Window b,Visual* c,int d),(a,b,c,d),return)
return) SDL_X11_SYM(int, XChangeProperty, (Display * a, 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)
Window b, Atom c, SDL_X11_SYM(GC,XCreateGC,(Display* a,Drawable b,unsigned long c,XGCValues* d),(a,b,c,d),return)
Atom d, int e, int f, 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)
_Xconst unsigned char SDL_X11_SYM(Pixmap,XCreatePixmap,(Display* a,Drawable b,unsigned int c,unsigned int d,unsigned int e),(a,b,c,d,e),return)
*g, int h), (a, b, c, 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)
d, e, f, 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)
g, h), 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)
return) SDL_X11_SYM(int, SDL_X11_SYM(int,XDefineCursor,(Display* a,Window b,Cursor c),(a,b,c),return)
XChangeWindowAttributes, SDL_X11_SYM(int,XDeleteProperty,(Display* a,Window b,Atom c),(a,b,c),return)
(Display * a, Window b, SDL_X11_SYM(int,XDestroyWindow,(Display* a,Window b),(a,b),return)
unsigned long c, SDL_X11_SYM(char*,XDisplayName,(_Xconst char* a),(a),return)
XSetWindowAttributes * SDL_X11_SYM(int,XEventsQueued,(Display* a,int b),(a,b),return)
d), (a, b, c, d), return) SDL_X11_SYM(Bool,XFilterEvent,(XEvent *event, Window w),(event,w),return)
SDL_X11_SYM(Bool, XCheckTypedEvent, (Display * a, int b, XEvent * c), SDL_X11_SYM(int,XFlush,(Display* a),(a),return)
(a, b, c), return) SDL_X11_SYM(int, XClearWindow, (Display * a, SDL_X11_SYM(int,XFree,(void*a),(a),return)
Window b), SDL_X11_SYM(int,XFreeColormap,(Display* a,Colormap b),(a,b),return)
(a, b), return) SDL_X11_SYM(int, SDL_X11_SYM(int,XFreeColors,(Display* a,Colormap b,unsigned long* c,int d,unsigned long e),(a,b,c,d,e),return)
XCloseDisplay, SDL_X11_SYM(int,XFreeCursor,(Display* a,Cursor b),(a,b),return)
(Display SDL_X11_SYM(int,XFreeGC,(Display* a,GC b),(a,b),return)
* SDL_X11_SYM(int,XFreeModifiermap,(XModifierKeymap* a),(a),return)
a), SDL_X11_SYM(int,XFreePixmap,(Display* a,Pixmap b),(a,b),return)
(a), 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)
return) SDL_X11_SYM(XModifierKeymap*,XGetModifierMapping,(Display* a),(a),return)
SDL_X11_SYM(Colormap, XCreateColormap, SDL_X11_SYM(int,XGetPointerControl,(Display* a,int* b,int* c,int* d),(a,b,c,d),return)
(Display * a, Window b, Visual * c, int d), (a, b, c, d), SDL_X11_SYM(int,XGetScreenSaver,(Display* a,int* b,int* c,int* d, int* e),(a,b,c,d,e),return)
return) SDL_X11_SYM(Cursor, XCreatePixmapCursor, (Display * a, SDL_X11_SYM(XVisualInfo*,XGetVisualInfo,(Display* a,long b,XVisualInfo* c,int* d),(a,b,c,d),return)
Pixmap b, SDL_X11_SYM(XWMHints*,XGetWMHints,(Display* a,Window b),(a,b),return)
Pixmap c, SDL_X11_SYM(Status,XGetWindowAttributes,(Display* a,Window b,XWindowAttributes* c),(a,b,c),return)
XColor * d, SDL_X11_SYM(int,XGrabKeyboard,(Display* a,Window b,Bool c,int d,int e,Time f),(a,b,c,d,e,f),return)
XColor * e, 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)
unsigned int SDL_X11_SYM(Status,XIconifyWindow,(Display* a,Window b,int c),(a,b,c),return)
f, SDL_X11_SYM(int,XInstallColormap,(Display* a,Colormap b),(a,b),return)
unsigned int SDL_X11_SYM(KeyCode,XKeysymToKeycode,(Display* a,KeySym b),(a,b),return)
g), (a, b, c, SDL_X11_SYM(Atom,XInternAtom,(Display* a,_Xconst char* b,Bool c),(a,b,c),return)
d, e, f, SDL_X11_SYM(XPixmapFormatValues*,XListPixmapFormats,(Display* a,int* b),(a,b),return)
g), SDL_X11_SYM(int,XLookupString,(XKeyEvent* a,char* b,int c,KeySym* d,XComposeStatus* e),(a,b,c,d,e),return)
return) SDL_X11_SYM(GC, XCreateGC, SDL_X11_SYM(int,XMapRaised,(Display* a,Window b),(a,b),return)
(Display * a, SDL_X11_SYM(int,XMapWindow,(Display* a,Window b),(a,b),return)
Drawable b, SDL_X11_SYM(int,XMaskEvent,(Display* a,long b,XEvent* c),(a,b,c),return)
unsigned long c, SDL_X11_SYM(Status,XMatchVisualInfo,(Display* a,int b,int c,int d,XVisualInfo* e),(a,b,c,d,e),return)
XGCValues * d), (a, b, SDL_X11_SYM(int,XMissingExtension,(Display* a,_Xconst char* b),(a,b),return)
c, 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)
d), SDL_X11_SYM(int,XMoveWindow,(Display* a,Window b,int c,int d),(a,b,c,d),return)
return) SDL_X11_SYM(int,XNextEvent,(Display* a,XEvent* b),(a,b),return)
SDL_X11_SYM(XImage *, XCreateImage, SDL_X11_SYM(Display*,XOpenDisplay,(_Xconst char* a),(a),return)
(Display * a, Visual * b, unsigned int c, int d, int e, char *f, SDL_X11_SYM(int,XPeekEvent,(Display* a,XEvent* b),(a,b),return)
unsigned int g, unsigned int h, int i, int j), (a, b, c, d, e, SDL_X11_SYM(int,XPending,(Display* a),(a),return)
f, g, h, i, j), 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)
return) SDL_X11_SYM(Pixmap, XCreatePixmap, (Display * a, SDL_X11_SYM(int,XQueryColors,(Display* a,Colormap b,XColor* c,int d),(a,b,c,d),return)
Drawable b, SDL_X11_SYM(int,XQueryKeymap,(Display* a,char *b),(a,b),return)
unsigned int c, 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)
unsigned int d, SDL_X11_SYM(int,XRaiseWindow,(Display* a,Window b),(a,b),return)
unsigned int e), (a, SDL_X11_SYM(int,XReparentWindow,(Display* a,Window b,Window c,int d,int e),(a,b,c,d,e),return)
b, SDL_X11_SYM(int,XResizeWindow,(Display* a,Window b,unsigned int c,unsigned int d),(a,b,c,d),return)
c, SDL_X11_SYM(int,XSelectInput,(Display* a,Window b,long c),(a,b,c),return)
d, SDL_X11_SYM(Status,XSendEvent,(Display* a,Window b,Bool c,long d,XEvent* e),(a,b,c,d,e),return)
e), SDL_X11_SYM(int,XSetClassHint,(Display* a,Window b,XClassHint* c),(a,b,c),return)
return) SDL_X11_SYM(Pixmap, SDL_X11_SYM(XErrorHandler,XSetErrorHandler,(XErrorHandler a),(a),return)
XCreatePixmapFromBitmapData, SDL_X11_SYM(XIOErrorHandler,XSetIOErrorHandler,(XIOErrorHandler a),(a),return)
(Display * a, SDL_X11_SYM(int,XSetScreenSaver,(Display* a,int b,int c,int d,int e),(a,b,c,d,e),return)
Drawable b, char *c, SDL_X11_SYM(int,XSetTransientForHint,(Display* a,Window b,Window c),(a,b,c),return)
unsigned int d, SDL_X11_SYM(int,XSetWMHints,(Display* a,Window b,XWMHints* c),(a,b,c),return)
unsigned int e, SDL_X11_SYM(void,XSetTextProperty,(Display* a,Window b,XTextProperty* c,Atom d),(a,b,c,d),)
unsigned long f, unsigned long g, unsigned int h), (a, b, c, d, e, f, g, h), return) SDL_X11_SYM(void,XSetWMNormalHints,(Display* a,Window b,XSizeHints* c),(a,b,c),)
SDL_X11_SYM(Window, XCreateSimpleWindow, SDL_X11_SYM(Status,XSetWMProtocols,(Display* a,Window b,Atom* c,int d),(a,b,c,d),return)
(Display * a, Window b, int c, int d, unsigned int e, SDL_X11_SYM(int,XSetWindowBackground,(Display* a,Window b,unsigned long c),(a,b,c),return)
unsigned int f, unsigned int g, unsigned long h, SDL_X11_SYM(int,XSetWindowBackgroundPixmap,(Display* a,Window b,Pixmap c),(a,b,c),return)
unsigned long i), (a, b, c, d, e, f, g, h, i), SDL_X11_SYM(int,XSetWindowColormap,(Display* a,Window b,Colormap c),(a,b,c),return)
return) SDL_X11_SYM(Window, XCreateWindow, (Display * a, SDL_X11_SYM(int,XStoreColors,(Display* a,Colormap b,XColor* c,int d),(a,b,c,d),return)
Window b, int c, SDL_X11_SYM(Status,XStringListToTextProperty,(char** a,int b,XTextProperty* c),(a,b,c),return)
int d, SDL_X11_SYM(int,XSync,(Display* a,Bool b),(a,b),return)
unsigned int e, SDL_X11_SYM(int,XUngrabKeyboard,(Display* a,Time b),(a,b),return)
unsigned int f, SDL_X11_SYM(int,XUngrabPointer,(Display* a,Time b),(a,b),return)
unsigned int g, SDL_X11_SYM(int,XUnmapWindow,(Display* a,Window b),(a,b),return)
int h, 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)
unsigned int i, SDL_X11_SYM(VisualID,XVisualIDFromVisual,(Visual* a),(a),return)
Visual * j, SDL_X11_SYM(XExtDisplayInfo*,XextAddDisplay,(XExtensionInfo* a,Display* b,char* c,XExtensionHooks* d,int e,XPointer f),(a,b,c,d,e,f),return)
unsigned long k, SDL_X11_SYM(XExtensionInfo*,XextCreateExtension,(void),(),return)
XSetWindowAttributes SDL_X11_SYM(void,XextDestroyExtension,(XExtensionInfo* a),(a),)
* l), (a, b, c, d, SDL_X11_SYM(XExtDisplayInfo*,XextFindDisplay,(XExtensionInfo* a,Display* b),(a,b),return)
e, f, g, h, SDL_X11_SYM(int,XextRemoveDisplay,(XExtensionInfo* a,Display* b),(a,b),return)
i, j, k, l), SDL_X11_SYM(Bool,XQueryExtension,(Display* a,_Xconst char* b,int* c,int* d,int* e),(a,b,c,d,e),return)
return) SDL_X11_SYM(int, XDefineCursor, (Display * a, Window b, Cursor c), (a, b, c), return) SDL_X11_SYM(char *,XDisplayString,(Display* a),(a),return)
SDL_X11_SYM(int, XDeleteProperty, (Display * a, Window b, Atom c), (a, b, c), SDL_X11_SYM(int,XGetErrorText,(Display* a,int b,char* c,int d),(a,b,c,d),return)
return) SDL_X11_SYM(int, XDestroyWindow, (Display * a, SDL_X11_SYM(void,_XEatData,(Display* a,unsigned long b),(a,b),)
Window b), (a, b), SDL_X11_SYM(void,_XFlush,(Display* a),(a),)
return) SDL_X11_SYM(char *, XDisplayName, SDL_X11_SYM(void,_XFlushGCCache,(Display* a,GC b),(a,b),)
(_Xconst char *a), (a), SDL_X11_SYM(int,_XRead,(Display* a,char* b,long c),(a,b,c),return)
return) SDL_X11_SYM(void,_XReadPad,(Display* a,char* b,long c),(a,b,c),)
SDL_X11_SYM(int, XEventsQueued, (Display * a, int b), (a, b), SDL_X11_SYM(void,_XSend,(Display* a,_Xconst char* b,long c),(a,b,c),)
return) SDL_X11_SYM(Bool, XFilterEvent, (XEvent * event, SDL_X11_SYM(Status,_XReply,(Display* a,xReply* b,int c,Bool d),(a,b,c,d),return)
Window w), (event, w), SDL_X11_SYM(unsigned long,_XSetLastRequestRead,(Display* a,xGenericReply* b),(a,b),return)
return) SDL_X11_SYM(int, XFlush, SDL_X11_SYM(SDL_X11_XSynchronizeRetType,XSynchronize,(Display* a,Bool b),(a,b),return)
(Display * a), (a), SDL_X11_SYM(SDL_X11_XESetWireToEventRetType,XESetWireToEvent,(Display* a,int b,SDL_X11_XESetWireToEventRetType c),(a,b,c),return)
return) SDL_X11_SYM(SDL_X11_XESetEventToWireRetType,XESetEventToWire,(Display* a,int b,SDL_X11_XESetEventToWireRetType c),(a,b,c),return)
SDL_X11_SYM(int, XFree, (void *a), (a), return) SDL_X11_SYM(int, SDL_X11_SYM(XExtensionErrorHandler,XSetExtensionErrorHandler,(XExtensionErrorHandler a),(a),return)
XFreeColormap,
(Display *
a,
Colormap
b), (a, b),
return)
SDL_X11_SYM(int, XFreeColors,
(Display * a, Colormap b, unsigned long *c, int d, unsigned long e),
(a, b, c, d, e), return) SDL_X11_SYM(int, XFreeCursor,
(Display * a, Cursor b),
(a, b), return)
SDL_X11_SYM(int, XFreeGC, (Display * a, GC b), (a, b),
return) SDL_X11_SYM(int, XFreeModifiermap,
(XModifierKeymap * a), (a),
return) SDL_X11_SYM(int, XFreePixmap,
(Display * a,
Pixmap b), (a, b),
return)
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) SDL_X11_SYM(XModifierKeymap *, XGetModifierMapping, (Display * a), (a), return) SDL_X11_SYM(int, XGetPointerControl,
(Display * a, int *b, int *c,
int *d), (a, b, c, d), return)
SDL_X11_SYM(int, XGetScreenSaver,
(Display * a, int *b, int *c, int *d, int *e), (a, b, c, d, e),
return) SDL_X11_SYM(XVisualInfo *, XGetVisualInfo, (Display * a,
long b,
XVisualInfo
* c,
int *d), (a,
b,
c,
d),
return) SDL_X11_SYM(XWMHints *,
XGetWMHints,
(Display * a,
Window b), (a, b),
return)
SDL_X11_SYM(Status, XGetWindowAttributes,
(Display * a, Window b, XWindowAttributes * c), (a, b, c),
return) SDL_X11_SYM(int, XGrabKeyboard, (Display * a, Window b,
Bool c, int d, int e,
Time f), (a, b, c, d,
e, f),
return) 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)
SDL_X11_SYM(Status, XIconifyWindow, (Display * a, Window b, int c),
(a, b, c), return) SDL_X11_SYM(int, XInstallColormap,
(Display * a, Colormap b), (a,
b),
return) SDL_X11_SYM(KeyCode,
XKeysymToKeycode,
(Display *
a,
KeySym b),
(a, b), return)
SDL_X11_SYM(Atom, XInternAtom, (Display * a, _Xconst char *b, Bool c),
(a, b, c), return) SDL_X11_SYM(XPixmapFormatValues *,
XListPixmapFormats, (Display * a,
int *b), (a,
b),
return) SDL_X11_SYM(int,
XLookupString,
(XKeyEvent *
a, char *b,
int c,
KeySym * d,
XComposeStatus
* e), (a,
b,
c,
d,
e),
return)
SDL_X11_SYM(int, XMapRaised, (Display * a, Window b), (a, b),
return) SDL_X11_SYM(int, XMapWindow, (Display * a, Window b),
(a, b), return) SDL_X11_SYM(int,
XMaskEvent,
(Display * a,
long b,
XEvent * c),
(a, b, c), return)
SDL_X11_SYM(Status, XMatchVisualInfo,
(Display * a, int b, int c, int d, XVisualInfo * e), (a, b, c, d, e),
return) SDL_X11_SYM(int, XMissingExtension, (Display * a,
_Xconst char *b),
(a, b), return) 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)
SDL_X11_SYM(int, XMoveWindow, (Display * a, Window b, int c, int d),
(a, b, c, d), return) SDL_X11_SYM(int, XNextEvent, (Display * a,
XEvent * b),
(a, b),
return) SDL_X11_SYM(Display
*,
XOpenDisplay,
(_Xconst
char
*a),
(a), return)
SDL_X11_SYM(int, XPeekEvent, (Display * a, XEvent * b), (a, b),
return) SDL_X11_SYM(int, XPending, (Display * a), (a),
return) 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)
SDL_X11_SYM(int, XQueryColors, (Display * a, Colormap b, XColor * c, int d),
(a, b, c, d), return) SDL_X11_SYM(int, XQueryKeymap,
(Display * a, char *b), (a,
b),
return) 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)
SDL_X11_SYM(int, XRaiseWindow, (Display * a, Window b), (a, b),
return) SDL_X11_SYM(int, XReparentWindow, (Display * a,
Window b, Window c,
int d, int e), (a, b,
c, d,
e),
return) SDL_X11_SYM(int, XResizeWindow,
(Display * a, Window b,
unsigned int c,
unsigned int d), (a,
b,
c,
d),
return)
SDL_X11_SYM(int, XSelectInput, (Display * a, Window b, long c), (a, b, c),
return) SDL_X11_SYM(Status, XSendEvent, (Display * a, Window b,
Bool c, long d,
XEvent * e), (a, b, c,
d, e),
return) SDL_X11_SYM(int, XSetClassHint,
(Display * a, Window b,
XClassHint * c), (a,
b,
c),
return)
SDL_X11_SYM(XErrorHandler, XSetErrorHandler, (XErrorHandler a), (a),
return) SDL_X11_SYM(XIOErrorHandler, XSetIOErrorHandler,
(XIOErrorHandler a), (a),
return) SDL_X11_SYM(int, XSetScreenSaver,
(Display * a, int b,
int c, int d, int e),
(a, b, c, d, e), return)
SDL_X11_SYM(int, XSetTransientForHint, (Display * a, Window b, Window c),
(a, b, c), return) SDL_X11_SYM(int, XSetWMHints, (Display * a,
Window b,
XWMHints * c),
(a, b, c),
return) SDL_X11_SYM(void,
XSetTextProperty,
(Display *
a,
Window b,
XTextProperty
* c,
Atom d),
(a, b, c, d),)
SDL_X11_SYM(void, XSetWMNormalHints, (Display * a, Window b, XSizeHints * c),
(a, b, c),)
SDL_X11_SYM(Status, XSetWMProtocols,
(Display * a, Window b, Atom * c, int d), (a, b, c, d), return)
SDL_X11_SYM(int, XSetWindowBackground,
(Display * a, Window b, unsigned long c), (a, b, c), return)
SDL_X11_SYM(int, XSetWindowBackgroundPixmap,
(Display * a, Window b, Pixmap c), (a, b, c), return)
SDL_X11_SYM(int, XSetWindowColormap, (Display * a, Window b, Colormap c),
(a, b, c), return)
SDL_X11_SYM(int, XStoreColors, (Display * a, Colormap b, XColor * c, int d),
(a, b, c, d), return)
SDL_X11_SYM(Status, XStringListToTextProperty,
(char **a, int b, XTextProperty * c), (a, b, c), return)
SDL_X11_SYM(int, XSync, (Display * a, Bool b), (a, b), return)
SDL_X11_SYM(int, XUngrabKeyboard, (Display * a, Time b), (a, b), return)
SDL_X11_SYM(int, XUngrabPointer, (Display * a, Time b), (a, b), return)
SDL_X11_SYM(int, XUnmapWindow, (Display * a, Window b), (a, b), return)
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)
SDL_X11_SYM(VisualID, XVisualIDFromVisual, (Visual * a), (a), return)
SDL_X11_SYM(XExtDisplayInfo *, XextAddDisplay,
(XExtensionInfo * a, Display * b, char *c, XExtensionHooks * d,
int e, XPointer f), (a, b, c, d, e, f), return)
SDL_X11_SYM(XExtensionInfo *, XextCreateExtension, (void), (), return)
SDL_X11_SYM(void, XextDestroyExtension, (XExtensionInfo * a), (a),)
SDL_X11_SYM(XExtDisplayInfo *, XextFindDisplay,
(XExtensionInfo * a, Display * b), (a, b), return)
SDL_X11_SYM(int, XextRemoveDisplay, (XExtensionInfo * a, Display * b),
(a, b), return)
SDL_X11_SYM(Bool, XQueryExtension,
(Display * a, _Xconst char *b, int *c, int *d, int *e), (a, b, c,
d, e),
return)
SDL_X11_SYM(char *, XDisplayString, (Display * a), (a), return)
SDL_X11_SYM(int, XGetErrorText, (Display * a, int b, char *c, int d),
(a, b, c, d), return)
SDL_X11_SYM(void, _XEatData, (Display * a, unsigned long b), (a, b),)
SDL_X11_SYM(void, _XFlush, (Display * a), (a),)
SDL_X11_SYM(void, _XFlushGCCache, (Display * a, GC b), (a, b),)
SDL_X11_SYM(int, _XRead, (Display * a, char *b, long c), (a, b, c), return)
SDL_X11_SYM(void, _XReadPad, (Display * a, char *b, long c), (a, b, c),)
SDL_X11_SYM(void, _XSend, (Display * a, _Xconst char *b, long c), (a, b, c),)
SDL_X11_SYM(Status, _XReply, (Display * a, xReply * b, int c, Bool d),
(a, b, c, d), return)
SDL_X11_SYM(unsigned long, _XSetLastRequestRead,
(Display * a, xGenericReply * b), (a, b), return)
SDL_X11_SYM(SDL_X11_XSynchronizeRetType, XSynchronize, (Display * a, Bool b),
(a, b), return)
SDL_X11_SYM(SDL_X11_XESetWireToEventRetType, XESetWireToEvent,
(Display * a, int b, SDL_X11_XESetWireToEventRetType c), (a, b,
c),
return)
SDL_X11_SYM(SDL_X11_XESetEventToWireRetType, XESetEventToWire,
(Display * a, int b, SDL_X11_XESetEventToWireRetType c), (a, b,
c),
return)
SDL_X11_SYM(XExtensionErrorHandler, XSetExtensionErrorHandler,
(XExtensionErrorHandler a), (a), return)
#if NeedWidePrototypes #if NeedWidePrototypes
SDL_X11_SYM(KeySym, XKeycodeToKeysym, (Display * a, unsigned int b, int c), SDL_X11_SYM(KeySym,XKeycodeToKeysym,(Display* a,unsigned int b,int c),(a,b,c),return)
(a, b, c), return)
#else #else
SDL_X11_SYM(KeySym, XKeycodeToKeysym, (Display * a, KeyCode b, int c), SDL_X11_SYM(KeySym,XKeycodeToKeysym,(Display* a,KeyCode b,int c),(a,b,c),return)
(a, b, c), return)
#endif #endif
#ifdef X_HAVE_UTF8_STRING #ifdef X_HAVE_UTF8_STRING
SDL_X11_MODULE(UTF8) SDL_X11_MODULE(UTF8)
SDL_X11_SYM(int, Xutf8TextListToTextProperty, SDL_X11_SYM(int,Xutf8TextListToTextProperty,(Display* a,char** b,int c,XICCEncodingStyle d,XTextProperty* e),(a,b,c,d,e),return)
(Display * a, char **b, int c, XICCEncodingStyle d, SDL_X11_SYM(int,Xutf8LookupString,(XIC a,XKeyPressedEvent* b,char* c,int d,KeySym* e,Status* f),(a,b,c,d,e,f),return)
XTextProperty * e), (a, b, c, d, e), return)
SDL_X11_SYM(int, Xutf8LookupString,
(XIC a, XKeyPressedEvent * b, char *c, int d, KeySym * e,
Status * f), (a, b, c, d, e, f), return)
/*SDL_X11_SYM(XIC,XCreateIC,(XIM, ...),return) !!! ARGH! */ /*SDL_X11_SYM(XIC,XCreateIC,(XIM, ...),return) !!! ARGH! */
SDL_X11_SYM(void, XDestroyIC, (XIC a), (a),) SDL_X11_SYM(void,XDestroyIC,(XIC a),(a),)
SDL_X11_SYM(void, XSetICFocus, (XIC a), (a),) SDL_X11_SYM(void,XSetICFocus,(XIC a),(a),)
SDL_X11_SYM(void, XUnsetICFocus, (XIC a), (a),) SDL_X11_SYM(void,XUnsetICFocus,(XIC a),(a),)
SDL_X11_SYM(XIM, XOpenIM, SDL_X11_SYM(XIM,XOpenIM,(Display* a,struct _XrmHashBucketRec* b,char* c,char* d),(a,b,c,d),return)
(Display * a, struct _XrmHashBucketRec * b, char *c, char *d), SDL_X11_SYM(Status,XCloseIM,(XIM a),(a),return)
(a, b, c, d), return)
SDL_X11_SYM(Status, XCloseIM, (XIM a), (a), return)
#endif #endif
#ifndef NO_SHARED_MEMORY #ifndef NO_SHARED_MEMORY
SDL_X11_MODULE(SHM) SDL_X11_MODULE(SHM)
SDL_X11_SYM(Status, XShmAttach, (Display * a, XShmSegmentInfo * b), (a, b), SDL_X11_SYM(Status,XShmAttach,(Display* a,XShmSegmentInfo* b),(a,b),return)
return) SDL_X11_SYM(Status,XShmDetach,(Display* a,XShmSegmentInfo* b),(a,b),return)
SDL_X11_SYM(Status, XShmDetach, (Display * a, XShmSegmentInfo * b), (a, b), 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)
return) 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)
SDL_X11_SYM(Status, XShmPutImage, SDL_X11_SYM(Bool,XShmQueryExtension,(Display* a),(a),return)
(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)
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)
SDL_X11_SYM(Bool, XShmQueryExtension, (Display * a), (a), return)
#endif #endif
/* /*
* Not required...these only exist in code in headers on some 64-bit platforms, * Not required...these only exist in code in headers on some 64-bit platforms,
* and are removed via macros elsewhere, so it's safe for them to be missing. * and are removed via macros elsewhere, so it's safe for them to be missing.
*/ */
#ifdef LONG64 #ifdef LONG64
SDL_X11_MODULE(IO_32BIT) SDL_X11_MODULE(IO_32BIT)
SDL_X11_SYM(int, _XData32, SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
(Display * dpy, register long *data, unsigned len), (dpy, data, SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,len),)
len), return)
SDL_X11_SYM(void, _XRead32, (Display * dpy, register long *data, long len),
(dpy, data, len),)
#endif #endif
/* /*
* These only show up on some variants of Unix. * These only show up on some variants of Unix.
*/ */
#if defined(__osf__) #if defined(__osf__)
SDL_X11_MODULE(OSF_ENTRY_POINTS) SDL_X11_MODULE(OSF_ENTRY_POINTS)
SDL_X11_SYM(void, _SmtBufferOverflow, SDL_X11_SYM(void,_SmtBufferOverflow,(Display *dpy,register smtDisplayPtr p),(dpy,p),)
(Display * dpy, register smtDisplayPtr p), (dpy, p),) SDL_X11_SYM(void,_SmtIpError,(Display *dpy,register smtDisplayPtr p, int i),(dpy,p,i),)
SDL_X11_SYM(void, _SmtIpError, SDL_X11_SYM(int,ipAllocateData,(ChannelPtr a, IPCard b, IPDataPtr * c),(a,b,c),return)
(Display * dpy, register smtDisplayPtr p, int i), (dpy, p, i),) SDL_X11_SYM(int,ipUnallocateAndSendData,(ChannelPtr a, IPCard b),(a,b),return)
SDL_X11_SYM(int, ipAllocateData, (ChannelPtr a, IPCard b, IPDataPtr * c),
(a, b, c), return)
SDL_X11_SYM(int, ipUnallocateAndSendData, (ChannelPtr a, IPCard b), (a, b),
return)
#endif #endif
/* Xrandr support. */ /* Xrandr support. */
#if SDL_VIDEO_DRIVER_X11_XRANDR #if SDL_VIDEO_DRIVER_X11_XRANDR
SDL_X11_MODULE(XRANDR) SDL_X11_MODULE(XRANDR)
SDL_X11_SYM(Status, XRRQueryVersion, SDL_X11_SYM(Status,XRRQueryVersion,(Display *dpy,int *major_versionp,int *minor_versionp),(dpy,major_versionp,minor_versionp),return)
(Display * dpy, int *major_versionp, int *minor_versionp), (dpy, SDL_X11_SYM(XRRScreenConfiguration *,XRRGetScreenInfo,(Display *dpy,Drawable draw),(dpy,draw),return)
major_versionp, SDL_X11_SYM(SizeID,XRRConfigCurrentConfiguration,(XRRScreenConfiguration *config,Rotation *rotation),(config,rotation),return)
minor_versionp), SDL_X11_SYM(XRRScreenSize *,XRRConfigSizes,(XRRScreenConfiguration *config, int *nsizes),(config,nsizes),return)
return) 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)
SDL_X11_SYM(XRRScreenConfiguration *, XRRGetScreenInfo, SDL_X11_SYM(void,XRRFreeScreenConfigInfo,(XRRScreenConfiguration *config),(config),)
(Display * dpy, Drawable draw), (dpy, draw), return)
SDL_X11_SYM(SizeID, XRRConfigCurrentConfiguration,
(XRRScreenConfiguration * config, Rotation * rotation), (config,
rotation),
return)
SDL_X11_SYM(XRRScreenSize *, XRRConfigSizes,
(XRRScreenConfiguration * config, int *nsizes), (config, nsizes),
return)
SDL_X11_SYM(short *, XRRConfigRates,
(XRRScreenConfiguration * config, int sizeID, int *nrates),
(config, sizeID, nrates), return)
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)
SDL_X11_SYM(void, XRRFreeScreenConfigInfo, (XRRScreenConfiguration * config),
(config),)
#endif #endif
/* DPMS support */ /* DPMS support */
#if SDL_VIDEO_DRIVER_X11_DPMS #if SDL_VIDEO_DRIVER_X11_DPMS
SDL_X11_MODULE(DPMS) SDL_X11_MODULE(DPMS)
SDL_X11_SYM(Status, DPMSQueryExtension, SDL_X11_SYM(Status,DPMSQueryExtension,(Display *dpy,int *major_versionp,int *minor_versionp),(dpy,major_versionp,minor_versionp),return)
(Display * dpy, int *major_versionp, int *minor_versionp), (dpy, SDL_X11_SYM(Status,DPMSInfo,(Display *dpy,CARD16 *state,BOOL *onoff),(dpy,state,onoff),return)
major_versionp, SDL_X11_SYM(Status,DPMSEnable,(Display *dpy),(dpy),return)
minor_versionp), SDL_X11_SYM(Status,DPMSDisable,(Display *dpy),(dpy),return)
return)
SDL_X11_SYM(Status, DPMSInfo, (Display * dpy, CARD16 * state, BOOL * onoff),
(dpy, state, onoff), return)
SDL_X11_SYM(Status, DPMSEnable, (Display * dpy), (dpy), return)
SDL_X11_SYM(Status, DPMSDisable, (Display * dpy), (dpy), return)
#endif #endif
/* end of SDL_x11sym.h ... */
/* *INDENT-ON* */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -186,8 +186,7 @@ X11_CreateDevice(int devindex) ...@@ -186,8 +186,7 @@ X11_CreateDevice(int devindex)
device->SetWindowGrab = X11_SetWindowGrab; device->SetWindowGrab = X11_SetWindowGrab;
device->DestroyWindow = X11_DestroyWindow; device->DestroyWindow = X11_DestroyWindow;
device->GetWindowWMInfo = X11_GetWindowWMInfo; device->GetWindowWMInfo = X11_GetWindowWMInfo;
/* #ifdef SDL_VIDEO_OPENGL_GLX
#ifdef SDL_VIDEO_OPENGL
device->GL_LoadLibrary = X11_GL_LoadLibrary; device->GL_LoadLibrary = X11_GL_LoadLibrary;
device->GL_GetProcAddress = X11_GL_GetProcAddress; device->GL_GetProcAddress = X11_GL_GetProcAddress;
device->GL_CreateContext = X11_GL_CreateContext; device->GL_CreateContext = X11_GL_CreateContext;
...@@ -197,7 +196,6 @@ X11_CreateDevice(int devindex) ...@@ -197,7 +196,6 @@ X11_CreateDevice(int devindex)
device->GL_SwapWindow = X11_GL_SwapWindow; device->GL_SwapWindow = X11_GL_SwapWindow;
device->GL_DeleteContext = X11_GL_DeleteContext; device->GL_DeleteContext = X11_GL_DeleteContext;
#endif #endif
*/
device->free = X11_DeleteDevice; device->free = X11_DeleteDevice;
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
#include "SDL_x11keyboard.h" #include "SDL_x11keyboard.h"
#include "SDL_x11modes.h" #include "SDL_x11modes.h"
#include "SDL_x11mouse.h" #include "SDL_x11mouse.h"
//#include "SDL_x11opengl.h" #include "SDL_x11opengl.h"
#include "SDL_x11window.h" #include "SDL_x11window.h"
/* Private display data */ /* Private display data */
......
...@@ -135,7 +135,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -135,7 +135,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
{ {
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
SDL_DisplayData *displaydata = SDL_DisplayData *displaydata =
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata; (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
Visual *visual; Visual *visual;
int depth; int depth;
XSetWindowAttributes xattr; XSetWindowAttributes xattr;
...@@ -153,9 +153,23 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -153,9 +153,23 @@ X11_CreateWindow(_THIS, SDL_Window * window)
} }
*/ */
#endif #endif
#ifdef SDL_VIDEO_OPENGL_GLX
if (window->flags & SDL_WINDOW_OPENGL) { if (window->flags & SDL_WINDOW_OPENGL) {
/* FIXME: get the glx visual */ XVisualInfo *vinfo;
} else {
if (X11_GL_Initialize(_this) < 0) {
return -1;
}
vinfo = X11_GL_GetVisual(_this, data->display, displaydata->screen);
if (!vinfo) {
return -1;
}
visual = vinfo->visual;
depth = vinfo->depth;
XFree(vinfo);
} else
#endif
{
visual = displaydata->visual; visual = displaydata->visual;
depth = displaydata->depth; depth = displaydata->depth;
} }
...@@ -203,6 +217,15 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -203,6 +217,15 @@ X11_CreateWindow(_THIS, SDL_Window * window)
window->w, window->h, 0, depth, InputOutput, visual, window->w, window->h, 0, depth, InputOutput, visual,
(CWOverrideRedirect | CWBackPixel | CWBorderPixel | (CWOverrideRedirect | CWBackPixel | CWBorderPixel |
CWColormap), &xattr); CWColormap), &xattr);
if (!w) {
#ifdef SDL_VIDEO_OPENGL_GLX
if (window->flags & SDL_WINDOW_OPENGL) {
X11_GL_Shutdown(_this);
}
#endif
SDL_SetError("Couldn't create window");
return -1;
}
sizehints = XAllocSizeHints(); sizehints = XAllocSizeHints();
if (sizehints) { if (sizehints) {
...@@ -370,27 +393,26 @@ X11_CreateWindow(_THIS, SDL_Window * window) ...@@ -370,27 +393,26 @@ X11_CreateWindow(_THIS, SDL_Window * window)
/* Finally, show the window */ /* Finally, show the window */
if (window->flags & SDL_WINDOW_SHOWN) { if (window->flags & SDL_WINDOW_SHOWN) {
XEvent event;
XMapRaised(data->display, w); XMapRaised(data->display, w);
do {
XCheckWindowEvent(data->display, w, StructureNotifyMask, &event);
} while (event.type != MapNotify);
} }
XSync(data->display, False);
if (SetupWindowData(_this, window, w, SDL_TRUE) < 0) { if (SetupWindowData(_this, window, w, SDL_TRUE) < 0) {
#ifdef SDL_VIDEO_OPENGL_GLX
if (window->flags & SDL_WINDOW_OPENGL) {
X11_GL_Shutdown(_this);
}
#endif
XDestroyWindow(data->display, w); XDestroyWindow(data->display, w);
return -1; return -1;
} }
X11_SetWindowTitle(_this, window); X11_SetWindowTitle(_this, window);
#ifdef SDL_VIDEO_OPENGL
/*
if (window->flags & SDL_WINDOW_OPENGL) {
if (X11_GL_SetupWindow(_this, window) < 0) {
X11_DestroyWindow(_this, window);
return -1;
}
}
*/
#endif
return 0; return 0;
} }
...@@ -486,7 +508,7 @@ X11_SetWindowPosition(_THIS, SDL_Window * window) ...@@ -486,7 +508,7 @@ X11_SetWindowPosition(_THIS, SDL_Window * window)
{ {
SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
SDL_DisplayData *displaydata = SDL_DisplayData *displaydata =
(SDL_DisplayData *) SDL_CurrentDisplay.driverdata; (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata;
Display *display = data->videodata->display; Display *display = data->videodata->display;
int x, y; int x, y;
...@@ -576,12 +598,10 @@ X11_DestroyWindow(_THIS, SDL_Window * window) ...@@ -576,12 +598,10 @@ X11_DestroyWindow(_THIS, SDL_Window * window)
if (data) { if (data) {
Display *display = data->videodata->display; Display *display = data->videodata->display;
#ifdef SDL_VIDEO_OPENGL #ifdef SDL_VIDEO_OPENGL_GLX
/*
if (window->flags & SDL_WINDOW_OPENGL) { if (window->flags & SDL_WINDOW_OPENGL) {
X11_GL_CleanupWindow(_this, window); X11_GL_Shutdown(_this);
} }
*/
#endif #endif
#ifdef X_HAVE_UTF8_STRING #ifdef X_HAVE_UTF8_STRING
if (data->ic) { if (data->ic) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment