changeset 1950:a344e42bce3b

Started work on the new X11 driver.
author Sam Lantinga <slouken@libsdl.org>
date Wed, 26 Jul 2006 06:34:54 +0000
parents 44b6f09a07d8
children 7177581dc9fa
files src/video/x11/SDL_x11dyn.c src/video/x11/SDL_x11dyn.h src/video/x11/SDL_x11keyboard.c src/video/x11/SDL_x11keyboard.h src/video/x11/SDL_x11modes.c src/video/x11/SDL_x11modes.h src/video/x11/SDL_x11mouse.c src/video/x11/SDL_x11mouse.h src/video/x11/SDL_x11sym.h src/video/x11/SDL_x11video.c src/video/x11/SDL_x11video.h
diffstat 11 files changed, 1398 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/x11/SDL_x11dyn.c	Wed Jul 26 06:34:54 2006 +0000
@@ -0,0 +1,184 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2004 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#define DEBUG_DYNAMIC_X11 0
+
+#include "SDL_x11dyn.h"
+
+#if DEBUG_DYNAMIC_X11
+#include <stdio.h>
+#endif
+
+#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
+
+#include "SDL_name.h"
+#include "SDL_loadso.h"
+
+typedef struct
+{
+    void *lib;
+    const char *libname;
+} x11dynlib;
+
+#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR NULL
+#endif
+
+static x11dynlib x11libs[] = {
+    {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC},
+    {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT},
+    {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRENDER},
+    {NULL, SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR},
+};
+
+static void
+X11_GetSym(const char *fnname, int *rc, void **fn)
+{
+    int i;
+    for (i = 0; i < SDL_TABLESIZE(x11libs); i++) {
+        if (x11libs[i].lib != NULL) {
+            *fn = SDL_LoadFunction(x11libs[i].lib, fnname);
+            if (*fn != NULL)
+                break;
+        }
+    }
+
+#if DEBUG_DYNAMIC_X11
+    if (*fn != NULL)
+        printf("X11: Found '%s' in %s (%p)\n", fnname, x11libs[i].libname,
+               *fn);
+    else
+        printf("X11: Symbol '%s' NOT FOUND!\n", fnname);
+#endif
+
+    if (*fn == NULL)
+        *rc = 0;                /* kill this module. */
+}
+
+
+/* Define all the function pointers and wrappers... */
+#define SDL_X11_MODULE(modname)
+#define SDL_X11_SYM(rc,fn,params,args,ret) \
+	static rc (*p##fn) params = NULL; \
+	rc fn params { ret p##fn args ; }
+#include "SDL_x11sym.h"
+#undef SDL_X11_MODULE
+#undef SDL_X11_SYM
+#endif /* SDL_VIDEO_DRIVER_X11_DYNAMIC */
+
+/* Annoying varargs entry point... */
+#ifdef X_HAVE_UTF8_STRING
+XIC(*pXCreateIC) (XIM,...) = NULL;
+#endif
+
+/* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */
+#define SDL_X11_MODULE(modname) int SDL_X11_HAVE_##modname = 1;
+#define SDL_X11_SYM(rc,fn,params,args,ret)
+#include "SDL_x11sym.h"
+#undef SDL_X11_MODULE
+#undef SDL_X11_SYM
+
+
+static int x11_load_refcount = 0;
+
+void
+SDL_X11_UnloadSymbols(void)
+{
+#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
+    /* Don't actually unload if more than one module is using the libs... */
+    if (x11_load_refcount > 0) {
+        if (--x11_load_refcount == 0) {
+            int i;
+
+            /* set all the function pointers to NULL. */
+#define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1;
+#define SDL_X11_SYM(rc,fn,params,args,ret) p##fn = NULL;
+#include "SDL_x11sym.h"
+#undef SDL_X11_MODULE
+#undef SDL_X11_SYM
+
+#ifdef X_HAVE_UTF8_STRING
+            pXCreateIC = NULL;
+#endif
+
+            for (i = 0; i < SDL_TABLESIZE(x11libs); i++) {
+                if (x11libs[i].lib != NULL) {
+                    SDL_UnloadObject(x11libs[i].lib);
+                    x11libs[i].lib = NULL;
+                }
+            }
+        }
+    }
+#endif
+}
+
+/* returns non-zero if all needed symbols were loaded. */
+int
+SDL_X11_LoadSymbols(void)
+{
+    int rc = 1;                 /* always succeed if not using Dynamic X11 stuff. */
+
+#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
+    /* deal with multiple modules (dga, x11, etc) needing these symbols... */
+    if (x11_load_refcount++ == 0) {
+        int i;
+        int *thismod = NULL;
+        for (i = 0; i < SDL_TABLESIZE(x11libs); i++) {
+            if (x11libs[i].libname != NULL) {
+                x11libs[i].lib = SDL_LoadObject(x11libs[i].libname);
+            }
+        }
+#define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname;
+#define SDL_X11_SYM(a,fn,x,y,z) X11_GetSym(#fn,thismod,(void**)&p##fn);
+#include "SDL_x11sym.h"
+#undef SDL_X11_MODULE
+#undef SDL_X11_SYM
+
+#ifdef X_HAVE_UTF8_STRING
+        X11_GetSym("XCreateIC", &SDL_X11_HAVE_UTF8, (void **) &pXCreateIC);
+#endif
+
+        if (!SDL_X11_HAVE_BASEXLIB) {   /* some required symbol didn't load. */
+            SDL_X11_UnloadSymbols();    /* in case something got loaded... */
+            rc = 0;
+        }
+    }
+#else
+#ifdef X_HAVE_UTF8_STRING
+    pXCreateIC = XCreateIC;
+#endif
+#endif
+
+    return rc;
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/x11/SDL_x11dyn.h	Wed Jul 26 06:34:54 2006 +0000
@@ -0,0 +1,89 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2004 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+#ifndef _SDL_x11dyn_h
+#define _SDL_x11dyn_h
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+#include <X11/Xlibint.h>
+#include <X11/Xproto.h>
+
+#include "../Xext/extensions/Xext.h"
+#include "../Xext/extensions/extutil.h"
+
+#ifndef NO_SHARED_MEMORY
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <X11/extensions/XShm.h>
+#endif
+
+#if SDL_VIDEO_DRIVER_X11_XRANDR
+#include <X11/extensions/Xrandr.h>
+#endif
+
+/*
+ * When using the "dynamic X11" functionality, we duplicate all the Xlib
+ *  symbols that would be referenced by SDL inside of SDL itself.
+ *  These duplicated symbols just serve as passthroughs to the functions
+ *  in Xlib, that was dynamically loaded.
+ *
+ * This allows us to use Xlib as-is when linking against it directly, but
+ *  also handles all the strange cases where there was code in the Xlib
+ *  headers that may or may not exist or vary on a given platform.
+ */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* evil function signatures... */
+    typedef Bool(*SDL_X11_XESetWireToEventRetType) (Display *, XEvent *,
+                                                    xEvent *);
+    typedef int (*SDL_X11_XSynchronizeRetType) (Display *);
+    typedef Status(*SDL_X11_XESetEventToWireRetType) (Display *, XEvent *,
+                                                      xEvent *);
+
+    int SDL_X11_LoadSymbols(void);
+    void SDL_X11_UnloadSymbols(void);
+
+/* That's really annoying...make this a function pointer no matter what. */
+#ifdef X_HAVE_UTF8_STRING
+    extern XIC(*pXCreateIC) (XIM, ...);
+#endif
+
+/* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */
+#define SDL_X11_MODULE(modname) extern int SDL_X11_HAVE_##modname;
+#define SDL_X11_SYM(rc,fn,params,args,ret)
+#include "SDL_x11sym.h"
+#undef SDL_X11_MODULE
+#undef SDL_X11_SYM
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* !defined _SDL_x11dyn_h */
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/x11/SDL_x11keyboard.c	Wed Jul 26 06:34:54 2006 +0000
@@ -0,0 +1,46 @@
+/*
+    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"
+
+#include "../../events/SDL_keyboard_c.h"
+
+void
+X11_InitKeyboard(_THIS)
+{
+    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+    SDL_Keyboard keyboard;
+
+    SDL_zero(keyboard);
+    data->keyboard = SDL_AddKeyboard(&keyboard, -1);
+}
+
+void
+X11_QuitKeyboard(_THIS)
+{
+    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+
+    SDL_DelKeyboard(data->keyboard);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/x11/SDL_x11keyboard.h	Wed Jul 26 06:34:54 2006 +0000
@@ -0,0 +1,32 @@
+/*
+    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_x11keyboard_h
+#define _SDL_x11keyboard_h
+
+extern void X11_InitKeyboard(_THIS);
+extern void X11_QuitKeyboard(_THIS);
+
+#endif /* _SDL_x11keyboard_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/x11/SDL_x11modes.c	Wed Jul 26 06:34:54 2006 +0000
@@ -0,0 +1,139 @@
+/*
+    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"
+
+
+static int
+get_visualinfo(Display * display, int screen, XVisualInfo * vinfo)
+{
+    const char *visual_id = SDL_getenv("SDL_VIDEO_X11_VISUALID");
+    int use_directcolor = 1;
+    int depth;
+
+    /* Look for an exact visual, if requested */
+    if (visual_id) {
+        XVisualInfo *vi, template;
+        int nvis;
+
+        SDL_zero(template);
+        template.visualid = SDL_strtol(visual_id, NULL, 0);
+        vi = XGetVisualInfo(display, VisualIDMask, &template, &nvis);
+        if (vi) {
+            *vinfo = *vi;
+            XFree(vi);
+            return 0;
+        }
+    }
+
+    depth = DefaultDepth(display, screen);
+    if ((use_directcolor &&
+         XMatchVisualInfo(display, screen, depth, DirectColor, vinfo)) ||
+        XMatchVisualInfo(display, screen, depth, TrueColor, vinfo) ||
+        XMatchVisualInfo(display, screen, depth, PseudoColor, vinfo) ||
+        XMatchVisualInfo(display, screen, depth, StaticColor, vinfo)) {
+        return 0;
+    }
+    return -1;
+}
+
+void
+X11_InitModes(_THIS)
+{
+    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+    int screen;
+    int n;
+    XPixmapFormatValues *p;
+
+    p = XListPixmapFormats(data->display, &n);
+    for (screen = 0; screen < ScreenCount(data->display); ++screen) {
+        XVisualInfo vinfo;
+        int i, bpp;
+        Uint32 Rmask, Gmask, Bmask, Amask;
+        SDL_VideoDisplay display;
+        SDL_DisplayData *displaydata;
+        SDL_DisplayMode mode;
+
+        if (get_visualinfo(data->display, screen, &vinfo) < 0) {
+            continue;
+        }
+
+        bpp = vinfo.depth;
+        for (i = 0; i < n; ++i) {
+            if (p[i].depth == vinfo.depth) {
+                bpp = p[i].bits_per_pixel;
+                break;
+            }
+        }
+        Rmask = vinfo.visual->red_mask;
+        Gmask = vinfo.visual->green_mask;
+        Bmask = vinfo.visual->blue_mask;
+        if (vinfo.depth == 32) {
+            Amask = (0xFFFFFFFF & ~(Rmask | Gmask | Bmask));
+        } else {
+            Amask = 0;
+        }
+        mode.format =
+            SDL_MasksToPixelFormatEnum(bpp, Rmask, Gmask, Bmask, Amask);
+        mode.w = DisplayWidth(data->display, screen);
+        mode.h = DisplayHeight(data->display, screen);
+        mode.refresh_rate = 0;
+        mode.driverdata = NULL;
+
+        displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata));
+        if (!displaydata) {
+            continue;
+        }
+        displaydata->screen = screen;
+        displaydata->visual = vinfo.visual;
+
+        SDL_zero(display);
+        display.desktop_mode = mode;
+        display.current_mode = mode;
+        display.driverdata = displaydata;
+        SDL_AddVideoDisplay(&display);
+    }
+    XFree(p);
+}
+
+void
+X11_GetDisplayModes(_THIS)
+{
+    SDL_DisplayData *data = (SDL_DisplayData *) SDL_CurrentDisplay.driverdata;
+    SDL_DisplayMode mode;
+    //SDL_AddDisplayMode(_this->current_display, &mode);
+}
+
+int
+X11_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
+{
+    //SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata;
+    return -1;
+}
+
+void
+X11_QuitModes(_THIS)
+{
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/x11/SDL_x11modes.h	Wed Jul 26 06:34:54 2006 +0000
@@ -0,0 +1,46 @@
+/*
+    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_x11modes_h
+#define _SDL_x11modes_h
+
+typedef struct
+{
+    int screen;
+    Visual *visual;
+} SDL_DisplayData;
+
+//typedef struct
+//{
+//    TCHAR DeviceName[32];
+//    DEVMODE DeviceMode;
+//} SDL_DisplayModeData;
+
+extern void X11_InitModes(_THIS);
+extern void X11_GetDisplayModes(_THIS);
+extern int X11_SetDisplayMode(_THIS, SDL_DisplayMode * mode);
+extern void X11_QuitModes(_THIS);
+
+#endif /* _SDL_x11modes_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/x11/SDL_x11mouse.c	Wed Jul 26 06:34:54 2006 +0000
@@ -0,0 +1,46 @@
+/*
+    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"
+
+#include "../../events/SDL_mouse_c.h"
+
+void
+X11_InitMouse(_THIS)
+{
+    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+    SDL_Mouse mouse;
+
+    SDL_zero(mouse);
+    data->mouse = SDL_AddMouse(&mouse, -1);
+}
+
+void
+X11_QuitMouse(_THIS)
+{
+    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
+
+    SDL_DelMouse(data->mouse);
+}
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/x11/SDL_x11mouse.h	Wed Jul 26 06:34:54 2006 +0000
@@ -0,0 +1,32 @@
+/*
+    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_x11mouse_h
+#define _SDL_x11mouse_h
+
+extern void X11_InitMouse(_THIS);
+extern void X11_QuitMouse(_THIS);
+
+#endif /* _SDL_x11mouse_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/x11/SDL_x11sym.h	Wed Jul 26 06:34:54 2006 +0000
@@ -0,0 +1,518 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2004 Sam Lantinga
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+
+SDL_X11_MODULE(BASEXLIB)
+    SDL_X11_SYM(XClassHint *, XAllocClassHint, (void), (), return)
+    SDL_X11_SYM(Status, XAllocColor, (Display * a, Colormap b, XColor * c),
+            (a, b, c), return) SDL_X11_SYM(XSizeHints *, XAllocSizeHints,
+                                           (void), (),
+                                           return) SDL_X11_SYM(XWMHints *,
+                                                               XAllocWMHints,
+                                                               (void), (),
+                                                               return)
+    SDL_X11_SYM(int, XChangePointerControl,
+            (Display * a, Bool b, Bool c, int d, int e, int f), (a, b, c, d,
+                                                             e, f),
+            return) 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) SDL_X11_SYM(int,
+                                                    XChangeWindowAttributes,
+                                                    (Display * a, Window b,
+                                                     unsigned long c,
+                                                     XSetWindowAttributes *
+                                                     d), (a, b, c, d), return)
+    SDL_X11_SYM(Bool, XCheckTypedEvent, (Display * a, int b, XEvent * c),
+            (a, b, c), return) SDL_X11_SYM(int, XClearWindow, (Display * a,
+                                                               Window b),
+                                           (a, b), return) SDL_X11_SYM(int,
+                                                                       XCloseDisplay,
+                                                                       (Display
+                                                                        *
+                                                                        a),
+                                                                       (a),
+                                                                       return)
+    SDL_X11_SYM(Colormap, XCreateColormap,
+            (Display * a, Window b, Visual * c, int d), (a, b, c, d),
+            return) 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) SDL_X11_SYM(GC, XCreateGC,
+                                                    (Display * a,
+                                                     Drawable b,
+                                                     unsigned long c,
+                                                     XGCValues * d), (a, b,
+                                                                      c,
+                                                                      d),
+                                                    return)
+    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) SDL_X11_SYM(Pixmap, XCreatePixmap, (Display * a,
+Drawable b,
+unsigned int c,
+unsigned int d,
+unsigned int e), (a,
+      b,
+      c,
+      d,
+      e),
+return) 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)
+    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) 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) SDL_X11_SYM(int, XDefineCursor, (Display * a, Window b, Cursor c), (a, b, c), return)
+    SDL_X11_SYM(int, XDeleteProperty, (Display * a, Window b, Atom c), (a, b, c),
+            return) SDL_X11_SYM(int, XDestroyWindow, (Display * a,
+                                                      Window b), (a, b),
+                                return) SDL_X11_SYM(char *, XDisplayName,
+                                                    (_Xconst char *a), (a),
+                                                    return)
+    SDL_X11_SYM(int, XEventsQueued, (Display * a, int b), (a, b),
+            return) SDL_X11_SYM(Bool, XFilterEvent, (XEvent * event,
+                                                     Window w), (event, w),
+                                return) SDL_X11_SYM(int, XFlush,
+                                                    (Display * a), (a),
+                                                    return)
+    SDL_X11_SYM(int, XFree, (void *a), (a), return) SDL_X11_SYM(int,
+                                                                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
+SDL_X11_SYM(KeySym, XKeycodeToKeysym, (Display * a, unsigned int b, int c),
+            (a, b, c), return)
+#else
+SDL_X11_SYM(KeySym, XKeycodeToKeysym, (Display * a, KeyCode b, int c),
+            (a, b, c), return)
+#endif
+#ifdef X_HAVE_UTF8_STRING
+SDL_X11_MODULE(UTF8)
+SDL_X11_SYM(int, Xutf8TextListToTextProperty,
+            (Display * a, char **b, int c, XICCEncodingStyle d,
+             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(void, XDestroyIC, (XIC a), (a),)
+SDL_X11_SYM(void, XSetICFocus, (XIC a), (a),)
+SDL_X11_SYM(void, XUnsetICFocus, (XIC a), (a),)
+SDL_X11_SYM(XIM, XOpenIM,
+            (Display * a, struct _XrmHashBucketRec * b, char *c, char *d),
+            (a, b, c, d), return)
+SDL_X11_SYM(Status, XCloseIM, (XIM a), (a), return)
+#endif
+#ifndef NO_SHARED_MEMORY
+SDL_X11_MODULE(SHM)
+SDL_X11_SYM(Status, XShmAttach, (Display * a, XShmSegmentInfo * b), (a, b),
+            return)
+SDL_X11_SYM(Status, XShmDetach, (Display * a, XShmSegmentInfo * b), (a, b),
+            return)
+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)
+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
+/*
+ * 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.
+ */
+#ifdef LONG64
+SDL_X11_MODULE(IO_32BIT)
+SDL_X11_SYM(int, _XData32,
+            (Display * dpy, register long *data, unsigned len), (dpy, data,
+                                                                 len), return)
+SDL_X11_SYM(void, _XRead32, (Display * dpy, register long *data, long len),
+            (dpy, data, len),)
+#endif
+/*
+ * These only show up on some variants of Unix.
+ */
+#if defined(__osf__)
+SDL_X11_MODULE(OSF_ENTRY_POINTS)
+SDL_X11_SYM(void, _SmtBufferOverflow,
+            (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(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
+/* Xrandr support. */
+#if SDL_VIDEO_DRIVER_X11_XRANDR
+SDL_X11_MODULE(XRANDR)
+SDL_X11_SYM(Status, XRRQueryVersion,
+            (Display * dpy, int *major_versionp, int *minor_versionp), (dpy,
+                                                                        major_versionp,
+                                                                        minor_versionp),
+            return)
+SDL_X11_SYM(XRRScreenConfiguration *, XRRGetScreenInfo,
+            (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
+/* DPMS support */
+#if SDL_VIDEO_DRIVER_X11_DPMS
+SDL_X11_MODULE(DPMS)
+SDL_X11_SYM(Status, DPMSQueryExtension,
+            (Display * dpy, int *major_versionp, int *minor_versionp), (dpy,
+                                                                        major_versionp,
+                                                                        minor_versionp),
+            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
+/* end of SDL_x11sym.h ... */
+/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/x11/SDL_x11video.c	Wed Jul 26 06:34:54 2006 +0000
@@ -0,0 +1,196 @@
+/*
+    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_video.h"
+#include "SDL_mouse.h"
+#include "../SDL_sysvideo.h"
+#include "../SDL_pixels_c.h"
+
+#include "SDL_x11video.h"
+//#include "SDL_d3drender.h"
+//#include "SDL_gdirender.h"
+
+/* Initialization/Query functions */
+static int X11_VideoInit(_THIS);
+static void X11_VideoQuit(_THIS);
+
+/* X11 driver bootstrap functions */
+
+static int
+X11_Available(void)
+{
+    Display *display = NULL;
+    if (SDL_X11_LoadSymbols()) {
+        display = XOpenDisplay(NULL);
+        if (display != NULL) {
+            XCloseDisplay(display);
+        }
+        SDL_X11_UnloadSymbols();
+    }
+    return (display != NULL);
+}
+
+static void
+X11_DeleteDevice(SDL_VideoDevice * device)
+{
+    SDL_VideoData *data = (SDL_VideoData *) device->driverdata;
+
+    if (data->display) {
+        XCloseDisplay(data->display);
+    }
+    SDL_free(device->driverdata);
+    SDL_free(device);
+
+    SDL_X11_UnloadSymbols();
+}
+
+static SDL_VideoDevice *
+X11_CreateDevice(int devindex)
+{
+    SDL_VideoDevice *device;
+    SDL_VideoData *data;
+    const char *display = NULL; /* Use the DISPLAY environment variable */
+
+    if (!SDL_X11_LoadSymbols()) {
+        return NULL;
+    }
+
+    /* Initialize all variables that we clean on shutdown */
+    device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
+    if (device) {
+        data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
+    }
+    if (!device || !data) {
+        SDL_OutOfMemory();
+        if (device) {
+            SDL_free(device);
+        }
+        return NULL;
+    }
+    device->driverdata = data;
+
+    /* FIXME: Do we need this?
+       if ( (SDL_strncmp(XDisplayName(display), ":", 1) == 0) ||
+       (SDL_strncmp(XDisplayName(display), "unix:", 5) == 0) ) {
+       local_X11 = 1;
+       } else {
+       local_X11 = 0;
+       }
+     */
+    data->display = XOpenDisplay(display);
+#if defined(__osf__) && defined(SDL_VIDEO_DRIVER_X11_DYNAMIC)
+    /* On Tru64 if linking without -lX11, it fails and you get following message.
+     * Xlib: connection to ":0.0" refused by server
+     * Xlib: XDM authorization key matches an existing client!
+     *
+     * It succeeds if retrying 1 second later
+     * or if running xhost +localhost on shell.
+     */
+    if (data->display == NULL) {
+        SDL_Delay(1000);
+        data->display = XOpenDisplay(display);
+    }
+#endif
+    if (data->display == NULL) {
+        SDL_free(device);
+        SDL_SetError("Couldn't open X11 display");
+        return NULL;
+    }
+#ifdef X11_DEBUG
+    XSynchronize(data->display, True);
+#endif
+
+    /* Set the function pointers */
+    device->VideoInit = X11_VideoInit;
+    device->VideoQuit = X11_VideoQuit;
+    device->GetDisplayModes = X11_GetDisplayModes;
+    device->SetDisplayMode = X11_SetDisplayMode;
+//    device->SetDisplayGammaRamp = X11_SetDisplayGammaRamp;
+//    device->GetDisplayGammaRamp = X11_GetDisplayGammaRamp;
+//    device->PumpEvents = X11_PumpEvents;
+
+/*
+    device->CreateWindow = X11_CreateWindow;
+    device->CreateWindowFrom = X11_CreateWindowFrom;
+    device->SetWindowTitle = X11_SetWindowTitle;
+    device->SetWindowPosition = X11_SetWindowPosition;
+    device->SetWindowSize = X11_SetWindowSize;
+    device->ShowWindow = X11_ShowWindow;
+    device->HideWindow = X11_HideWindow;
+    device->RaiseWindow = X11_RaiseWindow;
+    device->MaximizeWindow = X11_MaximizeWindow;
+    device->MinimizeWindow = X11_MinimizeWindow;
+    device->RestoreWindow = X11_RestoreWindow;
+    device->SetWindowGrab = X11_SetWindowGrab;
+    device->DestroyWindow = X11_DestroyWindow;
+    device->GetWindowWMInfo = X11_GetWindowWMInfo;
+#ifdef SDL_VIDEO_OPENGL
+    device->GL_LoadLibrary = X11_GL_LoadLibrary;
+    device->GL_GetProcAddress = X11_GL_GetProcAddress;
+    device->GL_CreateContext = X11_GL_CreateContext;
+    device->GL_MakeCurrent = X11_GL_MakeCurrent;
+    device->GL_SetSwapInterval = X11_GL_SetSwapInterval;
+    device->GL_GetSwapInterval = X11_GL_GetSwapInterval;
+    device->GL_SwapWindow = X11_GL_SwapWindow;
+    device->GL_DeleteContext = X11_GL_DeleteContext;
+#endif
+*/
+
+    device->free = X11_DeleteDevice;
+
+    return device;
+}
+
+VideoBootStrap X11_bootstrap = {
+    "x11", "SDL X11 video driver",
+    X11_Available, X11_CreateDevice
+};
+
+
+int
+X11_VideoInit(_THIS)
+{
+    X11_InitModes(_this);
+
+//#if SDL_VIDEO_RENDER_D3D
+//    D3D_AddRenderDriver(_this);
+//#endif
+//#if SDL_VIDEO_RENDER_GDI
+//    GDI_AddRenderDriver(_this);
+//#endif
+
+    X11_InitKeyboard(_this);
+    X11_InitMouse(_this);
+
+    return 0;
+}
+
+void
+X11_VideoQuit(_THIS)
+{
+    X11_QuitModes(_this);
+    X11_QuitKeyboard(_this);
+    X11_QuitMouse(_this);
+}
+
+/* vim: set ts=4 sw=4 expandtab: */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/video/x11/SDL_x11video.h	Wed Jul 26 06:34:54 2006 +0000
@@ -0,0 +1,70 @@
+/*
+    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_x11video_h
+#define _SDL_x11video_h
+
+#include "../SDL_sysvideo.h"
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+
+//#include "SDL_x11events.h"
+//#include "SDL_x11gamma.h"
+#include "SDL_x11keyboard.h"
+#include "SDL_x11modes.h"
+#include "SDL_x11mouse.h"
+//#include "SDL_x11opengl.h"
+//#include "SDL_x11window.h"
+
+#if SDL_VIDEO_DRIVER_X11_XINERAMA
+#include "../Xext/extensions/Xinerama.h"
+#endif
+#if SDL_VIDEO_DRIVER_X11_XRANDR
+#include <X11/extensions/Xrandr.h>
+#endif
+#if SDL_VIDEO_DRIVER_X11_VIDMODE
+#include "../Xext/extensions/xf86vmode.h"
+#endif
+#if SDL_VIDEO_DRIVER_X11_XME
+#include "../Xext/extensions/xme.h"
+#endif
+#if SDL_VIDEO_DRIVER_X11_DPMS
+#include <X11/extensions/dpms.h>
+#endif
+
+#include "SDL_x11dyn.h"
+
+/* Private display data */
+
+typedef struct SDL_VideoData
+{
+    Display *display;
+    int mouse;
+    int keyboard;
+} SDL_VideoData;
+
+#endif /* _SDL_x11video_h */
+
+/* vi: set ts=4 sw=4 expandtab: */