Updated dynamic X11 code. See details in Bugzilla #170.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 22 Mar 2006 05:00:59 +0000
changeset 1575 3ba88cb7eb1b
parent 1574 0fd72308659e
child 1576 9d586151c20b
Updated dynamic X11 code. See details in Bugzilla #170.
include/SDL_config.h
src/.cvsignore
src/video/Xext/XME/xme.c
src/video/Xext/Xinerama/Xinerama.c
src/video/Xext/Xv/Xv.c
src/video/Xext/Xv/Xvlibint.h
src/video/Xext/Xxf86dga/XF86DGA.c
src/video/Xext/Xxf86dga/XF86DGA2.c
src/video/Xext/Xxf86vm/XF86VMode.c
src/video/Xext/extensions/extutil.h
src/video/dga/SDL_dgaevents.c
src/video/dga/SDL_dgavideo.c
src/video/x11/SDL_x11dyn.c
src/video/x11/SDL_x11dyn.h
src/video/x11/SDL_x11events.c
src/video/x11/SDL_x11gamma.c
src/video/x11/SDL_x11gl.c
src/video/x11/SDL_x11image.c
src/video/x11/SDL_x11modes.c
src/video/x11/SDL_x11mouse.c
src/video/x11/SDL_x11sym.h
src/video/x11/SDL_x11video.c
src/video/x11/SDL_x11wm.c
src/video/x11/SDL_x11yuv.c
--- a/include/SDL_config.h	Wed Mar 22 04:51:44 2006 +0000
+++ b/include/SDL_config.h	Wed Mar 22 05:00:59 2006 +0000
@@ -1,3 +1,4 @@
+/* include/SDL_config.h.  Generated by configure.  */
 /*
     SDL - Simple DirectMedia Layer
     Copyright (C) 1997-2006 Sam Lantinga
@@ -23,56 +24,277 @@
 #ifndef _SDL_config_h
 #define _SDL_config_h
 
+/* This is a set of defines to configure the SDL features */
+
+/* General platform specific identifiers */
 #include "SDL_platform.h"
 
-/* Add any platform that doesn't build using the configure system */
-#if defined(__AMIGA__)
-#include "SDL_config_amiga.h"
-#elif defined(__DREAMCAST__)
-#include "SDL_config_dreamcast.h"
-#elif defined(__MACOS__)
-#include "SDL_config_macos.h"
-#elif defined(__MACOSX__)
-#include "SDL_config_macosx.h"
-#elif defined(__WIN32__)
-#include "SDL_config_win32.h"
-#elif defined(__OS2__)
-#include "SDL_config_os2.h"
+/* C language features */
+/* #undef const */
+/* #undef inline */
+/* #undef volatile */
+
+/* C datatypes */
+/* #undef size_t */
+/* #undef int8_t */
+/* #undef uint8_t */
+/* #undef int16_t */
+/* #undef uint16_t */
+/* #undef int32_t */
+/* #undef uint32_t */
+/* #undef int64_t */
+/* #undef uint64_t */
+/* #undef uintptr_t */
+#define SDL_HAS_64BIT_TYPE 1
+
+/* Endianness */
+#define SDL_BYTEORDER 1234
+
+/* Comment this if you want to build without any C library requirements */
+#define HAVE_LIBC 1
+#if HAVE_LIBC
+
+/* Useful headers */
+#define HAVE_ALLOCA_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_STDIO_H 1
+#define STDC_HEADERS 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STDARG_H 1
+#define HAVE_MALLOC_H 1
+#define HAVE_MEMORY_H 1
+#define HAVE_STRING_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_MATH_H 1
+#define HAVE_ICONV_H 1
+#define HAVE_SIGNAL_H 1
+/* #undef HAVE_ALTIVEC_H */
+
+/* C library functions */
+#define HAVE_MALLOC 1
+#define HAVE_CALLOC 1
+#define HAVE_REALLOC 1
+#define HAVE_FREE 1
+#define HAVE_ALLOCA 1
+#ifndef _WIN32 /* Don't use C runtime versions of these on Windows */
+#define HAVE_GETENV 1
+#define HAVE_PUTENV 1
+#define HAVE_UNSETENV 1
+#endif
+#define HAVE_QSORT 1
+#define HAVE_ABS 1
+#define HAVE_BCOPY 1
+#define HAVE_MEMSET 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMCMP 1
+#define HAVE_STRLEN 1
+/* #undef HAVE_STRLCPY */
+/* #undef HAVE_STRLCAT */
+#define HAVE_STRDUP 1
+/* #undef HAVE__STRREV */
+/* #undef HAVE__STRUPR */
+/* #undef HAVE__STRLWR */
+/* #undef HAVE_INDEX */
+/* #undef HAVE_RINDEX */
+#define HAVE_STRCHR 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRSTR 1
+/* #undef HAVE_ITOA */
+/* #undef HAVE__LTOA */
+/* #undef HAVE__UITOA */
+/* #undef HAVE__ULTOA */
+#define HAVE_STRTOL 1
+#define HAVE_STRTOUL 1
+/* #undef HAVE__I64TOA */
+/* #undef HAVE__UI64TOA */
+#define HAVE_STRTOLL 1
+#define HAVE_STRTOULL 1
+#define HAVE_STRTOD 1
+#define HAVE_ATOI 1
+#define HAVE_ATOF 1
+#define HAVE_STRCMP 1
+#define HAVE_STRNCMP 1
+/* #undef HAVE__STRICMP */
+#define HAVE_STRCASECMP 1
+/* #undef HAVE__STRNICMP */
+#define HAVE_STRNCASECMP 1
+#define HAVE_SSCANF 1
+#define HAVE_SNPRINTF 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_ICONV 1
+#define HAVE_SIGACTION 1
+#define HAVE_SETJMP 1
+#define HAVE_NANOSLEEP 1
+/* #undef HAVE_CLOCK_GETTIME */
+#define HAVE_DLVSYM 1
+
 #else
-/* This is the minimal configuration that can be used to build SDL */
+/* We may need some replacement for stdarg.h here */
+#include <stdarg.h>
+#endif /* HAVE_LIBC */
 
-#include <stdarg.h>
+/* Allow disabling of core subsystems */
+/* #undef SDL_AUDIO_DISABLED */
+/* #undef SDL_CDROM_DISABLED */
+/* #undef SDL_CPUINFO_DISABLED */
+/* #undef SDL_EVENTS_DISABLED */
+/* #undef SDL_FILE_DISABLED */
+/* #undef SDL_JOYSTICK_DISABLED */
+/* #undef SDL_LOADSO_DISABLED */
+/* #undef SDL_THREADS_DISABLED */
+/* #undef SDL_TIMERS_DISABLED */
+/* #undef SDL_VIDEO_DISABLED */
 
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef unsigned int size_t;
-typedef unsigned long uintptr_t;
+/* Enable various audio drivers */
+/* #undef SDL_AUDIO_DRIVER_AHI */
+#define SDL_AUDIO_DRIVER_ALSA 1
+#define SDL_AUDIO_DRIVER_ALSA_DYNAMIC "libasound.so.2"
+/* #undef SDL_AUDIO_DRIVER_ARTS */
+/* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */
+/* #undef SDL_AUDIO_DRIVER_BAUDIO */
+/* #undef SDL_AUDIO_DRIVER_BSD */
+/* #undef SDL_AUDIO_DRIVER_COREAUDIO */
+/* #undef SDL_AUDIO_DRIVER_DART */
+/* #undef SDL_AUDIO_DRIVER_DC */
+#define SDL_AUDIO_DRIVER_DISK 1
+#define SDL_AUDIO_DRIVER_DUMMY 1
+/* #undef SDL_AUDIO_DRIVER_DMEDIA */
+/* #undef SDL_AUDIO_DRIVER_DSOUND */
+/* #undef SDL_AUDIO_DRIVER_ESD */
+/* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */
+/* #undef SDL_AUDIO_DRIVER_MINT */
+/* #undef SDL_AUDIO_DRIVER_MMEAUDIO */
+/* #undef SDL_AUDIO_DRIVER_NAS */
+#define SDL_AUDIO_DRIVER_OSS 1
+/* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */
+/* #undef SDL_AUDIO_DRIVER_PAUD */
+/* #undef SDL_AUDIO_DRIVER_QNXNTO */
+/* #undef SDL_AUDIO_DRIVER_SNDMGR */
+/* #undef SDL_AUDIO_DRIVER_SUNAUDIO */
+/* #undef SDL_AUDIO_DRIVER_WAVEOUT */
 
-/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
-#define SDL_AUDIO_DRIVER_DUMMY	1
+/* Enable various cdrom drivers */
+/* #undef SDL_CDROM_AIX */
+/* #undef SDL_CDROM_BEOS */
+/* #undef SDL_CDROM_BSDI */
+/* #undef SDL_CDROM_DC */
+/* #undef SDL_CDROM_DUMMY */
+/* #undef SDL_CDROM_FREEBSD */
+#define SDL_CDROM_LINUX 1
+/* #undef SDL_CDROM_MACOS */
+/* #undef SDL_CDROM_MACOSX */
+/* #undef SDL_CDROM_MINT */
+/* #undef SDL_CDROM_OPENBSD */
+/* #undef SDL_CDROM_OS2 */
+/* #undef SDL_CDROM_OSF */
+/* #undef SDL_CDROM_QNX */
+/* #undef SDL_CDROM_WIN32 */
 
-/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
-#define SDL_CDROM_DISABLED	1
+/* Enable various input drivers */
+/* #undef SDL_INPUT_TSLIB */
+/* #undef SDL_JOYSTICK_AMIGA */
+/* #undef SDL_JOYSTICK_BEOS */
+/* #undef SDL_JOYSTICK_DC */
+/* #undef SDL_JOYSTICK_DUMMY */
+/* #undef SDL_JOYSTICK_IOKIT */
+#define SDL_JOYSTICK_LINUX 1
+/* #undef SDL_JOYSTICK_LINUXEV */
+/* #undef SDL_JOYSTICK_MACOS */
+/* #undef SDL_JOYSTICK_MINT */
+/* #undef SDL_JOYSTICK_OS2 */
+/* #undef SDL_JOYSTICK_RISCOS */
+/* #undef SDL_JOYSTICK_WINMM */
+/* #undef SDL_JOYSTICK_USBHID */
+/* #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */
+
+/* Enable various shared object loading systems */
+/* #undef SDL_LOADSO_BEOS */
+/* #undef SDL_LOADSO_DLCOMPAT */
+#define SDL_LOADSO_DLOPEN 1
+/* #undef SDL_LOADSO_LDG */
+/* #undef SDL_LOADSO_MACOS */
+/* #undef SDL_LOADSO_OS2 */
+/* #undef SDL_LOADSO_WIN32 */
 
-/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
-#define SDL_JOYSTICK_DISABLED	1
+/* Enable various threading systems */
+/* #undef SDL_THREAD_AMIGA */
+/* #undef SDL_THREAD_BEOS */
+/* #undef SDL_THREAD_DC */
+/* #undef SDL_THREAD_EPOC */
+/* #undef SDL_THREAD_OS2 */
+/* #undef SDL_THREAD_PTH */
+#define SDL_THREAD_PTHREAD 1
+#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
+/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */
+/* #undef SDL_THREAD_SPROC */
+/* #undef SDL_THREAD_WIN32 */
 
-/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
-#define SDL_LOADSO_DISABLED	1
+/* Enable various timer systems */
+/* #undef SDL_TIMER_AMIGA */
+/* #undef SDL_TIMER_BEOS */
+/* #undef SDL_TIMER_DC */
+/* #undef SDL_TIMER_EPOC */
+/* #undef SDL_TIMER_MACOS */
+/* #undef SDL_TIMER_MINT */
+/* #undef SDL_TIMER_OS2 */
+/* #undef SDL_TIMER_RISCOS */
+#define SDL_TIMER_UNIX 1
+/* #undef SDL_TIMER_WIN32 */
+/* #undef SDL_TIMER_WINCE */
 
-/* Enable the stub thread support (src/thread/generic/\*.c) */
-#define SDL_THREADS_DISABLED	1
+/* Enable various video drivers */
+/* #undef SDL_VIDEO_DRIVER_AALIB */
+/* #undef SDL_VIDEO_DRIVER_BWINDOW */
+/* #undef SDL_VIDEO_DRIVER_CYBERGRAPHICS */
+/* #undef SDL_VIDEO_DRIVER_DC */
+/* #undef SDL_VIDEO_DRIVER_DDRAW */
+#define SDL_VIDEO_DRIVER_DGA 1
+/* #undef SDL_VIDEO_DRIVER_DIRECTFB */
+/* #undef SDL_VIDEO_DRIVER_DRAWSPROCKET */
+#define SDL_VIDEO_DRIVER_DUMMY 1
+/* #undef SDL_VIDEO_DRIVER_EPOC */
+#define SDL_VIDEO_DRIVER_FBCON 1
+/* #undef SDL_VIDEO_DRIVER_GAPI */
+/* #undef SDL_VIDEO_DRIVER_GEM */
+/* #undef SDL_VIDEO_DRIVER_GGI */
+/* #undef SDL_VIDEO_DRIVER_IPOD */
+/* #undef SDL_VIDEO_DRIVER_NANOX */
+/* #undef SDL_VIDEO_DRIVER_OS2FS */
+/* #undef SDL_VIDEO_DRIVER_PHOTON */
+/* #undef SDL_VIDEO_DRIVER_PICOGUI */
+/* #undef SDL_VIDEO_DRIVER_PS2GS */
+/* #undef SDL_VIDEO_DRIVER_QTOPIA */
+/* #undef SDL_VIDEO_DRIVER_QUARTZ */
+/* #undef SDL_VIDEO_DRIVER_RISCOS */
+/* #undef SDL_VIDEO_DRIVER_SVGALIB */
+/* #undef SDL_VIDEO_DRIVER_TOOLBOX */
+/* #undef SDL_VIDEO_DRIVER_VGL */
+/* #undef SDL_VIDEO_DRIVER_WINDIB */
+/* #undef SDL_VIDEO_DRIVER_WSCONS */
+#define SDL_VIDEO_DRIVER_X11 1
+#define SDL_VIDEO_DRIVER_X11_DGAMOUSE 1
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC "libX11.so.6"
+#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "libXext.so.6"
+#define SDL_VIDEO_DRIVER_X11_VIDMODE 1
+#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
+#define SDL_VIDEO_DRIVER_X11_XME 1
+#define SDL_VIDEO_DRIVER_X11_XV 1
+/* #undef SDL_VIDEO_DRIVER_XBIOS */
 
-/* Enable the stub timer support (src/timer/dummy/\*.c) */
-#define SDL_TIMERS_DISABLED	1
+/* Enable OpenGL support */
+#define SDL_VIDEO_OPENGL 1
+#define SDL_VIDEO_OPENGL_GLX 1
+/* #undef SDL_VIDEO_OPENGL_WGL */
+/* #undef SDL_VIDEO_OPENGL_OSMESA */
+/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */
 
-/* Enable the dummy video driver (src/video/dummy/\*.c) */
-#define SDL_VIDEO_DRIVER_DUMMY	1
-
-#endif /* platform config */
+/* Enable assembly routines */
+#define SDL_ASSEMBLY_ROUTINES 1
+/* #undef SDL_HERMES_BLITTERS */
+/* #undef SDL_ALTIVEC_BLITTERS */
 
 #endif /* _SDL_config_h */
--- a/src/.cvsignore	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/.cvsignore	Wed Mar 22 05:00:59 2006 +0000
@@ -4,3 +4,4 @@
 *.o
 *.lo
 *.la
+SDL_config.h
--- a/src/video/Xext/XME/xme.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/Xext/XME/xme.c	Wed Mar 22 05:00:59 2006 +0000
@@ -236,7 +236,7 @@
   xXiGMiscQueryVersionReply rep;
   XExtDisplayInfo *info = XiGMiscFindDisplay(dpy);
 
-  if (!pXQueryExtension(dpy, XIGMISC_PROTOCOL_NAME, &opcode, &event, &error))
+  if (!XQueryExtension(dpy, XIGMISC_PROTOCOL_NAME, &opcode, &event, &error))
     return xFalse;
 
   XiGMiscCheckExtension(dpy, info, xFalse);
@@ -247,7 +247,7 @@
   req->major = XIGMISC_MAJOR_VERSION;
   req->minor = XIGMISC_MINOR_VERSION;
 
-  if (!p_XReply (dpy, (xReply *)&rep, 0, xTrue)) {
+  if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) {
     UnlockDisplay(dpy);
     SyncHandle();
     return xFalse;
@@ -274,7 +274,7 @@
   XiGMiscGetReq (XiGMiscQueryViews, req, info);
   req->screen = screen;
 
-  if (!p_XReply (dpy, (xReply *)&rep, 0, xFalse)) {
+  if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) {
     UnlockDisplay(dpy);
     SyncHandle();
     return 0;
@@ -286,13 +286,13 @@
     size = sizeof(XiGMiscViewInfo) * n;
     views = (XiGMiscViewInfo*)Xmalloc(size);
     if (!views) {
-      p_XEatData(dpy, (unsigned long)size);
+      _XEatData(dpy, (unsigned long)size);
       UnlockDisplay(dpy);
       SyncHandle();
       return 0;
     }
 
-    p_XReadPad(dpy, (void*)views, size);
+    _XReadPad(dpy, (void*)views, size);
 
     *pviews = views;
   }
@@ -317,7 +317,7 @@
   req->screen = screen;
   req->view   = view;
 
-  if (!p_XReply (dpy, (xReply *)&rep, 0, xFalse)) {
+  if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) {
     UnlockDisplay(dpy);
     SyncHandle();
     return 0;
@@ -329,13 +329,13 @@
     size = sizeof(XiGMiscResolutionInfo) * n;
     resolutions = (XiGMiscResolutionInfo*)Xmalloc(size);
     if (!resolutions) {
-      p_XEatData(dpy, (unsigned long)size);
+      _XEatData(dpy, (unsigned long)size);
       UnlockDisplay(dpy);
       SyncHandle();
       return 0;
     }
 
-    p_XReadPad(dpy, (void*)resolutions, size);
+    _XReadPad(dpy, (void*)resolutions, size);
 
     *presolutions = resolutions;
     *pactive = rep.active;
@@ -383,7 +383,7 @@
   req->window = window;
   req->cmap = cmap;
 
-  if (!p_XReply (dpy, (xReply *)&rep, 0, xTrue)) {
+  if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) {
     UnlockDisplay(dpy);
     SyncHandle();
     return xFalse;
--- a/src/video/Xext/Xinerama/Xinerama.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/Xext/Xinerama/Xinerama.c	Wed Mar 22 05:00:59 2006 +0000
@@ -113,7 +113,7 @@
     req->panoramiXReqType = X_PanoramiXQueryVersion;
     req->clientMajor = PANORAMIX_MAJOR_VERSION;
     req->clientMinor = PANORAMIX_MINOR_VERSION;
-    if (!p_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
 	UnlockDisplay (dpy);
 	SyncHandle ();
 	return 0;
@@ -147,7 +147,7 @@
     req->reqType = info->codes->major_opcode;
     req->panoramiXReqType = X_PanoramiXGetState;
     req->window = drawable;
-    if (!p_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
 	UnlockDisplay (dpy);
 	SyncHandle ();
 	return 0;
@@ -176,7 +176,7 @@
     req->reqType = info->codes->major_opcode;
     req->panoramiXReqType = X_PanoramiXGetScreenCount;
     req->window = drawable;
-    if (!p_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
 	UnlockDisplay (dpy);
 	SyncHandle ();
 	return 0;
@@ -207,7 +207,7 @@
     req->panoramiXReqType = X_PanoramiXGetScreenSize;
     req->window = drawable;
     req->screen = screen_num;			/* need to define */ 
-    if (!p_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
 	UnlockDisplay (dpy);
 	SyncHandle ();
 	return 0;
@@ -287,7 +287,7 @@
     GetReq (XineramaQueryScreens, req);
     req->reqType = info->codes->major_opcode;
     req->panoramiXReqType = X_XineramaQueryScreens;
-    if (!p_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
 	UnlockDisplay (dpy);
 	SyncHandle ();
 	return NULL;
@@ -299,7 +299,7 @@
 	    int i;
 
 	    for(i = 0; i < rep.number; i++) {
-		p_XRead(dpy, (char*)(&scratch), sz_XineramaScreenInfo);
+		_XRead(dpy, (char*)(&scratch), sz_XineramaScreenInfo);
 		scrnInfo[i].screen_number = i;
 		scrnInfo[i].x_org 	  = scratch.x_org;
 		scrnInfo[i].y_org 	  = scratch.y_org;
@@ -309,7 +309,7 @@
 
 	    *number = rep.number;
 	} else
-	    p_XEatData(dpy, rep.length << 2);
+	    _XEatData(dpy, rep.length << 2);
     }
 
     UnlockDisplay (dpy);
--- a/src/video/Xext/Xv/Xv.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/Xext/Xv/Xv.c	Wed Mar 22 05:00:59 2006 +0000
@@ -121,7 +121,7 @@
 
   XvGetReq(QueryExtension, req);
 
-  if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+  if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
      UnlockDisplay(dpy);
      SyncHandle();
      return XvBadExtension;
@@ -171,7 +171,7 @@
 
   /* READ THE REPLY */
 
-  if (p_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
+  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
       UnlockDisplay(dpy);
       SyncHandle();
       return(XvBadReply);
@@ -183,7 +183,7 @@
       SyncHandle();
       return(XvBadAlloc);
   }
-  p_XRead (dpy, buffer, size);
+  _XRead (dpy, buffer, size);
 
   u.buffer = buffer;
 
@@ -330,7 +330,7 @@
 
   /* READ THE REPLY */
 
-  if (p_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
+  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
       UnlockDisplay(dpy);
       SyncHandle();
       return(XvBadReply);
@@ -342,7 +342,7 @@
       SyncHandle();
       return(XvBadAlloc);
   }
-  p_XRead (dpy, buffer, size);
+  _XRead (dpy, buffer, size);
 
   u.buffer = buffer;
 
@@ -617,7 +617,7 @@
   req->port = port;
   req->time = time;
 
-  if (p_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) 
+  if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) 
     rep.result = GrabSuccess;
 
   result = rep.result;
@@ -745,7 +745,7 @@
 
   /* READ THE REPLY */
 
-  if (p_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
+  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
       UnlockDisplay(dpy);
       SyncHandle();
       return(XvBadReply);
@@ -790,7 +790,7 @@
 
   /* READ THE REPLY */
 
-  if (p_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
+  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
       UnlockDisplay(dpy);
       SyncHandle();
       return(XvBadReply);
@@ -825,7 +825,7 @@
 
   /* READ THE REPLY */
 
-  if (p_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
+  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
       UnlockDisplay(dpy);
       SyncHandle();
       return ret;
@@ -840,17 +840,17 @@
 	  int i;
 	
 	  for(i = 0; i < rep.num_attributes; i++) {
-             p_XRead(dpy, (char*)(&Info), sz_xvAttributeInfo);
+             _XRead(dpy, (char*)(&Info), sz_xvAttributeInfo);
 	      ret[i].flags = (int)Info.flags;	      
 	      ret[i].min_value = Info.min;	      
 	      ret[i].max_value = Info.max;	      
 	      ret[i].name = marker;
-	      p_XRead(dpy, marker, Info.size);
+	      _XRead(dpy, marker, Info.size);
 	      marker += Info.size;
 	      (*num)++;
 	  }
       } else
-	p_XEatData(dpy, rep.length << 2);
+	_XEatData(dpy, rep.length << 2);
   }
 
   UnlockDisplay(dpy);
@@ -880,7 +880,7 @@
 
   /* READ THE REPLY */
 
-  if (p_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
+  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
       UnlockDisplay(dpy);
       SyncHandle();
       return NULL;
@@ -894,7 +894,7 @@
 	  int i;
 	
 	  for(i = 0; i < rep.num_formats; i++) {
-              p_XRead(dpy, (char*)(&Info), sz_xvImageFormatInfo);
+              _XRead(dpy, (char*)(&Info), sz_xvImageFormatInfo);
 	      ret[i].id = Info.id;	      
 	      ret[i].type = Info.type;	      
 	      ret[i].byte_order = Info.byte_order;	      
@@ -920,7 +920,7 @@
 	      (*num)++;
 	  }
       } else
-	p_XEatData(dpy, rep.length << 2);
+	_XEatData(dpy, rep.length << 2);
   }
 
   UnlockDisplay(dpy);
@@ -954,7 +954,7 @@
 
    /* READ THE REPLY */
 
-   if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+   if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
        UnlockDisplay(dpy);
        SyncHandle();
       return NULL;
@@ -970,10 +970,10 @@
 	ret->offsets = ret->pitches + rep.num_planes;
 	ret->data = data;
 	ret->obdata = NULL;
-  	p_XRead(dpy, (char*)(ret->pitches), rep.num_planes << 2);
-	p_XRead(dpy, (char*)(ret->offsets), rep.num_planes << 2);
+  	_XRead(dpy, (char*)(ret->pitches), rep.num_planes << 2);
+	_XRead(dpy, (char*)(ret->offsets), rep.num_planes << 2);
    } else
-	p_XEatData(dpy, rep.length << 2);
+	_XEatData(dpy, rep.length << 2);
 
    UnlockDisplay(dpy);
    SyncHandle();
@@ -1122,7 +1122,7 @@
     case XvVideoNotify:
       re->xvvideo.type = event->u.u.type & 0x7f;
       re->xvvideo.serial = 
-	p_XSetLastRequestRead(dpy, (xGenericReply *)event);
+	_XSetLastRequestRead(dpy, (xGenericReply *)event);
       re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0);
       re->xvvideo.display = dpy;
       re->xvvideo.time = event->u.videoNotify.time;
@@ -1133,7 +1133,7 @@
     case XvPortNotify:
       re->xvport.type = event->u.u.type & 0x7f;
       re->xvport.serial = 
-	p_XSetLastRequestRead(dpy, (xGenericReply *)event);
+	_XSetLastRequestRead(dpy, (xGenericReply *)event);
       re->xvport.send_event = ((event->u.u.type & 0x80) != 0);
       re->xvport.display = dpy;
       re->xvport.time = event->u.portNotify.time;
--- a/src/video/Xext/Xv/Xvlibint.h	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/Xext/Xv/Xvlibint.h	Wed Mar 22 05:00:59 2006 +0000
@@ -53,7 +53,7 @@
 #define XvGetReq(name, req) \
         WORD64ALIGN\
 	if ((dpy->bufptr + SIZEOF(xv##name##Req)) > dpy->bufmax)\
-		p_XFlush(dpy);\
+		_XFlush(dpy);\
 	req = (xv##name##Req *)(dpy->last_req = dpy->bufptr);\
 	req->reqType = info->codes->major_opcode;\
         req->xvReqType = xv_##name; \
@@ -65,7 +65,7 @@
 #define XvGetReq(name, req) \
         WORD64ALIGN\
 	if ((dpy->bufptr + SIZEOF(xv/**/name/**/Req)) > dpy->bufmax)\
-		p_XFlush(dpy);\
+		_XFlush(dpy);\
 	req = (xv/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
 	req->reqType = info->codes->major_opcode;\
 	req->xvReqType = xv_/**/name;\
--- a/src/video/Xext/Xxf86dga/XF86DGA.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/Xext/Xxf86dga/XF86DGA.c	Wed Mar 22 05:00:59 2006 +0000
@@ -114,7 +114,7 @@
     req->reqType = info->codes->major_opcode;
     req->dgaReqType = X_XF86DGAGetVideoLL;
     req->screen = screen;
-    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return False;
@@ -149,7 +149,7 @@
     req->enable = enable;
     UnlockDisplay(dpy);
     SyncHandle();
-    pXSync(dpy,False);
+    XSync(dpy,False);
     return True;
 }
 
@@ -170,7 +170,7 @@
     req->reqType = info->codes->major_opcode;
     req->dgaReqType = X_XF86DGAGetViewPortSize;
     req->screen = screen;
-    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return False;
@@ -205,7 +205,7 @@
     req->y = y;
     UnlockDisplay(dpy);
     SyncHandle();
-    pXSync(dpy,False);
+    XSync(dpy,False);
     return True;
 }
 
@@ -226,7 +226,7 @@
     req->reqType = info->codes->major_opcode;
     req->dgaReqType = X_XF86DGAGetVidPage;
     req->screen = screen;
-    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return False;
@@ -257,7 +257,7 @@
     req->vpage = vpage;
     UnlockDisplay(dpy);
     SyncHandle();
-    pXSync(dpy,False);
+    XSync(dpy,False);
     return True;
 }
 
@@ -279,7 +279,7 @@
     req->id = cmap;
     UnlockDisplay(dpy);
     SyncHandle();
-    pXSync(dpy,False);
+    XSync(dpy,False);
     return True;
 }
 
@@ -299,7 +299,7 @@
     req->reqType = info->codes->major_opcode;
     req->dgaReqType = X_XF86DGAQueryDirectVideo;
     req->screen = screen;
-    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return False;
@@ -327,7 +327,7 @@
     req->dgaReqType = X_XF86DGAViewPortChanged;
     req->screen = screen;
     req->n = n;
-    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return False;
@@ -600,7 +600,7 @@
 	for (i = 0; i < numScrs; i++) {
 	    sp = scrList[i];
 	    SDL_NAME(XF86DGADirectVideoLL)(sp->display, sp->screen, 0);
-	    pXSync(sp->display, False);
+	    XSync(sp->display, False);
 	}
         if (WIFEXITED(status))
 	    _exit(0);
@@ -660,7 +660,7 @@
     for (i = 0; i < numScrs; i++) {
 	sp = scrList[i];
 	SDL_NAME(XF86DGADirectVideo)(sp->display, sp->screen, 0);
-	pXSync(sp->display, False);
+	XSync(sp->display, False);
     }
     _exit(3);
 }
--- a/src/video/Xext/Xxf86dga/XF86DGA2.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/Xext/Xxf86dga/XF86DGA2.c	Wed Mar 22 05:00:59 2006 +0000
@@ -107,7 +107,7 @@
   case MotionNotify:
 	mevent = (SDL_NAME(XDGAMotionEvent)*)event;
 	mevent->type = wire->u.u.type & 0x7F;
-	mevent->serial = p_XSetLastRequestRead(dpy, (xGenericReply *)wire);
+	mevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
 	mevent->display = dpy;
 	mevent->screen = wire->u.event.screen;
 	mevent->time = wire->u.event.time;
@@ -119,7 +119,7 @@
   case ButtonRelease:
 	bevent = (SDL_NAME(XDGAButtonEvent)*)event;
 	bevent->type = wire->u.u.type & 0x7F;
-	bevent->serial = p_XSetLastRequestRead(dpy, (xGenericReply *)wire);
+	bevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
 	bevent->display = dpy;
 	bevent->screen = wire->u.event.screen;
 	bevent->time = wire->u.event.time;
@@ -130,7 +130,7 @@
   case KeyRelease:
 	kevent = (SDL_NAME(XDGAKeyEvent)*)event;
 	kevent->type = wire->u.u.type & 0x7F;
-	kevent->serial = p_XSetLastRequestRead(dpy, (xGenericReply *)wire);
+	kevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
 	kevent->display = dpy;
 	kevent->screen = wire->u.event.screen;
 	kevent->time = wire->u.event.time;
@@ -175,7 +175,7 @@
     GetReq(XDGAQueryVersion, req);
     req->reqType = info->codes->major_opcode;
     req->dgaReqType = X_XDGAQueryVersion;
-    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return False;
@@ -192,8 +192,8 @@
 	     i < XF86DGANumberEvents;
 	     i++, j++) 
 	{
-	    pXESetWireToEvent(dpy, j, xdga_wire_to_event);
-	    pXESetEventToWire(dpy, j, xdga_event_to_wire);
+	    XESetWireToEvent(dpy, j, xdga_wire_to_event);
+	    XESetEventToWire(dpy, j, xdga_event_to_wire);
 	}
 	SDL_NAME(XDGASetClientVersion)(dpy);
     }
@@ -236,7 +236,7 @@
     req->reqType = info->codes->major_opcode;
     req->dgaReqType = X_XDGAOpenFramebuffer;
     req->screen = screen;
-    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return False;
@@ -244,7 +244,7 @@
 
     if(rep.length) {
 	deviceName = Xmalloc(rep.length << 2);
-	p_XRead(dpy, deviceName, rep.length << 2);
+	_XRead(dpy, deviceName, rep.length << 2);
     }
 
     ret = SDL_NAME(XDGAMapFramebuffer)(screen, deviceName,
@@ -301,7 +301,7 @@
     req->dgaReqType = X_XDGAQueryModes;
     req->screen = screen;
 
-    if (p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	if(rep.length) {
 	   xXDGAModeInfo info;
 	   int i, size;
@@ -315,7 +315,7 @@
 
 	   if(modes) {	
 	      for(i = 0; i < rep.number; i++) {
-		p_XRead(dpy, (char*)(&info), sz_xXDGAModeInfo);
+		_XRead(dpy, (char*)(&info), sz_xXDGAModeInfo);
 
 		modes[i].num = info.num;
 		modes[i].verticalRefresh = 
@@ -343,13 +343,13 @@
 		modes[i].reserved1 = info.reserved1;
 		modes[i].reserved2 = info.reserved2;	
 
-		p_XRead(dpy, offset, info.name_size);
+		_XRead(dpy, offset, info.name_size);
 		modes[i].name = offset;
 		offset += info.name_size;
 	      }
 	      *num = rep.number;
 	   } else
-		p_XEatData(dpy, rep.length << 2);
+		_XEatData(dpy, rep.length << 2);
 	}
     }
 
@@ -382,7 +382,7 @@
     req->mode = mode;
     req->pid = pid = XAllocID(dpy);
     
-    if (p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	if(rep.length) {
 	   xXDGAModeInfo info;
 	   int size;
@@ -393,7 +393,7 @@
 	   dev = (SDL_NAME(XDGADevice)*)Xmalloc(sizeof(SDL_NAME(XDGADevice)) + size);
 	    
 	   if(dev) {
-		p_XRead(dpy, (char*)(&info), sz_xXDGAModeInfo);
+		_XRead(dpy, (char*)(&info), sz_xXDGAModeInfo);
 
 		dev->mode.num = info.num;
 		dev->mode.verticalRefresh = 
@@ -422,7 +422,7 @@
 		dev->mode.reserved2 = info.reserved2;
 
 		dev->mode.name = (char*)(&dev[1]);	
-		p_XRead(dpy, dev->mode.name, info.name_size);
+		_XRead(dpy, dev->mode.name, info.name_size);
 
 		dev->pixmap = (rep.flags & XDGAPixmap) ? pid : 0;
 		dev->data = SDL_NAME(XDGAGetMappedMemory)(screen);
@@ -613,7 +613,7 @@
     req->reqType = info->codes->major_opcode;
     req->dgaReqType = X_XDGAGetViewportStatus;
     req->screen = screen;
-    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse))
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse))
 	status = rep.status;
     UnlockDisplay(dpy);
     SyncHandle();
@@ -635,7 +635,7 @@
     req->reqType = info->codes->major_opcode;
     req->dgaReqType = X_XDGASync;
     req->screen = screen;
-    p_XReply(dpy, (xReply *)&rep, 0, xFalse);
+    _XReply(dpy, (xReply *)&rep, 0, xFalse);
     UnlockDisplay(dpy);
     SyncHandle();
 }
@@ -662,7 +662,7 @@
     req->x = *x;
     req->y = *y;
     req->flags = mode;
-    p_XReply(dpy, (xReply *)&rep, 0, xFalse);
+    _XReply(dpy, (xReply *)&rep, 0, xFalse);
     *x = rep.x;
     *y = rep.y;
     UnlockDisplay(dpy);
--- a/src/video/Xext/Xxf86vm/XF86VMode.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/Xext/Xxf86vm/XF86VMode.c	Wed Mar 22 05:00:59 2006 +0000
@@ -132,7 +132,7 @@
     GetReq(XF86VidModeQueryVersion, req);
     req->reqType = info->codes->major_opcode;
     req->xf86vidmodeReqType = X_XF86VidModeQueryVersion;
-    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return False;
@@ -200,7 +200,7 @@
     req->reqType = info->codes->major_opcode;
     req->xf86vidmodeReqType = X_XF86VidModeGetGamma;
     req->screen = screen;
-    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return False;
@@ -236,7 +236,7 @@
     req->screen = screen;
     
     if (majorVersion < 2) {
-	if (!p_XReply(dpy, (xReply *)&oldrep, 
+	if (!_XReply(dpy, (xReply *)&oldrep, 
             (SIZEOF(xXF86OldVidModeGetModeLineReply) - SIZEOF(xReply)) >> 2, xFalse)) {
 	    UnlockDisplay(dpy);
 	    SyncHandle();
@@ -255,7 +255,7 @@
 	modeline->flags      = oldrep.flags;
 	modeline->privsize   = oldrep.privsize;
     } else {
-	if (!p_XReply(dpy, (xReply *)&rep, 
+	if (!_XReply(dpy, (xReply *)&rep, 
             (SIZEOF(xXF86VidModeGetModeLineReply) - SIZEOF(xReply)) >> 2, xFalse)) {
 	    UnlockDisplay(dpy);
 	    SyncHandle();
@@ -277,11 +277,11 @@
     
     if (modeline->privsize > 0) {
 	if (!(modeline->private = Xcalloc(modeline->privsize, sizeof(INT32)))) {
-	    p_XEatData(dpy, (modeline->privsize) * sizeof(INT32));
+	    _XEatData(dpy, (modeline->privsize) * sizeof(INT32));
 	    Xfree(modeline->private);
 	    return False;
 	}
-	p_XRead(dpy, (char*)modeline->private, modeline->privsize * sizeof(INT32));
+	_XRead(dpy, (char*)modeline->private, modeline->privsize * sizeof(INT32));
     } else {
 	modeline->private = NULL;
     }
@@ -330,7 +330,7 @@
     req->reqType = info->codes->major_opcode;
     req->xf86vidmodeReqType = X_XF86VidModeGetAllModeLines;
     req->screen = screen;
-    if (!p_XReply(dpy, (xReply *)&rep, 
+    if (!_XReply(dpy, (xReply *)&rep, 
         (SIZEOF(xXF86VidModeGetAllModeLinesReply) - SIZEOF(xReply)) >> 2, xFalse)) {
         UnlockDisplay(dpy);
 	SyncHandle();
@@ -343,9 +343,9 @@
                                           sizeof(SDL_NAME(XF86VidModeModeInfo) *)
                                           +sizeof(SDL_NAME(XF86VidModeModeInfo))))) {
 	if (majorVersion < 2)
-            p_XEatData(dpy, (rep.modecount) * sizeof(xXF86OldVidModeModeInfo));
+            _XEatData(dpy, (rep.modecount) * sizeof(xXF86OldVidModeModeInfo));
 	else
-            p_XEatData(dpy, (rep.modecount) * sizeof(xXF86VidModeModeInfo));
+            _XEatData(dpy, (rep.modecount) * sizeof(xXF86VidModeModeInfo));
         Xfree(modelines);
         UnlockDisplay(dpy);
         SyncHandle();
@@ -359,7 +359,7 @@
     for (i = 0; i < rep.modecount; i++) {
         modelines[i] = mdinfptr++;
 	if (majorVersion < 2) {
-            p_XRead(dpy, (char*)&oldxmdline, sizeof(xXF86OldVidModeModeInfo));
+            _XRead(dpy, (char*)&oldxmdline, sizeof(xXF86OldVidModeModeInfo));
 	    modelines[i]->dotclock   = oldxmdline.dotclock;
 	    modelines[i]->hdisplay   = oldxmdline.hdisplay;
 	    modelines[i]->hsyncstart = oldxmdline.hsyncstart;
@@ -379,10 +379,10 @@
 		if (oldxmdline.privsize > 0) {
 	            if (!(modelines[i]->private =
 			    Xcalloc(oldxmdline.privsize, sizeof(INT32)))) {
-			p_XEatData(dpy, (oldxmdline.privsize) * sizeof(INT32));
+			_XEatData(dpy, (oldxmdline.privsize) * sizeof(INT32));
 			Xfree(modelines[i]->private);
 		    } else {
-			p_XRead(dpy, (char*)modelines[i]->private,
+			_XRead(dpy, (char*)modelines[i]->private,
 			     oldxmdline.privsize * sizeof(INT32));
 		    }
 		} else {
@@ -390,7 +390,7 @@
 		}
 	    }
 	} else {
-            p_XRead(dpy, (char*)&xmdline, sizeof(xXF86VidModeModeInfo));
+            _XRead(dpy, (char*)&xmdline, sizeof(xXF86VidModeModeInfo));
 	    modelines[i]->dotclock   = xmdline.dotclock;
 	    modelines[i]->hdisplay   = xmdline.hdisplay;
 	    modelines[i]->hsyncstart = xmdline.hsyncstart;
@@ -410,10 +410,10 @@
 		if (xmdline.privsize > 0) {
 		    if (!(modelines[i]->private =
 			    Xcalloc(xmdline.privsize, sizeof(INT32)))) {
-			p_XEatData(dpy, (xmdline.privsize) * sizeof(INT32));
+			_XEatData(dpy, (xmdline.privsize) * sizeof(INT32));
 			Xfree(modelines[i]->private);
 		    } else {
-			p_XRead(dpy, (char*)modelines[i]->private,
+			_XRead(dpy, (char*)modelines[i]->private,
 			     xmdline.privsize * sizeof(INT32));
 		    }
 		} else {
@@ -435,7 +435,7 @@
 #define GetOldReq(name, oldname, req) \
         WORD64ALIGN\
 	if ((dpy->bufptr + SIZEOF(x##oldname##Req)) > dpy->bufmax)\
-		p_XFlush(dpy);\
+		_XFlush(dpy);\
 	req = (x##oldname##Req *)(dpy->last_req = dpy->bufptr);\
 	req->reqType = X_##name;\
 	req->length = (SIZEOF(x##oldname##Req))>>2;\
@@ -446,7 +446,7 @@
 #define GetOldReq(name, oldname, req) \
         WORD64ALIGN\
 	if ((dpy->bufptr + SIZEOF(x/**/oldname/**/Req)) > dpy->bufmax)\
-		p_XFlush(dpy);\
+		_XFlush(dpy);\
 	req = (x/**/oldname/**/Req *)(dpy->last_req = dpy->bufptr);\
 	req->reqType = X_/**/name;\
 	req->length = (SIZEOF(x/**/oldname/**/Req))>>2;\
@@ -754,7 +754,7 @@
 	       modeline->privsize * sizeof(INT32));
 	}
     }
-    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return MODE_BAD;
@@ -916,7 +916,7 @@
     req->reqType = info->codes->major_opcode;
     req->xf86vidmodeReqType = X_XF86VidModeGetMonitor;
     req->screen = screen;
-    if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	UnlockDisplay(dpy);
 	SyncHandle();
 	return False;
@@ -928,7 +928,7 @@
 #endif
     if (rep.vendorLength) {
 	if (!(monitor->vendor = (char *)Xcalloc(rep.vendorLength + 1, 1))) {
-	    p_XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
+	    _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
 		      ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
             UnlockDisplay(dpy);
             SyncHandle();
@@ -939,7 +939,7 @@
     }
     if (rep.modelLength) {
 	if (!(monitor->model = Xcalloc(rep.modelLength + 1, 1))) {
-	    p_XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
+	    _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
 		      ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
 	    if (monitor->vendor)
 		Xfree(monitor->vendor);
@@ -951,7 +951,7 @@
 	monitor->model = NULL;
     }
     if (!(monitor->hsync = Xcalloc(rep.nhsync, sizeof(SDL_NAME(XF86VidModeSyncRange))))) {
-	p_XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
+	_XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
 		  ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
 	
 	if (monitor->vendor)
@@ -963,7 +963,7 @@
 	return False;
     }
     if (!(monitor->vsync = Xcalloc(rep.nvsync, sizeof(SDL_NAME(XF86VidModeSyncRange))))) {
-	p_XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
+	_XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
 		  ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
 	if (monitor->vendor)
 	    Xfree(monitor->vendor);
@@ -975,21 +975,21 @@
 	return False;
     }
     for (i = 0; i < rep.nhsync; i++) {
-	p_XRead(dpy, (char *)&syncrange, 4);
+	_XRead(dpy, (char *)&syncrange, 4);
 	monitor->hsync[i].lo = (float)(syncrange & 0xFFFF) / 100.0;
 	monitor->hsync[i].hi = (float)(syncrange >> 16) / 100.0;
     }
     for (i = 0; i < rep.nvsync; i++) {
-	p_XRead(dpy, (char *)&syncrange, 4);
+	_XRead(dpy, (char *)&syncrange, 4);
 	monitor->vsync[i].lo = (float)(syncrange & 0xFFFF) / 100.0;
 	monitor->vsync[i].hi = (float)(syncrange >> 16) / 100.0;
     }
     if (rep.vendorLength)
-	p_XReadPad(dpy, monitor->vendor, rep.vendorLength);
+	_XReadPad(dpy, monitor->vendor, rep.vendorLength);
     else
 	monitor->vendor = "";
     if (rep.modelLength)
-	p_XReadPad(dpy, monitor->model, rep.modelLength);
+	_XReadPad(dpy, monitor->model, rep.modelLength);
     else
 	monitor->model = "";
 	
@@ -1037,7 +1037,7 @@
 	*x = 0;
 	*y = 0;
     } else {
-	if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+	if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
 	    UnlockDisplay(dpy);
 	    SyncHandle();
 	    return False;
@@ -1095,7 +1095,7 @@
     req->reqType = info->codes->major_opcode;
     req->xf86vidmodeReqType = X_XF86VidModeGetDotClocks;
     req->screen = screen;
-    if (!p_XReply(dpy, (xReply *)&rep, 
+    if (!_XReply(dpy, (xReply *)&rep, 
         (SIZEOF(xXF86VidModeGetDotClocksReply) - SIZEOF(xReply)) >> 2, xFalse))
     {
         UnlockDisplay(dpy);
@@ -1107,7 +1107,7 @@
     *flagsPtr     = rep.flags;
 
     if (!(dotclocks = (int*) Xcalloc(rep.clocks, sizeof(int)))) {
-        p_XEatData(dpy, (rep.clocks) * 4);
+        _XEatData(dpy, (rep.clocks) * 4);
         Xfree(dotclocks);
         UnlockDisplay(dpy);
         SyncHandle();
@@ -1115,7 +1115,7 @@
     }
 
     for (i = 0; i < rep.clocks; i++) {
-        p_XRead(dpy, (char*)&dotclk, 4);
+        _XRead(dpy, (char*)&dotclk, 4);
 	dotclocks[i] = dotclk;
     }
     *clocksPtr = dotclocks;
@@ -1146,9 +1146,9 @@
     req->screen = screen;
     req->length += (length >> 1) * 3;
     req->size = size;
-    p_XSend(dpy, (char*)red, size * 2);
-    p_XSend(dpy, (char*)green, size * 2);
-    p_XSend(dpy, (char*)blue, size * 2);
+    _XSend(dpy, (char*)red, size * 2);
+    _XSend(dpy, (char*)green, size * 2);
+    _XSend(dpy, (char*)blue, size * 2);
     UnlockDisplay(dpy);
     SyncHandle();
     return True;
@@ -1177,15 +1177,15 @@
     req->xf86vidmodeReqType = X_XF86VidModeGetGammaRamp;
     req->screen = screen;
     req->size = size;
-    if (!p_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
         UnlockDisplay (dpy);
         SyncHandle ();
         return False;
     }
     if(rep.size) {
-	p_XRead(dpy, (char*)red, rep.size << 1);
-	p_XRead(dpy, (char*)green, rep.size << 1);
-	p_XRead(dpy, (char*)blue, rep.size << 1);
+	_XRead(dpy, (char*)red, rep.size << 1);
+	_XRead(dpy, (char*)green, rep.size << 1);
+	_XRead(dpy, (char*)blue, rep.size << 1);
     }
 
     UnlockDisplay(dpy);
@@ -1212,7 +1212,7 @@
     req->reqType = info->codes->major_opcode;
     req->xf86vidmodeReqType = X_XF86VidModeGetGammaRampSize;
     req->screen = screen;
-    if (!p_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
         UnlockDisplay (dpy);
         SyncHandle ();
         return False; 
--- a/src/video/Xext/extensions/extutil.h	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/Xext/extensions/extutil.h	Wed Mar 22 05:00:59 2006 +0000
@@ -175,9 +175,9 @@
 
 #define XextHasExtension(i) ((i) && ((i)->codes))
 #define XextCheckExtension(dpy,i,name,val) \
-  if (!XextHasExtension(i)) { pXMissingExtension (dpy, name); return val; }
+  if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; }
 #define XextSimpleCheckExtension(dpy,i,name) \
-  if (!XextHasExtension(i)) { pXMissingExtension (dpy, name); return; }
+  if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; }
 
 
 /*
@@ -190,9 +190,9 @@
 XExtDisplayInfo *proc (Display *dpy) \
 { \
     XExtDisplayInfo *dpyinfo; \
-    if (!extinfo) { if (!(extinfo = pXextCreateExtension())) return NULL; } \
-    if (!(dpyinfo = pXextFindDisplay (extinfo, dpy))) \
-      dpyinfo = pXextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \
+    if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \
+    if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \
+      dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \
     return dpyinfo; \
 }
 
@@ -202,7 +202,7 @@
 #define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \
 int proc (Display *dpy, XExtCodes *codes) \
 { \
-    return pXextRemoveDisplay (extinfo, dpy); \
+    return XextRemoveDisplay (extinfo, dpy); \
 }
 
 #define XEXT_CLOSE_DISPLAY_PROTO(proc) \
@@ -215,7 +215,7 @@
     if (code >= 0 && code < nerr) { \
 	char tmp[256]; \
 	SDL_snprintf (tmp, SDL_arraysize(tmp), "%s.%d", extname, code); \
-	pXGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \
+	XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \
 	return buf; \
     } \
     return (char *)0; \
--- a/src/video/dga/SDL_dgaevents.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/dga/SDL_dgaevents.c	Wed Mar 22 05:00:59 2006 +0000
@@ -45,7 +45,7 @@
 	int posted;
 	SDL_NAME(XDGAEvent) xevent;
 
-	pXNextEvent(DGA_Display, (XEvent *)&xevent);
+	XNextEvent(DGA_Display, (XEvent *)&xevent);
 
 	posted = 0;
 	xevent.type -= DGA_event_base;
@@ -96,7 +96,7 @@
 			static XComposeStatus state;
 			char keybuf[32];
 
-			if ( pXLookupString(&xkey, keybuf, sizeof(keybuf), NULL, &state) ) {
+			if ( XLookupString(&xkey, keybuf, sizeof(keybuf), NULL, &state) ) {
 				/*
 				* FIXME: XLookupString() may yield more than one
 				* character, so we need a mechanism to allow for
--- a/src/video/dga/SDL_dgavideo.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/dga/SDL_dgavideo.c	Wed Mar 22 05:00:59 2006 +0000
@@ -73,9 +73,9 @@
 	   and the DGA 2.0+ extension is available, and we can map mem.
 	*/
 	if ( SDL_X11_LoadSymbols() ) {
-		if ( (SDL_strncmp(pXDisplayName(display), ":", 1) == 0) ||
-		     (SDL_strncmp(pXDisplayName(display), "unix:", 5) == 0) ) {
-			dpy = pXOpenDisplay(display);
+		if ( (SDL_strncmp(XDisplayName(display), ":", 1) == 0) ||
+		     (SDL_strncmp(XDisplayName(display), "unix:", 5) == 0) ) {
+			dpy = XOpenDisplay(display);
 			if ( dpy ) {
 				int events, errors, major, minor;
 
@@ -90,7 +90,7 @@
 						SDL_NAME(XDGACloseFramebuffer)(dpy, screen);
 					}
 				}
-				pXCloseDisplay(dpy);
+				XCloseDisplay(dpy);
 			}
 		}
 		SDL_X11_UnloadSymbols();
@@ -329,7 +329,7 @@
 	/* Open the X11 display */
 	display = NULL;		/* Get it from DISPLAY environment variable */
 
-	DGA_Display = pXOpenDisplay(display);
+	DGA_Display = XOpenDisplay(display);
 	if ( DGA_Display == NULL ) {
 		SDL_SetError("Couldn't open X11 display");
 		return(-1);
@@ -339,12 +339,12 @@
 	if ( ! SDL_NAME(XDGAQueryExtension)(DGA_Display, &event_base, &error_base) ||
 	     ! SDL_NAME(XDGAQueryVersion)(DGA_Display, &major_version, &minor_version) ) {
 		SDL_SetError("DGA extension not available");
-		pXCloseDisplay(DGA_Display);
+		XCloseDisplay(DGA_Display);
 		return(-1);
 	}
 	if ( major_version < 2 ) {
 		SDL_SetError("DGA driver requires DGA 2.0 or newer");
-		pXCloseDisplay(DGA_Display);
+		XCloseDisplay(DGA_Display);
 		return(-1);
 	}
 	DGA_event_base = event_base;
@@ -360,10 +360,10 @@
 		int i, num_formats;
 
 		vformat->BitsPerPixel = DefaultDepth(DGA_Display, DGA_Screen);
-		pix_format = pXListPixmapFormats(DGA_Display, &num_formats);
+		pix_format = XListPixmapFormats(DGA_Display, &num_formats);
 		if ( pix_format == NULL ) {
 			SDL_SetError("Couldn't determine screen formats");
-			pXCloseDisplay(DGA_Display);
+			XCloseDisplay(DGA_Display);
 			return(-1);
 		}
 		for ( i=0; i<num_formats; ++i ) {
@@ -372,7 +372,7 @@
 		}
 		if ( i != num_formats )
 			vformat->BitsPerPixel = pix_format[i].bits_per_pixel;
-		pXFree((char *)pix_format);
+		XFree((char *)pix_format);
 	}
 	if ( vformat->BitsPerPixel > 8 ) {
 		vformat->Rmask = visual->red_mask;
@@ -383,7 +383,7 @@
 	/* Open access to the framebuffer */
 	if ( ! SDL_NAME(XDGAOpenFramebuffer)(DGA_Display, DGA_Screen) ) {
 		SDL_SetError("Unable to map the video memory");
-		pXCloseDisplay(DGA_Display);
+		XCloseDisplay(DGA_Display);
 		return(-1);
 	}
 
@@ -403,7 +403,7 @@
 		}
 	}
 	UpdateHWInfo(this, modes);
-	pXFree(modes);
+	XFree(modes);
 
 	/* Create the hardware surface lock mutex */
 	hw_lock = SDL_CreateMutex();
@@ -442,7 +442,7 @@
 
 	/* Free any previous colormap */
 	if ( DGA_colormap ) {
-		pXFreeColormap(DGA_Display, DGA_colormap);
+		XFreeColormap(DGA_Display, DGA_colormap);
 		DGA_colormap = 0;
 	}
 
@@ -473,7 +473,7 @@
 
 	/* Set the video mode */
 	mode = SDL_NAME(XDGASetMode)(DGA_Display, DGA_Screen, modes[i].num);
-	pXFree(modes);
+	XFree(modes);
 	if ( mode == NULL ) {
 		SDL_SetError("Unable to switch to requested mode");
 		return(NULL);
@@ -821,7 +821,7 @@
 #endif
 	SDL_NAME(XDGAFillRectangle)(DGA_Display, DGA_Screen, x, y, w, h, color);
 	if ( !(this->screen->flags & SDL_DOUBLEBUF) ) {
-		pXFlush(DGA_Display);
+		XFlush(DGA_Display);
 	}
 	DGA_AddBusySurface(dst);
 	UNLOCK_DISPLAY();
@@ -863,7 +863,7 @@
 			srcx, srcy, w, h, dstx, dsty);
 	}
 	if ( !(this->screen->flags & SDL_DOUBLEBUF) ) {
-		pXFlush(DGA_Display);
+		XFlush(DGA_Display);
 	}
 	DGA_AddBusySurface(src);
 	DGA_AddBusySurface(dst);
@@ -943,7 +943,7 @@
 	DGA_WaitFlip(this);
 	SDL_NAME(XDGASetViewport)(DGA_Display, DGA_Screen,
 	                0, flip_yoffset[flip_page], XDGAFlipRetrace);
-	pXFlush(DGA_Display);
+	XFlush(DGA_Display);
 	UNLOCK_DISPLAY();
 	was_flipped = 1;
 	flip_page = !flip_page;
@@ -976,8 +976,8 @@
 		xcmap[i].flags = (DoRed|DoGreen|DoBlue);
 	}
 	LOCK_DISPLAY();
-	pXStoreColors(DGA_Display, DGA_colormap, xcmap, ncolors);
-	pXSync(DGA_Display, False);
+	XStoreColors(DGA_Display, DGA_colormap, xcmap, ncolors);
+	XSync(DGA_Display, False);
 	UNLOCK_DISPLAY();
 	SDL_stack_free(xcmap);
 
@@ -1011,8 +1011,8 @@
 		xcmap[i].flags = (DoRed|DoGreen|DoBlue);
 	}
 	LOCK_DISPLAY();
-	pXStoreColors(DGA_Display, DGA_colormap, xcmap, ncolors);
-	pXSync(DGA_Display, False);
+	XStoreColors(DGA_Display, DGA_colormap, xcmap, ncolors);
+	XSync(DGA_Display, False);
 	UNLOCK_DISPLAY();
 	return(0);
 }
@@ -1024,7 +1024,7 @@
 	if ( DGA_Display ) {
 		/* Free colormap, if necessary */
 		if ( DGA_colormap ) {
-			pXFreeColormap(DGA_Display, DGA_colormap);
+			XFreeColormap(DGA_Display, DGA_colormap);
 			DGA_colormap = 0;
 		}
 
@@ -1064,6 +1064,6 @@
 		DGA_FreeHWSurfaces(this);
 
 		/* Close up the display */
-		pXCloseDisplay(DGA_Display);
+		XCloseDisplay(DGA_Display);
 	}
 }
--- a/src/video/x11/SDL_x11dyn.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/x11/SDL_x11dyn.c	Wed Mar 22 05:00:59 2006 +0000
@@ -21,11 +21,10 @@
 */
 #include "SDL_config.h"
 
-#if 0
+#if 1
 #define DEBUG_DYNAMIC_X11 1
 #endif
 
-#define __SDL_NO_REDEFINE_X11_HEADER_SYMS 1
 #include "SDL_x11dyn.h"
 
 #ifdef DEBUG_DYNAMIC_X11
@@ -41,51 +40,88 @@
 static const char *x11ext_library = SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT;
 static void *x11ext_handle = NULL;
 
-static void *X11_GetSym(int required, const char *fnname, int *rc)
+typedef struct
 {
+    void *lib;
+    const char *libname;
+} x11libitem;
+
+static void *X11_GetSym(const char *fnname, int *rc)
+{
+	int i;
 	void *fn = NULL;
-	if (*rc) {  /* haven't already failed on a previous lookup? */
-		fn = SDL_LoadFunction(x11_handle, fnname);
-		#if DEBUG_DYNAMIC_X11
-		if (fn != NULL)
-			printf("X11: Found '%s' in libX11 (%p)\n", fnname, fn);
-		#endif
+	const x11libitem libs[] =
+	{
+		{ x11_handle, "libX11" },
+		{ x11ext_handle, "libX11ext" },
+	};
 
-		if (fn == NULL) {  /* not found? Check libX11ext ... */
-			fn = SDL_LoadFunction(x11ext_handle, fnname);
-			#if DEBUG_DYNAMIC_X11
+	for (i = 0; i < (sizeof (libs) / sizeof (libs[0])); i++)
+	{
+		if (libs[i].lib != NULL)
+		{
+			fn = SDL_LoadFunction(libs[i].lib, fnname);
 			if (fn != NULL)
-				printf("X11: Found '%s' in libXext (%p)\n", fnname, fn);
-			else
-				printf("X11: Symbol '%s' NOT FOUND!%s\n", fnname,
-				       required ? "" : " (...but not required!)");
-			#endif
+				break;
 		}
-		*rc = ((fn != NULL) || (!required));
 	}
 
+	#if DEBUG_DYNAMIC_X11
+	if (fn != NULL)
+	    printf("X11: Found '%s' in %s (%p)\n", fnname, libs[i].libname, fn);
+	else
+		printf("X11: Symbol '%s' NOT FOUND!\n", fnname);
+	#endif
+
+	if (fn == NULL)
+		*rc = 0;  /* kill this module. */
+
 	return fn;
 }
+
+
+/* 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 */
 
-/* Define all the function pointers... */
-#define SDL_X11_SYM(req,ret,fn,params) ret (*p##fn) params = NULL;
+/* 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) {
 			/* set all the function pointers to NULL. */
-			#define SDL_X11_SYM(req,ret,fn,params) p##fn = 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 SDL_VIDEO_DRIVER_X11_DYNAMIC
+            #ifdef X_HAVE_UTF8_STRING
+            pXCreateIC = NULL;
+            #endif
+
 			if (x11_handle != NULL) {
 				SDL_UnloadObject(x11_handle);
 				x11_handle = NULL;
@@ -94,35 +130,41 @@
 				SDL_UnloadObject(x11ext_handle);
 				x11ext_handle = NULL;
 			}
-			#endif
 		}
 	}
+	#endif
 }
 
 /* returns non-zero if all needed symbols were loaded. */
 int SDL_X11_LoadSymbols(void)
 {
-	int rc = 1;
+	int rc = 1;  /* always succeed if not using Dynamic X11 stuff. */
 
-    /* deal with multiple modules (dga, x11, etc) needing these symbols... */
+	#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
+	/* deal with multiple modules (dga, x11, etc) needing these symbols... */
 	if (x11_load_refcount++ == 0) {
-		#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
-			x11_handle = SDL_LoadObject(x11_library);
-			x11ext_handle = SDL_LoadObject(x11ext_library);
-			rc = ((x11_handle != NULL) && (x11ext_handle != NULL));
-			#define SDL_X11_SYM(req,r,fn,arg) p##fn = X11_GetSym(req,#fn, &rc);
-			#include "SDL_x11sym.h"
-			#undef SDL_X11_SYM
+		int *thismod = NULL;
+		x11_handle = SDL_LoadObject(x11_library);
+		x11ext_handle = SDL_LoadObject(x11ext_library);
+		#define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname;
+		#define SDL_X11_SYM(a,fn,x,y,z) p##fn = X11_GetSym(#fn,thismod);
+		#include "SDL_x11sym.h"
+		#undef SDL_X11_MODULE
+		#undef SDL_X11_SYM
 
-			if (!rc)
-				SDL_X11_UnloadSymbols();  /* in case one of these loaded... */
+		#ifdef X_HAVE_UTF8_STRING
+		pXCreateIC = X11_GetSym("XCreateIC",&SDL_X11_HAVE_UTF8);
+		#endif
 
-		#else
-			#define SDL_X11_SYM(req,r,fn,arg) p##fn = fn;
-			#include "SDL_x11sym.h"
-			#undef SDL_X11_SYM
+		if (!SDL_X11_HAVE_BASEXLIB) {  /* some required symbol didn't load. */
+			SDL_X11_UnloadSymbols();  /* in case something got loaded... */
+		}
+	}
+	#else
+		#ifdef X_HAVE_UTF8_STRING
+		pXCreateIC = XCreateIC;
 		#endif
-	}
+	#endif
 
 	return rc;
 }
--- a/src/video/x11/SDL_x11dyn.h	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/x11/SDL_x11dyn.h	Wed Mar 22 05:00:59 2006 +0000
@@ -39,59 +39,40 @@
 #endif
 
 /*
- * Never reference Xlib directly...we might load it dynamically at runtime.
- *  Even if we don't, for readability, we still use the function pointers
- *  (although the symbol resolution will be done by the loader in that case).
+ * 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.
  *
- * We define SDL_X11_SYM and include SDL_x11sym.h to accomplish various
- *  goals, without having to duplicate those function signatures.
+ * 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
 
-#ifdef __osf__
-extern int _XData32(Display *,register long *,unsigned);
-extern void _XRead32(Display *,register long *,long);
-extern void _SmtBufferOverflow(Display *,register smtDisplayPtr);
-extern void _SmtIpError(Display *,register smtDisplayPtr, int);
-extern int ipAllocateData(ChannelPtr, IPCard, IPDataPtr *);
-extern int ipUnallocateAndSendData(ChannelPtr, IPCard);
-#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*);
 typedef int (*SDL_X11_XSetExtensionErrorHandlerType)(Display *,char *,char *);
 
-#define SDL_X11_SYM(req,ret,fn,params) extern ret (*p##fn) params;
+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
 
-/* Macro in the xlib headers, not an actual symbol... */
-#define pXDestroyImage XDestroyImage
-
-/* Workaround code in headers... */
-#if !__SDL_NO_REDEFINE_X11_HEADER_SYMS
-#define _XFlush p_XFlush
-#define _XFlushGCCache p_XFlushGCCache
-#define _XReply p_XReply
-#define _XSend p_XSend
-#define XFree pXFree
-#define _XData32 p_XData32
-
-#if defined(__osf__)
-#define _SmtBufferOverflow p_SmtBufferOverflow
-#define _SmtIpError p_SmtIpError
-#define ipAllocateData pipAllocateData
-#define ipUnallocateAndSendData pipUnallocateAndSendData
-#endif
-
-#endif /* !__SDL_NO_REDEFINE_X11_HEADER_SYMS */
-
-int SDL_X11_LoadSymbols(void);
-void SDL_X11_UnloadSymbols(void);
 
 #ifdef __cplusplus
 }
--- a/src/video/x11/SDL_x11events.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/x11/SDL_x11events.c	Wed Mar 22 05:00:59 2006 +0000
@@ -187,13 +187,13 @@
 	int repeated;
 
 	repeated = 0;
-	if ( pXPending(display) ) {
-		pXPeekEvent(display, &peekevent);
+	if ( XPending(display) ) {
+		XPeekEvent(display, &peekevent);
 		if ( (peekevent.type == KeyPress) &&
 		     (peekevent.xkey.keycode == event->xkey.keycode) &&
 		     ((peekevent.xkey.time-event->xkey.time) < 2) ) {
 			repeated = 1;
-			pXNextEvent(display, &peekevent);
+			XNextEvent(display, &peekevent);
 		}
 	}
 	return(repeated);
@@ -228,7 +228,7 @@
 	     (xevent->xmotion.y < MOUSE_FUDGE_FACTOR) ||
 	     (xevent->xmotion.y > (h-MOUSE_FUDGE_FACTOR)) ) {
 		/* Get the events that have accumulated */
-		while ( pXCheckTypedEvent(SDL_Display, MotionNotify, xevent) ) {
+		while ( XCheckTypedEvent(SDL_Display, MotionNotify, xevent) ) {
 			deltax = xevent->xmotion.x - mouse_last.x;
 			deltay = xevent->xmotion.y - mouse_last.y;
 #ifdef DEBUG_MOTION
@@ -240,10 +240,10 @@
 		}
 		mouse_last.x = w/2;
 		mouse_last.y = h/2;
-		pXWarpPointer(SDL_Display, None, SDL_Window, 0, 0, 0, 0,
+		XWarpPointer(SDL_Display, None, SDL_Window, 0, 0, 0, 0,
 					mouse_last.x, mouse_last.y);
 		for ( i=0; i<10; ++i ) {
-        		pXMaskEvent(SDL_Display, PointerMotionMask, xevent);
+        		XMaskEvent(SDL_Display, PointerMotionMask, xevent);
 			if ( (xevent->xmotion.x >
 			          (mouse_last.x-MOUSE_FUDGE_FACTOR)) &&
 			     (xevent->xmotion.x <
@@ -273,7 +273,7 @@
 	XEvent xevent;
 
 	SDL_memset(&xevent, '\0', sizeof (XEvent));  /* valgrind fix. --ryan. */
-	pXNextEvent(SDL_Display, &xevent);
+	XNextEvent(SDL_Display, &xevent);
 
 	posted = 0;
 	switch (xevent.type) {
@@ -332,7 +332,7 @@
 
 #ifdef X_HAVE_UTF8_STRING
 		if ( SDL_IC != NULL ) {
-			pXSetICFocus(SDL_IC);
+			XSetICFocus(SDL_IC);
 		}
 #endif
 		/* Queue entry into fullscreen mode */
@@ -350,7 +350,7 @@
 
 #ifdef X_HAVE_UTF8_STRING
 		if ( SDL_IC != NULL ) {
-			pXUnsetICFocus(SDL_IC);
+			XUnsetICFocus(SDL_IC);
 		}
 #endif
 		/* Queue leaving fullscreen mode */
@@ -433,7 +433,7 @@
 			break;
 		}
 
-		if ( pXFilterEvent(&xevent, None) ) {
+		if ( XFilterEvent(&xevent, None) ) {
 			if ( xevent.xkey.keycode ) {
 				posted = SDL_PrivateKeyboard(SDL_PRESSED, &keysym);
 			} else {
@@ -450,7 +450,7 @@
 			static Status state;
 			/* A UTF-8 character can be at most 6 bytes */
 			char keybuf[6];
-			if ( pXutf8LookupString(SDL_IC, &xevent.xkey,
+			if ( Xutf8LookupString(SDL_IC, &xevent.xkey,
 			                        keybuf, sizeof(keybuf),
 			                        NULL, &state) ) {
 				keysym.unicode = Utf8ToUcs4((Uint8*)keybuf);
@@ -462,7 +462,7 @@
 			static XComposeStatus state;
 			char keybuf[32];
 
-			if ( pXLookupString(&xevent.xkey,
+			if ( XLookupString(&xevent.xkey,
 			                    keybuf, sizeof(keybuf),
 			                    NULL, &state) ) {
 				/*
@@ -622,8 +622,8 @@
 int X11_Pending(Display *display)
 {
 	/* Flush the display connection and look to see if events are queued */
-	pXFlush(display);
-	if ( pXEventsQueued(display, QueuedAlready) ) {
+	XFlush(display);
+	if ( XEventsQueued(display, QueuedAlready) ) {
 		return(1);
 	}
 
@@ -637,7 +637,7 @@
 		FD_ZERO(&fdset);
 		FD_SET(x11_fd, &fdset);
 		if ( select(x11_fd+1, &fdset, NULL, NULL, &zero_time) == 1 ) {
-			return(pXPending(display));
+			return(XPending(display));
 		}
 	}
 
@@ -827,7 +827,7 @@
 	KeySym xsym;
 	SDLKey key;
 
-	xsym = pXKeycodeToKeysym(display, kc, 0);
+	xsym = XKeycodeToKeysym(display, kc, 0);
 #ifdef DEBUG_KEYS
 	fprintf(stderr, "Translating key code %d -> 0x%.4x\n", kc, xsym);
 #endif
@@ -914,12 +914,12 @@
 	if(got_masks)
 		return;
 
-	xmods = pXGetModifierMapping(display);
+	xmods = XGetModifierMapping(display);
 	n = xmods->max_keypermod;
 	for(i = 3; i < 8; i++) {
 		for(j = 0; j < n; j++) {
 			KeyCode kc = xmods->modifiermap[i * n + j];
-			KeySym ks = pXKeycodeToKeysym(display, kc, 0);
+			KeySym ks = XKeycodeToKeysym(display, kc, 0);
 			unsigned mask = 1 << i;
 			switch(ks) {
 			case XK_Num_Lock:
@@ -937,7 +937,7 @@
 			}
 		}
 	}
-	pXFreeModifiermap(xmods);
+	XFreeModifiermap(xmods);
 	got_masks = 1;
 }
 
@@ -979,7 +979,7 @@
 		}
 	}
 
-	xkey.keycode = pXKeysymToKeycode(xkey.display, xsym);
+	xkey.keycode = XKeysymToKeycode(xkey.display, xsym);
 
 	get_modifier_masks(SDL_Display);
 	if(modifiers & KMOD_SHIFT)
@@ -1002,7 +1002,7 @@
 		xkey.state |= num_mask;
 
 	unicode = 0;
-	if ( pXLookupString(&xkey, keybuf, sizeof(keybuf), NULL, NULL) )
+	if ( XLookupString(&xkey, keybuf, sizeof(keybuf), NULL, NULL) )
 		unicode = (unsigned char)keybuf[0];
 	return(unicode);
 }
@@ -1025,14 +1025,14 @@
 
 	/* The first time the window is mapped, we initialize key state */
 	if ( ! key_vec ) {
-		pXQueryKeymap(display, keys_return);
+		XQueryKeymap(display, keys_return);
 		key_vec = keys_return;
 	}
 
 	/* Get the keyboard modifier state */
 	modstate = 0;
 	get_modifier_masks(display);
-	if ( pXQueryPointer(display, DefaultRootWindow(display),
+	if ( XQueryPointer(display, DefaultRootWindow(display),
 		&junk_window, &junk_window, &x, &y, &x, &y, &mask) ) {
 		if ( mask & LockMask ) {
 			modstate |= KMOD_CAPS;
--- a/src/video/x11/SDL_x11gamma.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/x11/SDL_x11gamma.c	Wed Mar 22 05:00:59 2006 +0000
@@ -64,7 +64,7 @@
 	}
         if ( SDL_GetAppState() & SDL_APPACTIVE ) {
             succeeded = SDL_NAME(XF86VidModeSetGamma)(SDL_Display, SDL_Screen, &gamma);
-            pXSync(SDL_Display, False);
+            XSync(SDL_Display, False);
         } else {
             gamma_saved[0] = gamma.red;
             gamma_saved[1] = gamma.green;
--- a/src/video/x11/SDL_x11gl.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/x11/SDL_x11gl.c	Wed Mar 22 05:00:59 2006 +0000
@@ -64,10 +64,10 @@
 		XVisualInfo vi_in;
 		int out_count;
 
-		pXGetWindowAttributes(SDL_Display, SDL_Window, &a);
+		XGetWindowAttributes(SDL_Display, SDL_Window, &a);
 		vi_in.screen = SDL_Screen;
-		vi_in.visualid = pXVisualIDFromVisual(a.visual);
-		glx_visualinfo = pXGetVisualInfo(SDL_Display,
+		vi_in.visualid = XVisualIDFromVisual(a.visual);
+		glx_visualinfo = XGetVisualInfo(SDL_Display,
 	                     VisualScreenMask|VisualIDMask, &vi_in, &out_count);
 		return glx_visualinfo;
 	}
@@ -186,7 +186,7 @@
 	attributes.colormap = SDL_XColorMap;
 	mask = CWBackPixel | CWBorderPixel | CWColormap;
 
-	SDL_Window = pXCreateWindow(SDL_Display, WMwindow,
+	SDL_Window = XCreateWindow(SDL_Display, WMwindow,
 			0, 0, w, h, 0, glx_visualinfo->depth,
 			InputOutput, glx_visualinfo->visual,
 			mask, &attributes);
@@ -207,10 +207,10 @@
 	int retval;
 #if SDL_VIDEO_OPENGL_GLX
 	/* We do this to create a clean separation between X and GLX errors. */
-	pXSync( SDL_Display, False );
+	XSync( SDL_Display, False );
 	glx_context = this->gl_data->glXCreateContext(GFX_Display, 
 				     glx_visualinfo, NULL, True);
-	pXSync( GFX_Display, False );
+	XSync( GFX_Display, False );
 
 	if (glx_context == NULL) {
 		SDL_SetError("Could not create GL context");
@@ -258,7 +258,7 @@
 		SDL_SetError("Unable to make GL context current");
 		retval = -1;
 	}
-	pXSync( GFX_Display, False );
+	XSync( GFX_Display, False );
 
 	/* More Voodoo X server workarounds... Grr... */
 	SDL_Lock_EventThread();
--- a/src/video/x11/SDL_x11image.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/x11/SDL_x11image.c	Wed Mar 22 05:00:59 2006 +0000
@@ -44,6 +44,10 @@
 
 static void try_mitshm(_THIS, SDL_Surface *screen)
 {
+	/* Dynamic X11 may not have SHM entry points on this box. */
+	if ((use_mitshm) && (!SDL_X11_HAVE_SHM))
+		use_mitshm = 0;
+
 	if(!use_mitshm)
 		return;
 	shminfo.shmid = shmget(IPC_PRIVATE, screen->h*screen->pitch,
@@ -53,10 +57,10 @@
 		shminfo.readOnly = False;
 		if ( shminfo.shmaddr != (char *)-1 ) {
 			shm_error = False;
-			X_handler = pXSetErrorHandler(shm_errhandler);
-			pXShmAttach(SDL_Display, &shminfo);
-			pXSync(SDL_Display, True);
-			pXSetErrorHandler(X_handler);
+			X_handler = XSetErrorHandler(shm_errhandler);
+			XShmAttach(SDL_Display, &shminfo);
+			XSync(SDL_Display, True);
+			XSetErrorHandler(X_handler);
 			if ( shm_error )
 				shmdt(shminfo.shmaddr);
 		} else {
@@ -82,13 +86,13 @@
 #ifndef NO_SHARED_MEMORY
 	try_mitshm(this, screen);
 	if(use_mitshm) {
-		SDL_Ximage = pXShmCreateImage(SDL_Display, SDL_Visual,
+		SDL_Ximage = XShmCreateImage(SDL_Display, SDL_Visual,
 					     this->hidden->depth, ZPixmap,
 					     shminfo.shmaddr, &shminfo, 
 					     screen->w, screen->h);
 		if(!SDL_Ximage) {
-			pXShmDetach(SDL_Display, &shminfo);
-			pXSync(SDL_Display, False);
+			XShmDetach(SDL_Display, &shminfo);
+			XSync(SDL_Display, False);
 			shmdt(shminfo.shmaddr);
 			screen->pixels = NULL;
 			goto error;
@@ -105,7 +109,7 @@
 			return -1;
 		}
  	        bpp = screen->format->BytesPerPixel;
-		SDL_Ximage = pXCreateImage(SDL_Display, SDL_Visual,
+		SDL_Ximage = XCreateImage(SDL_Display, SDL_Visual,
 					  this->hidden->depth, ZPixmap, 0,
 					  (char *)screen->pixels, 
 					  screen->w, screen->h,
@@ -128,11 +132,11 @@
 void X11_DestroyImage(_THIS, SDL_Surface *screen)
 {
 	if ( SDL_Ximage ) {
-		pXDestroyImage(SDL_Ximage);
+		XDestroyImage(SDL_Ximage);
 #ifndef NO_SHARED_MEMORY
 		if ( use_mitshm ) {
-			pXShmDetach(SDL_Display, &shminfo);
-			pXSync(SDL_Display, False);
+			XShmDetach(SDL_Display, &shminfo);
+			XSync(SDL_Display, False);
 			shmdt(shminfo.shmaddr);
 		}
 #endif /* ! NO_SHARED_MEMORY */
@@ -213,7 +217,7 @@
 int X11_LockHWSurface(_THIS, SDL_Surface *surface)
 {
 	if ( (surface == SDL_VideoSurface) && blit_queued ) {
-		pXSync(GFX_Display, False);
+		XSync(GFX_Display, False);
 		blit_queued = 0;
 	}
 	return(0);
@@ -236,15 +240,15 @@
 		if ( rects[i].w == 0 || rects[i].h == 0 ) { /* Clipped? */
 			continue;
 		}
-		pXPutImage(GFX_Display, SDL_Window, SDL_GC, SDL_Ximage,
+		XPutImage(GFX_Display, SDL_Window, SDL_GC, SDL_Ximage,
 			  rects[i].x, rects[i].y,
 			  rects[i].x, rects[i].y, rects[i].w, rects[i].h);
 	}
 	if ( SDL_VideoSurface->flags & SDL_ASYNCBLIT ) {
-		pXFlush(GFX_Display);
+		XFlush(GFX_Display);
 		blit_queued = 1;
 	} else {
-		pXSync(GFX_Display, False);
+		XSync(GFX_Display, False);
 	}
 }
 
@@ -257,16 +261,16 @@
 		if ( rects[i].w == 0 || rects[i].h == 0 ) { /* Clipped? */
 			continue;
 		}
-		pXShmPutImage(GFX_Display, SDL_Window, SDL_GC, SDL_Ximage,
+		XShmPutImage(GFX_Display, SDL_Window, SDL_GC, SDL_Ximage,
 				rects[i].x, rects[i].y,
 				rects[i].x, rects[i].y, rects[i].w, rects[i].h,
 									False);
 	}
 	if ( SDL_VideoSurface->flags & SDL_ASYNCBLIT ) {
-		pXFlush(GFX_Display);
+		XFlush(GFX_Display);
 		blit_queued = 1;
 	} else {
-		pXSync(GFX_Display, False);
+		XSync(GFX_Display, False);
 	}
 #endif /* ! NO_SHARED_MEMORY */
 }
@@ -300,14 +304,15 @@
 	}
 #ifndef NO_SHARED_MEMORY
 	if ( this->UpdateRects == X11_MITSHMUpdate ) {
-		pXShmPutImage(SDL_Display, SDL_Window, SDL_GC, SDL_Ximage,
+		XShmPutImage(SDL_Display, SDL_Window, SDL_GC, SDL_Ximage,
 				0, 0, 0, 0, this->screen->w, this->screen->h,
 				False);
 	} else
 #endif /* ! NO_SHARED_MEMORY */
 	{
-		pXPutImage(SDL_Display, SDL_Window, SDL_GC, SDL_Ximage,
+		XPutImage(SDL_Display, SDL_Window, SDL_GC, SDL_Ximage,
 			  0, 0, 0, 0, this->screen->w, this->screen->h);
 	}
-	pXSync(SDL_Display, False);
+	XSync(SDL_Display, False);
 }
+
--- a/src/video/x11/SDL_x11modes.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/x11/SDL_x11modes.c	Wed Mar 22 05:00:59 2006 +0000
@@ -135,7 +135,7 @@
                  (modes[i]->vdisplay != mode.vdisplay) ) {
                 SDL_NAME(XF86VidModeSwitchToMode)(SDL_Display, SDL_Screen, modes[i]);
             }
-            pXFree(modes);
+            XFree(modes);
         }
     }
 #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */
@@ -174,7 +174,7 @@
                                         SDL_modelist[i]->w, 
                                         SDL_modelist[i]->h, 
                                         0);
-                pXSync(SDL_Display, False);
+                XSync(SDL_Display, False);
             }
         }
     }
@@ -224,7 +224,7 @@
 {
     XEvent event;
     do {
-        pXMaskEvent(SDL_Display, StructureNotifyMask, &event);
+        XMaskEvent(SDL_Display, StructureNotifyMask, &event);
     } while ( (event.type != MapNotify) || (event.xmap.event != win) );
 }
 
@@ -233,19 +233,19 @@
 {
     XEvent event;
     do {
-        pXMaskEvent(SDL_Display, StructureNotifyMask, &event);
+        XMaskEvent(SDL_Display, StructureNotifyMask, &event);
     } while ( (event.type != UnmapNotify) || (event.xunmap.event != win) );
 }
 
 static void move_cursor_to(_THIS, int x, int y)
 {
-    pXWarpPointer(SDL_Display, None, SDL_Root, 0, 0, 0, 0, x, y);
+    XWarpPointer(SDL_Display, None, SDL_Root, 0, 0, 0, 0, x, y);
 }
 
 static int add_visual(_THIS, int depth, int class)
 {
     XVisualInfo vi;
-    if(pXMatchVisualInfo(SDL_Display, SDL_Screen, depth, class, &vi)) {
+    if(XMatchVisualInfo(SDL_Display, SDL_Screen, depth, class, &vi)) {
         int n = this->hidden->nvisuals;
         this->hidden->visuals[n].depth = vi.depth;
         this->hidden->visuals[n].visual = vi.visual;
@@ -261,13 +261,13 @@
     if ( visual_id ) {
         SDL_memset(&template, 0, (sizeof template));
         template.visualid = SDL_strtol(visual_id, NULL, 0);
-        vi = pXGetVisualInfo(SDL_Display, VisualIDMask, &template, &nvis);
+        vi = XGetVisualInfo(SDL_Display, VisualIDMask, &template, &nvis);
         if ( vi ) {
             int n = this->hidden->nvisuals;
             this->hidden->visuals[n].depth = vi->depth;
             this->hidden->visuals[n].visual = vi->visual;
             this->hidden->nvisuals++;
-            pXFree(vi);
+            XFree(vi);
         }
     }
     return(this->hidden->nvisuals);
@@ -403,7 +403,7 @@
             }
             SDL_modelist[n] = NULL;
         }
-        pXFree(modes);
+        XFree(modes);
 
         use_vidmode = vm_major * 100 + vm_minor;
         save_mode(this);
@@ -477,7 +477,7 @@
         use_xme = 0;
     }
     if ( modelist ) {
-        pXFree(modelist);
+        XFree(modelist);
     }
 #endif /* SDL_VIDEO_DRIVER_X11_XME */
 
@@ -512,7 +512,7 @@
         }
             
         /* look up the pixel quantum for each depth */
-        pf = pXListPixmapFormats(SDL_Display, &np);
+        pf = XListPixmapFormats(SDL_Display, &np);
         for(i = 0; i < this->hidden->nvisuals; i++) {
             int d = this->hidden->visuals[i].depth;
             for(j = 0; j < np; j++)
@@ -521,7 +521,7 @@
             this->hidden->visuals[i].bpp = j < np ? pf[j].bits_per_pixel : d;
         }
 
-        pXFree(pf);
+        XFree(pf);
     }
 
     if ( SDL_modelist == NULL ) {
@@ -595,7 +595,7 @@
                 xinerama_y = xinerama[i].y_org;
             }
         }
-        pXFree(xinerama);
+        XFree(xinerama);
     }
 #endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */
 
@@ -661,15 +661,15 @@
         if ( window_h > real_h ) {
             real_h = MAX(real_h, screen_h);
         }
-        pXMoveResizeWindow(SDL_Display, FSwindow, x, y, real_w, real_h);
+        XMoveResizeWindow(SDL_Display, FSwindow, x, y, real_w, real_h);
         move_cursor_to(this, real_w/2, real_h/2);
 
         /* Center and reparent the drawing window */
         x = (real_w - window_w)/2;
         y = (real_h - window_h)/2;
-        pXReparentWindow(SDL_Display, SDL_Window, FSwindow, x, y);
+        XReparentWindow(SDL_Display, SDL_Window, FSwindow, x, y);
         /* FIXME: move the mouse to the old relative location */
-        pXSync(SDL_Display, True);   /* Flush spurious mode change events */
+        XSync(SDL_Display, True);   /* Flush spurious mode change events */
     }
     return(1);
 }
@@ -679,7 +679,7 @@
     switch_waiting = 0x01 | SDL_FULLSCREEN;
     switch_time = SDL_GetTicks() + 1500;
 #if 0 /* This causes a BadMatch error if the window is iconified (not needed) */
-    pXSetInputFocus(SDL_Display, WMwindow, RevertToNone, CurrentTime);
+    XSetInputFocus(SDL_Display, WMwindow, RevertToNone, CurrentTime);
 #endif
 }
 
@@ -712,14 +712,14 @@
     if ( window_h > real_h ) {
         real_h = MAX(real_h, screen_h);
     }
-    pXMoveResizeWindow(SDL_Display, FSwindow,
+    XMoveResizeWindow(SDL_Display, FSwindow,
                       xinerama_x, xinerama_y, real_w, real_h);
-    pXMapRaised(SDL_Display, FSwindow);
+    XMapRaised(SDL_Display, FSwindow);
     X11_WaitMapped(this, FSwindow);
 
 #if 0 /* This seems to break WindowMaker in focus-follows-mouse mode */
     /* Make sure we got to the top of the window stack */
-    if ( pXQueryTree(SDL_Display, SDL_Root, &tmpwin, &tmpwin,
+    if ( XQueryTree(SDL_Display, SDL_Root, &tmpwin, &tmpwin,
                             &windows, &nwindows) && windows ) {
         /* If not, try to put us there - if fail... oh well */
         if ( windows[nwindows-1] != FSwindow ) {
@@ -732,13 +732,13 @@
                 }
             }
             windows[nwindows-1] = FSwindow;
-            pXRestackWindows(SDL_Display, windows, nwindows);
-            pXSync(SDL_Display, False);
+            XRestackWindows(SDL_Display, windows, nwindows);
+            XSync(SDL_Display, False);
         }
-        pXFree(windows);
+        XFree(windows);
     }
 #else
-    pXRaiseWindow(SDL_Display, FSwindow);
+    XRaiseWindow(SDL_Display, FSwindow);
 #endif
 
 #if SDL_VIDEO_DRIVER_X11_VIDMODE
@@ -756,7 +756,7 @@
     }
     /* Set the colormap */
     if ( SDL_XColorMap ) {
-        pXInstallColormap(SDL_Display, SDL_XColorMap);
+        XInstallColormap(SDL_Display, SDL_XColorMap);
     }
     if ( okay )
         X11_GrabInputNoLock(this, this->input_grab | SDL_GRAB_FULLSCREEN);
@@ -777,7 +777,7 @@
 int X11_LeaveFullScreen(_THIS)
 {
     if ( currently_fullscreen ) {
-        pXReparentWindow(SDL_Display, SDL_Window, WMwindow, 0, 0);
+        XReparentWindow(SDL_Display, SDL_Window, WMwindow, 0, 0);
 #if SDL_VIDEO_DRIVER_X11_VIDMODE
         if ( use_vidmode ) {
             restore_mode(this);
@@ -799,14 +799,14 @@
                                         saved_res.width, 
                                         saved_res.height,
                                         0);
-                pXSync(SDL_Display, False);
+                XSync(SDL_Display, False);
             }
         }
 #endif
 
-        pXUnmapWindow(SDL_Display, FSwindow);
+        XUnmapWindow(SDL_Display, FSwindow);
         X11_WaitUnmapped(this, FSwindow);
-        pXSync(SDL_Display, True);   /* Flush spurious mode change events */
+        XSync(SDL_Display, True);   /* Flush spurious mode change events */
         currently_fullscreen = 0;
     }
     /* If we get popped out of fullscreen mode for some reason, input_grab
--- a/src/video/x11/SDL_x11mouse.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/x11/SDL_x11mouse.c	Wed Mar 22 05:00:59 2006 +0000
@@ -41,8 +41,8 @@
 {
 	if ( SDL_Display != NULL ) {
 		SDL_Lock_EventThread();
-		pXFreeCursor(SDL_Display, cursor->x_cursor);
-		pXSync(SDL_Display, False);
+		XFreeCursor(SDL_Display, cursor->x_cursor);
+		XSync(SDL_Display, False);
 		SDL_Unlock_EventThread();
 	}
 	SDL_free(cursor);
@@ -96,48 +96,48 @@
 	SDL_Lock_EventThread();
 
 	/* Create the data image */
-	data_image = pXCreateImage(SDL_Display, 
+	data_image = XCreateImage(SDL_Display, 
 			DefaultVisual(SDL_Display, SDL_Screen),
 					1, XYBitmap, 0, x_data, w, h, 8, w/8);
 	data_image->byte_order = MSBFirst;
 	data_image->bitmap_bit_order = MSBFirst;
-	data_pixmap = pXCreatePixmap(SDL_Display, SDL_Root, w, h, 1);
+	data_pixmap = XCreatePixmap(SDL_Display, SDL_Root, w, h, 1);
 
 	/* Create the data mask */
-	mask_image = pXCreateImage(SDL_Display, 
+	mask_image = XCreateImage(SDL_Display, 
 			DefaultVisual(SDL_Display, SDL_Screen),
 					1, XYBitmap, 0, x_mask, w, h, 8, w/8);
 	mask_image->byte_order = MSBFirst;
 	mask_image->bitmap_bit_order = MSBFirst;
-	mask_pixmap = pXCreatePixmap(SDL_Display, SDL_Root, w, h, 1);
+	mask_pixmap = XCreatePixmap(SDL_Display, SDL_Root, w, h, 1);
 
 	/* Create the graphics context */
 	GCvalues.function = GXcopy;
 	GCvalues.foreground = ~0;
 	GCvalues.background =  0;
 	GCvalues.plane_mask = AllPlanes;
-	GCcursor = pXCreateGC(SDL_Display, data_pixmap,
+	GCcursor = XCreateGC(SDL_Display, data_pixmap,
 			(GCFunction|GCForeground|GCBackground|GCPlaneMask),
 								&GCvalues);
 
 	/* Blit the images to the pixmaps */
-	pXPutImage(SDL_Display, data_pixmap, GCcursor, data_image,
+	XPutImage(SDL_Display, data_pixmap, GCcursor, data_image,
 							0, 0, 0, 0, w, h);
-	pXPutImage(SDL_Display, mask_pixmap, GCcursor, mask_image,
+	XPutImage(SDL_Display, mask_pixmap, GCcursor, mask_image,
 							0, 0, 0, 0, w, h);
-	pXFreeGC(SDL_Display, GCcursor);
+	XFreeGC(SDL_Display, GCcursor);
 	/* These free the x_data and x_mask memory pointers */
-	pXDestroyImage(data_image);
-	pXDestroyImage(mask_image);
+	XDestroyImage(data_image);
+	XDestroyImage(mask_image);
 
 	/* Create the cursor */
-	cursor->x_cursor = pXCreatePixmapCursor(SDL_Display, data_pixmap,
+	cursor->x_cursor = XCreatePixmapCursor(SDL_Display, data_pixmap,
 				mask_pixmap, &black, &white, hot_x, hot_y);
-	pXFreePixmap(SDL_Display, data_pixmap);
-	pXFreePixmap(SDL_Display, mask_pixmap);
+	XFreePixmap(SDL_Display, data_pixmap);
+	XFreePixmap(SDL_Display, mask_pixmap);
 
 	/* Release the event thread */
-	pXSync(SDL_Display, False);
+	XSync(SDL_Display, False);
 	SDL_Unlock_EventThread();
 
 	return(cursor);
@@ -155,13 +155,13 @@
 		SDL_Lock_EventThread();
 		if ( cursor == NULL ) {
 			if ( SDL_BlankCursor != NULL ) {
-				pXDefineCursor(SDL_Display, SDL_Window,
+				XDefineCursor(SDL_Display, SDL_Window,
 					SDL_BlankCursor->x_cursor);
 			}
 		} else {
-			pXDefineCursor(SDL_Display, SDL_Window, cursor->x_cursor);
+			XDefineCursor(SDL_Display, SDL_Window, cursor->x_cursor);
 		}
-		pXSync(SDL_Display, False);
+		XSync(SDL_Display, False);
 		SDL_Unlock_EventThread();
 	}
 	return(1);
@@ -178,8 +178,8 @@
 		SDL_PrivateMouseMotion(0, 0, x, y);
 	} else {
 		SDL_Lock_EventThread();
-		pXWarpPointer(SDL_Display, None, SDL_Window, 0, 0, 0, 0, x, y);
-		pXSync(SDL_Display, False);
+		XWarpPointer(SDL_Display, None, SDL_Window, 0, 0, 0, 0, x, y);
+		XSync(SDL_Display, False);
 		SDL_Unlock_EventThread();
 	}
 }
@@ -217,7 +217,7 @@
 		}
 	}
 	if ( mouse_param_buf ) {
-		pXChangePointerControl(SDL_Display, True, True,
+		XChangePointerControl(SDL_Display, True, True,
 			accel_value[0], accel_value[1], accel_value[2]);
 		SDL_free(mouse_param_buf);
 	}
@@ -250,7 +250,7 @@
 
 				SDL_GetMouseState(&mouse_last.x, &mouse_last.y);
 				/* Use as raw mouse mickeys as possible */
-				pXGetPointerControl(SDL_Display,
+				XGetPointerControl(SDL_Display,
 						&mouse_accel.numerator, 
 						&mouse_accel.denominator,
 						&mouse_accel.threshold);
@@ -266,7 +266,7 @@
 			if ( using_dga & DGA_MOUSE ) {
 				X11_DisableDGAMouse(this);
 			} else {
-				pXChangePointerControl(SDL_Display, True, True,
+				XChangePointerControl(SDL_Display, True, True,
 						mouse_accel.numerator, 
 						mouse_accel.denominator,
 						mouse_accel.threshold);
--- a/src/video/x11/SDL_x11sym.h	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/x11/SDL_x11sym.h	Wed Mar 22 05:00:59 2006 +0000
@@ -20,154 +20,159 @@
     slouken@libsdl.org
 */
 
-SDL_X11_SYM(1,XClassHint*,XAllocClassHint,(void))
-SDL_X11_SYM(1,Status,XAllocColor,(Display*,Colormap,XColor*))
-SDL_X11_SYM(1,XSizeHints*,XAllocSizeHints,(void))
-SDL_X11_SYM(1,XWMHints*,XAllocWMHints,(void))
-SDL_X11_SYM(1,int,XChangePointerControl,(Display*,Bool,Bool,int,int,int))
-SDL_X11_SYM(1,int,XChangeProperty,(Display*,Window,Atom,Atom,int,int,_Xconst unsigned char*,int))
-SDL_X11_SYM(1,int,XChangeWindowAttributes,(Display*,Window,unsigned long,XSetWindowAttributes*))
-SDL_X11_SYM(1,Bool,XCheckTypedEvent,(Display*,int,XEvent*))
-SDL_X11_SYM(1,int,XClearWindow,(Display*,Window))
-SDL_X11_SYM(1,int,XCloseDisplay,(Display*))
-SDL_X11_SYM(1,Colormap,XCreateColormap,(Display*,Window,Visual*,int))
-SDL_X11_SYM(1,Cursor,XCreatePixmapCursor,(Display*,Pixmap,Pixmap,XColor*,XColor*,unsigned int,unsigned int))
-SDL_X11_SYM(1,GC,XCreateGC,(Display*,Drawable,unsigned long,XGCValues*))
-SDL_X11_SYM(1,XImage*,XCreateImage,(Display*,Visual*,unsigned int,int,int,char*,unsigned int,unsigned int,int,int))
-SDL_X11_SYM(1,Pixmap,XCreatePixmap,(Display*,Drawable,unsigned int,unsigned int,unsigned int))
-SDL_X11_SYM(1,Pixmap,XCreatePixmapFromBitmapData,(Display*,Drawable,char*,unsigned int,unsigned int,unsigned long,unsigned long,unsigned int))
-SDL_X11_SYM(1,Window,XCreateSimpleWindow,(Display*,Window,int,int,unsigned int,unsigned int,unsigned int,unsigned long,unsigned long))
-SDL_X11_SYM(1,Window,XCreateWindow,(Display*,Window,int,int,unsigned int,unsigned int,unsigned int,int,unsigned int,Visual*,unsigned long,XSetWindowAttributes*))
-SDL_X11_SYM(1,int,XDefineCursor,(Display*,Window,Cursor))
-SDL_X11_SYM(1,int,XDeleteProperty,(Display*,Window,Atom))
-SDL_X11_SYM(1,int,XDestroyWindow,(Display*,Window))
-SDL_X11_SYM(1,char*,XDisplayName,(_Xconst char*))
-SDL_X11_SYM(1,int,XEventsQueued,(Display*,int))
-SDL_X11_SYM(1,Bool,XFilterEvent,(XEvent *event, Window w))
-SDL_X11_SYM(1,int,XFlush,(Display*))
-SDL_X11_SYM(1,int,XFree,(void*))
-SDL_X11_SYM(1,int,XFreeColormap,(Display*,Colormap))
-SDL_X11_SYM(1,int,XFreeColors,(Display*,Colormap,unsigned long*,int,unsigned long))
-SDL_X11_SYM(1,int,XFreeCursor,(Display*,Cursor))
-SDL_X11_SYM(1,int,XFreeGC,(Display*,GC))
-SDL_X11_SYM(1,int,XFreeModifiermap,(XModifierKeymap*))
-SDL_X11_SYM(1,int,XFreePixmap,(Display*,Pixmap))
-SDL_X11_SYM(1,int,XGetErrorDatabaseText,(Display*,_Xconst char*,_Xconst char*,_Xconst char*,char*,int))
-SDL_X11_SYM(1,XModifierKeymap*,XGetModifierMapping,(Display*))
-SDL_X11_SYM(1,int,XGetPointerControl,(Display*,int*,int*,int*))
-SDL_X11_SYM(1,XVisualInfo*,XGetVisualInfo,(Display*,long,XVisualInfo*,int*))
-SDL_X11_SYM(1,XWMHints*,XGetWMHints,(Display*,Window))
-SDL_X11_SYM(1,Status,XGetTextProperty,(Display*,Window,XTextProperty*,Atom))
-SDL_X11_SYM(1,Status,XGetWindowAttributes,(Display*,Window,XWindowAttributes*))
-SDL_X11_SYM(1,int,XGrabKeyboard,(Display*,Window,Bool,int,int,Time))
-SDL_X11_SYM(1,int,XGrabPointer,(Display*,Window,Bool,unsigned int,int,int,Window,Cursor,Time))
-SDL_X11_SYM(1,Status,XIconifyWindow,(Display*,Window,int))
-SDL_X11_SYM(1,int,XInstallColormap,(Display*,Colormap))
-SDL_X11_SYM(1,KeyCode,XKeysymToKeycode,(Display*,KeySym))
-SDL_X11_SYM(1,Atom,XInternAtom,(Display*,_Xconst char*,Bool))
-SDL_X11_SYM(1,XPixmapFormatValues*,XListPixmapFormats,(Display*,int*))
-SDL_X11_SYM(1,int,XLookupString,(XKeyEvent*,char*,int,KeySym*,XComposeStatus*))
-SDL_X11_SYM(1,int,XMapRaised,(Display*,Window))
-SDL_X11_SYM(1,int,XMapWindow,(Display*,Window))
-SDL_X11_SYM(1,int,XMaskEvent,(Display*,long,XEvent*))
-SDL_X11_SYM(1,Status,XMatchVisualInfo,(Display*,int,int,int,XVisualInfo*))
-SDL_X11_SYM(1,int,XMissingExtension,(Display*,_Xconst char*))
-SDL_X11_SYM(1,int,XMoveResizeWindow,(Display*,Window,int,int,unsigned int,unsigned int))
-SDL_X11_SYM(1,int,XMoveWindow,(Display*,Window,int,int))
-SDL_X11_SYM(1,int,XNextEvent,(Display*,XEvent*))
-SDL_X11_SYM(1,Display*,XOpenDisplay,(_Xconst char*))
-SDL_X11_SYM(1,int,XPeekEvent,(Display*,XEvent*))
-SDL_X11_SYM(1,int,XPending,(Display*))
-SDL_X11_SYM(1,int,XPutImage,(Display*,Drawable,GC,XImage*,int,int,int,int,unsigned int,unsigned int))
-SDL_X11_SYM(1,int,XQueryColors,(Display*,Colormap,XColor*,int))
-SDL_X11_SYM(1,int,XQueryKeymap,(Display*,char [32]))
-SDL_X11_SYM(1,Bool,XQueryPointer,(Display*,Window,Window*,Window*,int*,int*,int*,int*,unsigned int*))
-SDL_X11_SYM(1,int,XRaiseWindow,(Display*,Window))
-SDL_X11_SYM(1,int,XReparentWindow,(Display*,Window,Window,int,int))
-SDL_X11_SYM(1,int,XResizeWindow,(Display*,Window,unsigned int,unsigned int))
-SDL_X11_SYM(1,int,XSelectInput,(Display*,Window,long))
-SDL_X11_SYM(1,Status,XSendEvent,(Display*,Window,Bool,long,XEvent*))
-SDL_X11_SYM(1,int,XSetClassHint,(Display*,Window,XClassHint*))
-SDL_X11_SYM(1,XErrorHandler,XSetErrorHandler,(XErrorHandler))
-SDL_X11_SYM(1,XIOErrorHandler,XSetIOErrorHandler,(XIOErrorHandler))
-SDL_X11_SYM(1,int,XSetTransientForHint,(Display*,Window,Window))
-SDL_X11_SYM(1,int,XSetWMHints,(Display*,Window,XWMHints*))
-SDL_X11_SYM(1,void,XSetTextProperty,(Display*,Window,XTextProperty*,Atom))
-SDL_X11_SYM(1,void,XSetWMNormalHints,(Display*,Window,XSizeHints*))
-SDL_X11_SYM(1,Status,XSetWMProtocols,(Display*,Window,Atom*,int))
-SDL_X11_SYM(1,int,XSetWindowBackground,(Display*,Window,unsigned long))
-SDL_X11_SYM(1,int,XSetWindowBackgroundPixmap,(Display*,Window,Pixmap))
-SDL_X11_SYM(1,int,XSetWindowColormap,(Display*,Window,Colormap))
-SDL_X11_SYM(1,int,XStoreColors,(Display*,Colormap,XColor*,int))
-SDL_X11_SYM(1,Status,XStringListToTextProperty,(char**,int,XTextProperty*))
-SDL_X11_SYM(1,int,XSync,(Display*,Bool))
-SDL_X11_SYM(1,int,XUngrabKeyboard,(Display*,Time))
-SDL_X11_SYM(1,int,XUngrabPointer,(Display*,Time))
-SDL_X11_SYM(1,int,XUnmapWindow,(Display*,Window))
-SDL_X11_SYM(1,int,XWarpPointer,(Display*,Window,Window,int,int,unsigned int,unsigned int,int,int))
-SDL_X11_SYM(1,VisualID,XVisualIDFromVisual,(Visual*))
-SDL_X11_SYM(1,XExtDisplayInfo*,XextAddDisplay,(XExtensionInfo*,Display*,char*,XExtensionHooks*,int,XPointer))
-SDL_X11_SYM(1,XExtensionInfo*,XextCreateExtension,(void))
-SDL_X11_SYM(1,void,XextDestroyExtension,(XExtensionInfo*))
-SDL_X11_SYM(1,XExtDisplayInfo*,XextFindDisplay,(XExtensionInfo*,Display*))
-SDL_X11_SYM(1,int,XextRemoveDisplay,(XExtensionInfo*,Display*))
-SDL_X11_SYM(1,Bool,XQueryExtension,(Display*,_Xconst char*,int*,int*,int*))
-SDL_X11_SYM(1,char *,XDisplayString,(Display*))
-SDL_X11_SYM(1,int,XGetErrorText,(Display*,int,char*,int))
+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(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,XGetTextProperty,(Display* a,Window b,XTextProperty* c,Atom d),(a,b,c,d),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,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(SDL_X11_XSetExtensionErrorHandlerType,XSetExtensionErrorHandler,(SDL_X11_XSetExtensionErrorHandlerType 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_SYM(1,int,Xutf8TextListToTextProperty,(Display*,char**,int,XICCEncodingStyle,XTextProperty*))
-SDL_X11_SYM(1,int,Xutf8LookupString,(XIC,XKeyPressedEvent*,char*,int,KeySym*,Status*))
-SDL_X11_SYM(1,XIC,XCreateIC,(XIM, ...))
-SDL_X11_SYM(1,void,XDestroyIC,(XIC))
-SDL_X11_SYM(1,void,XSetICFocus,(XIC))
-SDL_X11_SYM(1,void,XUnsetICFocus,(XIC))
-SDL_X11_SYM(1,XIM,XOpenIM,(Display*,struct _XrmHashBucketRec*,char*,char*))
-SDL_X11_SYM(1,Status,XCloseIM,(XIM))
-#endif
-SDL_X11_SYM(1,void,_XEatData,(Display*,unsigned long))
-SDL_X11_SYM(1,void,_XFlush,(Display*))
-SDL_X11_SYM(1,void,_XFlushGCCache,(Display*,GC))
-SDL_X11_SYM(1,int,_XRead,(Display*,char*,long))
-SDL_X11_SYM(1,void,_XReadPad,(Display*,char*,long))
-SDL_X11_SYM(1,void,_XSend,(Display*,_Xconst char*,long))
-SDL_X11_SYM(1,Status,_XReply,(Display*,xReply*,int,Bool))
-SDL_X11_SYM(1,unsigned long,_XSetLastRequestRead,(Display*,xGenericReply*))
-
-/*
- * These don't exist in 32-bit versions and are removed by Xlib macros, but
- *  64+ bit systems will use them.
- */
-#if defined(LONG64)
-SDL_X11_SYM(1,int,_XData32,(Display *dpy,register long *data,unsigned len))
-SDL_X11_SYM(1,void,_XRead32,(Display *dpy,register long *data,long len))
-#endif
-
-#if defined(__osf__)
-SDL_X11_SYM(1,void,_SmtBufferOverflow,(Display *dpy,register smtDisplayPtr))
-SDL_X11_SYM(1,void,_SmtIpError,(Display *dpy,register smtDisplayPtr, int))
-SDL_X11_SYM(1,int,ipAllocateData,(ChannelPtr, IPCard, IPDataPtr *))
-SDL_X11_SYM(1,int,ipUnallocateAndSendData,(ChannelPtr, IPCard))
-#endif
-
-#if NeedWidePrototypes
-SDL_X11_SYM(1,KeySym,XKeycodeToKeysym,(Display*,unsigned int,int))
-#else
-SDL_X11_SYM(1,KeySym,XKeycodeToKeysym,(Display*,KeyCode,int))
+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_SYM(1,Status,XShmAttach,(Display*,XShmSegmentInfo*))
-SDL_X11_SYM(1,Status,XShmDetach,(Display*,XShmSegmentInfo*))
-SDL_X11_SYM(1,Status,XShmPutImage,(Display*,Drawable,GC,XImage*,int,int,int,int,unsigned int,unsigned int,Bool))
-SDL_X11_SYM(1,XImage*,XShmCreateImage,(Display*,Visual*,unsigned int,int,char*,XShmSegmentInfo*,unsigned int,unsigned int))
-SDL_X11_SYM(1,Bool,XShmQueryExtension,(Display*))
+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
 
-SDL_X11_SYM(1,SDL_X11_XSynchronizeRetType,XSynchronize,(Display*,Bool))
-SDL_X11_SYM(1,SDL_X11_XESetWireToEventRetType,XESetWireToEvent,(Display*,int,SDL_X11_XESetWireToEventRetType))
-SDL_X11_SYM(1,SDL_X11_XESetEventToWireRetType,XESetEventToWire,(Display*,int,SDL_X11_XESetEventToWireRetType))
-SDL_X11_SYM(1,SDL_X11_XSetExtensionErrorHandlerType,XSetExtensionErrorHandler,(SDL_X11_XSetExtensionErrorHandlerType))
+/*
+ * 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.
+ */
+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),)
+
+/*
+ * 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
 
 /* end of SDL_x11sym.h ... */
 
--- a/src/video/x11/SDL_x11video.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/x11/SDL_x11video.c	Wed Mar 22 05:00:59 2006 +0000
@@ -71,9 +71,9 @@
 {
 	Display *display = NULL;
 	if ( SDL_X11_LoadSymbols() ) {
-		display = pXOpenDisplay(NULL);
+		display = XOpenDisplay(NULL);
 		if ( display != NULL ) {
-			pXCloseDisplay(display);
+			XCloseDisplay(display);
 		}
 		SDL_X11_UnloadSymbols();
 	}
@@ -199,7 +199,7 @@
 	       (e->error_code <= (vm_error+XF86VidModeNumberErrors)))) ) {
 #ifdef XFREE86_DEBUG
 { char errmsg[1024];
-  pXGetErrorText(d, e->error_code, errmsg, sizeof(errmsg));
+  XGetErrorText(d, e->error_code, errmsg, sizeof(errmsg));
 printf("VidMode error: %s\n", errmsg);
 }
 #endif
@@ -214,7 +214,7 @@
 	      (e->error_code <= (dga_error+XF86DGANumberErrors))) ) {
 #ifdef XFREE86_DEBUG
 { char errmsg[1024];
-  pXGetErrorText(d, e->error_code, errmsg, sizeof(errmsg));
+  XGetErrorText(d, e->error_code, errmsg, sizeof(errmsg));
 printf("DGA error: %s\n", errmsg);
 }
 #endif
@@ -247,7 +247,7 @@
 #ifdef XFREE86_DEBUG
 	printf("Xext error inside SDL (may be harmless):\n");
 	printf("  Extension \"%s\" %s on display \"%s\".\n",
-	       ext_name, reason, pXDisplayString(d));
+	       ext_name, reason, XDisplayString(d));
 #endif
 
 	if (SDL_strcmp(reason, "missing") == 0) {
@@ -319,9 +319,9 @@
     int def_vis = (SDL_Visual == DefaultVisual(SDL_Display, SDL_Screen));
 
     /* Look up some useful Atoms */
-    WM_DELETE_WINDOW = pXInternAtom(SDL_Display, "WM_DELETE_WINDOW", False);
-    _NET_WM_NAME = pXInternAtom(SDL_Display, "_NET_WM_NAME", False);
-    _NET_WM_ICON_NAME = pXInternAtom(SDL_Display, "_NET_WM_ICON_NAME", False);
+    WM_DELETE_WINDOW = XInternAtom(SDL_Display, "WM_DELETE_WINDOW", False);
+    _NET_WM_NAME = XInternAtom(SDL_Display, "_NET_WM_NAME", False);
+    _NET_WM_ICON_NAME = XInternAtom(SDL_Display, "_NET_WM_ICON_NAME", False);
 
     /* Don't create any extra windows if we are being managed */
     if ( SDL_windowid ) {
@@ -331,21 +331,21 @@
     }
 
     if(FSwindow)
-	pXDestroyWindow(SDL_Display, FSwindow);
+	XDestroyWindow(SDL_Display, FSwindow);
 
     xattr.override_redirect = True;
     xattr.background_pixel = def_vis ? BlackPixel(SDL_Display, SDL_Screen) : 0;
     xattr.border_pixel = 0;
     xattr.colormap = SDL_XColorMap;
 
-    FSwindow = pXCreateWindow(SDL_Display, SDL_Root,
+    FSwindow = XCreateWindow(SDL_Display, SDL_Root,
                              xinerama_x, xinerama_y, 32, 32, 0,
 			     this->hidden->depth, InputOutput, SDL_Visual,
 			     CWOverrideRedirect | CWBackPixel | CWBorderPixel
 			     | CWColormap,
 			     &xattr);
 
-    pXSelectInput(SDL_Display, FSwindow, StructureNotifyMask);
+    XSelectInput(SDL_Display, FSwindow, StructureNotifyMask);
 
     /* Tell KDE to keep the fullscreen window on top */
     {
@@ -355,13 +355,13 @@
 	SDL_memset(&ev, 0, sizeof(ev));
 	ev.xclient.type = ClientMessage;
 	ev.xclient.window = SDL_Root;
-	ev.xclient.message_type = pXInternAtom(SDL_Display,
+	ev.xclient.message_type = XInternAtom(SDL_Display,
 					      "KWM_KEEP_ON_TOP", False);
 	ev.xclient.format = 32;
 	ev.xclient.data.l[0] = FSwindow;
 	ev.xclient.data.l[1] = CurrentTime;
 	mask = SubstructureRedirectMask;
-	pXSendEvent(SDL_Display, SDL_Root, False, mask, &ev);
+	XSendEvent(SDL_Display, SDL_Root, False, mask, &ev);
     }
 
     hints = NULL;
@@ -369,47 +369,47 @@
     iconprop.value = iconpropUTF8.value = NULL;
     if(WMwindow) {
 	/* All window attributes must survive the recreation */
-	hints = pXGetWMHints(SDL_Display, WMwindow);
-	pXGetTextProperty(SDL_Display, WMwindow, &titleprop, XA_WM_NAME);
-	pXGetTextProperty(SDL_Display, WMwindow, &titlepropUTF8, _NET_WM_NAME);
-	pXGetTextProperty(SDL_Display, WMwindow, &iconprop, XA_WM_ICON_NAME);
-	pXGetTextProperty(SDL_Display, WMwindow, &iconpropUTF8, _NET_WM_ICON_NAME);
-	pXDestroyWindow(SDL_Display, WMwindow);
+	hints = XGetWMHints(SDL_Display, WMwindow);
+	XGetTextProperty(SDL_Display, WMwindow, &titleprop, XA_WM_NAME);
+	XGetTextProperty(SDL_Display, WMwindow, &titlepropUTF8, _NET_WM_NAME);
+	XGetTextProperty(SDL_Display, WMwindow, &iconprop, XA_WM_ICON_NAME);
+	XGetTextProperty(SDL_Display, WMwindow, &iconpropUTF8, _NET_WM_ICON_NAME);
+	XDestroyWindow(SDL_Display, WMwindow);
     }
 
     /* Create the window for windowed management */
     /* (reusing the xattr structure above) */
-    WMwindow = pXCreateWindow(SDL_Display, SDL_Root, 0, 0, 32, 32, 0,
+    WMwindow = XCreateWindow(SDL_Display, SDL_Root, 0, 0, 32, 32, 0,
 			     this->hidden->depth, InputOutput, SDL_Visual,
 			     CWBackPixel | CWBorderPixel | CWColormap,
 			     &xattr);
 
     /* Set the input hints so we get keyboard input */
     if(!hints) {
-	hints = pXAllocWMHints();
+	hints = XAllocWMHints();
 	hints->input = True;
 	hints->flags = InputHint;
     }
-    pXSetWMHints(SDL_Display, WMwindow, hints);
-    pXFree(hints);
+    XSetWMHints(SDL_Display, WMwindow, hints);
+    XFree(hints);
     if(titleprop.value) {
-	pXSetTextProperty(SDL_Display, WMwindow, &titleprop, XA_WM_NAME);
-	pXFree(titleprop.value);
+	XSetTextProperty(SDL_Display, WMwindow, &titleprop, XA_WM_NAME);
+	XFree(titleprop.value);
     }
     if(titlepropUTF8.value) {
-	pXSetTextProperty(SDL_Display, WMwindow, &titlepropUTF8, _NET_WM_NAME);
-	pXFree(titlepropUTF8.value);
+	XSetTextProperty(SDL_Display, WMwindow, &titlepropUTF8, _NET_WM_NAME);
+	XFree(titlepropUTF8.value);
     }
     if(iconprop.value) {
-	pXSetTextProperty(SDL_Display, WMwindow, &iconprop, XA_WM_ICON_NAME);
-	pXFree(iconprop.value);
+	XSetTextProperty(SDL_Display, WMwindow, &iconprop, XA_WM_ICON_NAME);
+	XFree(iconprop.value);
     }
     if(iconpropUTF8.value) {
-	pXSetTextProperty(SDL_Display, WMwindow, &iconpropUTF8, _NET_WM_ICON_NAME);
-	pXFree(iconpropUTF8.value);
+	XSetTextProperty(SDL_Display, WMwindow, &iconpropUTF8, _NET_WM_ICON_NAME);
+	XFree(iconpropUTF8.value);
     }
 
-    pXSelectInput(SDL_Display, WMwindow,
+    XSelectInput(SDL_Display, WMwindow,
 		 FocusChangeMask | KeyPressMask | KeyReleaseMask
 		 | PropertyChangeMask | StructureNotifyMask | KeymapStateMask);
 
@@ -417,41 +417,44 @@
     get_classname(classname, sizeof(classname));
     {
 	XClassHint *classhints;
-	classhints = pXAllocClassHint();
+	classhints = XAllocClassHint();
 	if(classhints != NULL) {
 	    classhints->res_name = classname;
 	    classhints->res_class = classname;
-	    pXSetClassHint(SDL_Display, WMwindow, classhints);
-	    pXFree(classhints);
+	    XSetClassHint(SDL_Display, WMwindow, classhints);
+	    XFree(classhints);
 	}
     }
 
     /* Setup the communication with the IM server */
-    SDL_IM = NULL;
-    SDL_IC = NULL;
+	SDL_IM = NULL;
+	SDL_IC = NULL;
 
-    #ifdef X_HAVE_UTF8_STRING
-    SDL_IM = pXOpenIM(SDL_Display, NULL, classname, classname);
-    if (SDL_IM == NULL) {
-	SDL_SetError("no input method could be opened");
-    } else {
-	SDL_IC = pXCreateIC(SDL_IM,
-			XNClientWindow, WMwindow,
-			XNFocusWindow, WMwindow,
-			XNInputStyle, XIMPreeditNothing  | XIMStatusNothing,
-			XNResourceName, classname,
-			XNResourceClass, classname,
-			NULL);
-	if (SDL_IC == NULL) {
-		SDL_SetError("no input context could be created");
-		pXCloseIM(SDL_IM);
-		SDL_IM = NULL;
+	#ifdef X_HAVE_UTF8_STRING
+	if (SDL_X11_HAVE_UTF8) {
+		SDL_IM = XOpenIM(SDL_Display, NULL, classname, classname);
+		if (SDL_IM == NULL) {
+			SDL_SetError("no input method could be opened");
+		} else {
+			SDL_IC = pXCreateIC(SDL_IM,
+					XNClientWindow, WMwindow,
+					XNFocusWindow, WMwindow,
+					XNInputStyle, XIMPreeditNothing  | XIMStatusNothing,
+					XNResourceName, classname,
+					XNResourceClass, classname,
+					NULL);
+
+			if (SDL_IC == NULL) {
+				SDL_SetError("no input context could be created");
+				XCloseIM(SDL_IM);
+				SDL_IM = NULL;
+			}
+		}
 	}
-    }
-    #endif
+	#endif
 
-    /* Allow the window to be deleted by the window manager */
-    pXSetWMProtocols(SDL_Display, WMwindow, &WM_DELETE_WINDOW, 1);
+	/* Allow the window to be deleted by the window manager */
+	XSetWMProtocols(SDL_Display, WMwindow, &WM_DELETE_WINDOW, 1);
 }
 
 static int X11_VideoInit(_THIS, SDL_PixelFormat *vformat)
@@ -462,13 +465,13 @@
 	/* Open the X11 display */
 	display = NULL;		/* Get it from DISPLAY environment variable */
 
-	if ( (SDL_strncmp(pXDisplayName(display), ":", 1) == 0) ||
-	     (SDL_strncmp(pXDisplayName(display), "unix:", 5) == 0) ) {
+	if ( (SDL_strncmp(XDisplayName(display), ":", 1) == 0) ||
+	     (SDL_strncmp(XDisplayName(display), "unix:", 5) == 0) ) {
 		local_X11 = 1;
 	} else {
 		local_X11 = 0;
 	}
-	SDL_Display = pXOpenDisplay(display);
+	SDL_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
@@ -480,7 +483,7 @@
 	 */
 	if ( SDL_Display == NULL ) {
 		SDL_Delay(1000);
-		SDL_Display = pXOpenDisplay(display);
+		SDL_Display = XOpenDisplay(display);
 	}
 #endif
 	if ( SDL_Display == NULL ) {
@@ -488,27 +491,27 @@
 		return(-1);
 	}
 #ifdef X11_DEBUG
-	pXSynchronize(SDL_Display, True);
+	XSynchronize(SDL_Display, True);
 #endif
 
 	/* Create an alternate X display for graphics updates -- allows us
 	   to do graphics updates in a separate thread from event handling.
 	   Thread-safe X11 doesn't seem to exist.
 	 */
-	GFX_Display = pXOpenDisplay(display);
+	GFX_Display = XOpenDisplay(display);
 	if ( GFX_Display == NULL ) {
 		SDL_SetError("Couldn't open X11 display");
 		return(-1);
 	}
 
 	/* Set the normal X error handler */
-	X_handler = pXSetErrorHandler(x_errhandler);
+	X_handler = XSetErrorHandler(x_errhandler);
 
 	/* Set the error handler if we lose the X display */
-	XIO_handler = pXSetIOErrorHandler(xio_errhandler);
+	XIO_handler = XSetIOErrorHandler(xio_errhandler);
 
 	/* Set the X extension error handler */
-	Xext_handler = pXSetExtensionErrorHandler(xext_errhandler);
+	Xext_handler = XSetExtensionErrorHandler(xext_errhandler);
 
 	/* use default screen (from $DISPLAY) */
 	SDL_Screen = DefaultScreen(SDL_Display);
@@ -517,7 +520,7 @@
 	/* Check for MIT shared memory extension */
 	use_mitshm = 0;
 	if ( local_X11 ) {
-		use_mitshm = pXShmQueryExtension(SDL_Display);
+		use_mitshm = XShmQueryExtension(SDL_Display);
 	}
 #endif /* NO_SHARED_MEMORY */
 
@@ -544,7 +547,7 @@
 	if ( SDL_Visual == DefaultVisual(SDL_Display, SDL_Screen) ) {
 	    SDL_XColorMap = SDL_DisplayColormap;
 	} else {
-	    SDL_XColorMap = pXCreateColormap(SDL_Display, SDL_Root,
+	    SDL_XColorMap = XCreateColormap(SDL_Display, SDL_Root,
 					    SDL_Visual, AllocNone);
 	}
 	this->hidden->depth = this->hidden->visuals[i].depth;
@@ -571,7 +574,7 @@
 	this->info.wm_available = 1;
 
 	/* We're done! */
-	pXFlush(SDL_Display);
+	XFlush(SDL_Display);
 	return(0);
 }
 
@@ -586,7 +589,7 @@
 	if ( ! SDL_windowid ) {
 		/* Hide the managed window */
 		if ( WMwindow ) {
-			pXUnmapWindow(SDL_Display, WMwindow);
+			XUnmapWindow(SDL_Display, WMwindow);
 		}
 		if ( screen && (screen->flags & SDL_FULLSCREEN) ) {
 			screen->flags &= ~SDL_FULLSCREEN;
@@ -595,7 +598,7 @@
 
 		/* Destroy the output window */
 		if ( SDL_Window ) {
-			pXDestroyWindow(SDL_Display, SDL_Window);
+			XDestroyWindow(SDL_Display, SDL_Window);
 		}
 
 		/* Free the colormap entries */
@@ -605,7 +608,7 @@
 			numcolors = SDL_Visual->map_entries;
 			for ( pixel=0; pixel<numcolors; ++pixel ) {
 				while ( SDL_XPixels[pixel] > 0 ) {
-					pXFreeColors(GFX_Display,
+					XFreeColors(GFX_Display,
 						SDL_DisplayColormap,&pixel,1,0);
 					--SDL_XPixels[pixel];
 				}
@@ -616,7 +619,7 @@
 
 		/* Free the graphics context */
 		if ( SDL_GC ) {
-			pXFreeGC(SDL_Display, SDL_GC);
+			XFreeGC(SDL_Display, SDL_GC);
 			SDL_GC = 0;
 		}
 	}
@@ -646,7 +649,7 @@
 {
 	XSizeHints *hints;
 
-	hints = pXAllocSizeHints();
+	hints = XAllocSizeHints();
 	if ( hints ) {
 		if ( flags & SDL_RESIZABLE ) {
 			hints->min_width = 32;
@@ -666,13 +669,13 @@
 		/* Center it, if desired */
 		if ( X11_WindowPosition(this, &hints->x, &hints->y, w, h) ) {
 			hints->flags |= USPosition;
-			pXMoveWindow(SDL_Display, WMwindow, hints->x, hints->y);
+			XMoveWindow(SDL_Display, WMwindow, hints->x, hints->y);
 
 			/* Flush the resize event so we don't catch it later */
-			pXSync(SDL_Display, True);
+			XSync(SDL_Display, True);
 		}
-		pXSetWMNormalHints(SDL_Display, WMwindow, hints);
-		pXFree(hints);
+		XSetWMNormalHints(SDL_Display, WMwindow, hints);
+		XFree(hints);
 	}
 
 	/* Respect the window caption style */
@@ -684,7 +687,7 @@
 		set = SDL_FALSE;
 
 		/* First try to set MWM hints */
-		WM_HINTS = pXInternAtom(SDL_Display, "_MOTIF_WM_HINTS", True);
+		WM_HINTS = XInternAtom(SDL_Display, "_MOTIF_WM_HINTS", True);
 		if ( WM_HINTS != None ) {
 			/* Hints used by Motif compliant window managers */
 			struct {
@@ -695,7 +698,7 @@
 				unsigned long status;
 			} MWMHints = { (1L << 1), 0, 0, 0, 0 };
 
-			pXChangeProperty(SDL_Display, WMwindow,
+			XChangeProperty(SDL_Display, WMwindow,
 			                WM_HINTS, WM_HINTS, 32,
 			                PropModeReplace,
 					(unsigned char *)&MWMHints,
@@ -703,11 +706,11 @@
 			set = SDL_TRUE;
 		}
 		/* Now try to set KWM hints */
-		WM_HINTS = pXInternAtom(SDL_Display, "KWM_WIN_DECORATION", True);
+		WM_HINTS = XInternAtom(SDL_Display, "KWM_WIN_DECORATION", True);
 		if ( WM_HINTS != None ) {
 			long KWMHints = 0;
 
-			pXChangeProperty(SDL_Display, WMwindow,
+			XChangeProperty(SDL_Display, WMwindow,
 			                WM_HINTS, WM_HINTS, 32,
 			                PropModeReplace,
 					(unsigned char *)&KWMHints,
@@ -715,11 +718,11 @@
 			set = SDL_TRUE;
 		}
 		/* Now try to set GNOME hints */
-		WM_HINTS = pXInternAtom(SDL_Display, "_WIN_HINTS", True);
+		WM_HINTS = XInternAtom(SDL_Display, "_WIN_HINTS", True);
 		if ( WM_HINTS != None ) {
 			long GNOMEHints = 0;
 
-			pXChangeProperty(SDL_Display, WMwindow,
+			XChangeProperty(SDL_Display, WMwindow,
 			                WM_HINTS, WM_HINTS, 32,
 			                PropModeReplace,
 					(unsigned char *)&GNOMEHints,
@@ -728,7 +731,7 @@
 		}
 		/* Finally set the transient hints if necessary */
 		if ( ! set ) {
-			pXSetTransientForHint(SDL_Display, WMwindow, SDL_Root);
+			XSetTransientForHint(SDL_Display, WMwindow, SDL_Root);
 		}
 	} else {
 		SDL_bool set;
@@ -738,27 +741,27 @@
 		set = SDL_FALSE;
 
 		/* First try to unset MWM hints */
-		WM_HINTS = pXInternAtom(SDL_Display, "_MOTIF_WM_HINTS", True);
+		WM_HINTS = XInternAtom(SDL_Display, "_MOTIF_WM_HINTS", True);
 		if ( WM_HINTS != None ) {
-			pXDeleteProperty(SDL_Display, WMwindow, WM_HINTS);
+			XDeleteProperty(SDL_Display, WMwindow, WM_HINTS);
 			set = SDL_TRUE;
 		}
 		/* Now try to unset KWM hints */
-		WM_HINTS = pXInternAtom(SDL_Display, "KWM_WIN_DECORATION", True);
+		WM_HINTS = XInternAtom(SDL_Display, "KWM_WIN_DECORATION", True);
 		if ( WM_HINTS != None ) {
-			pXDeleteProperty(SDL_Display, WMwindow, WM_HINTS);
+			XDeleteProperty(SDL_Display, WMwindow, WM_HINTS);
 			set = SDL_TRUE;
 		}
 		/* Now try to unset GNOME hints */
-		WM_HINTS = pXInternAtom(SDL_Display, "_WIN_HINTS", True);
+		WM_HINTS = XInternAtom(SDL_Display, "_WIN_HINTS", True);
 		if ( WM_HINTS != None ) {
-			pXDeleteProperty(SDL_Display, WMwindow, WM_HINTS);
+			XDeleteProperty(SDL_Display, WMwindow, WM_HINTS);
 			set = SDL_TRUE;
 		}
 		/* Finally unset the transient hints if necessary */
 		if ( ! set ) {
 			/* NOTE: Does this work? */
-			pXSetTransientForHint(SDL_Display, WMwindow, None);
+			XSetTransientForHint(SDL_Display, WMwindow, None);
 		}
 	}
 }
@@ -796,7 +799,7 @@
 	} else if ( SDL_windowid ) {
 		XWindowAttributes a;
 
-		pXGetWindowAttributes(SDL_Display, SDL_Window, &a);
+		XGetWindowAttributes(SDL_Display, SDL_Window, &a);
 		vis = a.visual;
 		depth = a.depth;
 	} else {
@@ -825,7 +828,7 @@
 
 	/* Create the appropriate colormap */
 	if ( SDL_XColorMap != SDL_DisplayColormap ) {
-		pXFreeColormap(SDL_Display, SDL_XColorMap);
+		XFreeColormap(SDL_Display, SDL_XColorMap);
 	}
 	if ( SDL_Visual->class == PseudoColor ) {
 	    int ncolors;
@@ -845,7 +848,7 @@
 	    }
 	    if ( flags & SDL_HWPALETTE ) {
 		screen->flags |= SDL_HWPALETTE;
-		SDL_XColorMap = pXCreateColormap(SDL_Display, SDL_Root,
+		SDL_XColorMap = XCreateColormap(SDL_Display, SDL_Root,
 		                                SDL_Visual, AllocAll);
 	    } else {
 		SDL_XColorMap = SDL_DisplayColormap;
@@ -853,9 +856,9 @@
 	} else if ( SDL_Visual->class == DirectColor ) {
 
 	    /* Create a colormap which we can manipulate for gamma */
-	    SDL_XColorMap = pXCreateColormap(SDL_Display, SDL_Root,
+	    SDL_XColorMap = XCreateColormap(SDL_Display, SDL_Root,
 		                            SDL_Visual, AllocAll);
-            pXSync(SDL_Display, False);
+            XSync(SDL_Display, False);
 
 	    /* Initialize the colormap to the identity mapping */
 	    SDL_GetGammaRamp(0, 0, 0);
@@ -864,7 +867,7 @@
 	    this->screen = NULL;
 	} else {
 	    /* Create a read-only colormap for our window */
-	    SDL_XColorMap = pXCreateColormap(SDL_Display, SDL_Root,
+	    SDL_XColorMap = XCreateColormap(SDL_Display, SDL_Root,
 	                                    SDL_Visual, AllocNone);
 	}
 
@@ -877,8 +880,8 @@
 	       colour (0 is white on some displays), we should reset the
 	       background to 0 here since that is what the user expects
 	       with a private colormap */
-	    pXSetWindowBackground(SDL_Display, FSwindow, 0);
-	    pXClearWindow(SDL_Display, FSwindow);
+	    XSetWindowBackground(SDL_Display, FSwindow, 0);
+	    XClearWindow(SDL_Display, FSwindow);
 	}
 
 	/* resize the (possibly new) window manager window */
@@ -886,7 +889,7 @@
 	        X11_SetSizeHints(this, w, h, flags);
 		window_w = w;
 		window_h = h;
-		pXResizeWindow(SDL_Display, WMwindow, w, h);
+		XResizeWindow(SDL_Display, WMwindow, w, h);
 	}
 
 	/* Create (or use) the X11 display window */
@@ -901,14 +904,14 @@
 			swa.background_pixel = 0;
 			swa.border_pixel = 0;
 			swa.colormap = SDL_XColorMap;
-			SDL_Window = pXCreateWindow(SDL_Display, WMwindow,
+			SDL_Window = XCreateWindow(SDL_Display, WMwindow,
 		                           	0, 0, w, h, 0, depth,
 		                           	InputOutput, SDL_Visual,
 		                           	CWBackPixel | CWBorderPixel
 		                           	| CWColormap, &swa);
 		}
 		/* Only manage our input if we own the window */
-		pXSelectInput(SDL_Display, SDL_Window,
+		XSelectInput(SDL_Display, SDL_Window,
 					( EnterWindowMask | LeaveWindowMask
 					| ButtonPressMask | ButtonReleaseMask
 					| PointerMotionMask | ExposureMask ));
@@ -924,7 +927,7 @@
 		XGCValues gcv;
 
 		gcv.graphics_exposures = False;
-		SDL_GC = pXCreateGC(SDL_Display, SDL_Window,
+		SDL_GC = XCreateGC(SDL_Display, SDL_Window,
 		                   GCGraphicsExposures, &gcv);
 		if ( ! SDL_GC ) {
 			SDL_SetError("Couldn't create graphics context");
@@ -934,10 +937,10 @@
 
 	/* Set our colormaps when not setting a GL mode */
 	if ( ! (flags & SDL_OPENGL) ) {
-		pXSetWindowColormap(SDL_Display, SDL_Window, SDL_XColorMap);
+		XSetWindowColormap(SDL_Display, SDL_Window, SDL_XColorMap);
 		if( !SDL_windowid ) {
-		    pXSetWindowColormap(SDL_Display, FSwindow, SDL_XColorMap);
-		    pXSetWindowColormap(SDL_Display, WMwindow, SDL_XColorMap);
+		    XSetWindowColormap(SDL_Display, FSwindow, SDL_XColorMap);
+		    XSetWindowColormap(SDL_Display, WMwindow, SDL_XColorMap);
 		}
 	}
 
@@ -952,7 +955,7 @@
 		xscreen = ScreenOfDisplay(SDL_Display, SDL_Screen);
 		a.backing_store = DoesBackingStore(xscreen);
 		if ( a.backing_store != NotUseful ) {
-			pXChangeWindowAttributes(SDL_Display, SDL_Window,
+			XChangeWindowAttributes(SDL_Display, SDL_Window,
 			                        CWBackingStore, &a);
 		}
 	}
@@ -986,8 +989,8 @@
 
 	/* Map them both and go fullscreen, if requested */
 	if ( ! SDL_windowid ) {
-		pXMapWindow(SDL_Display, SDL_Window);
-		pXMapWindow(SDL_Display, WMwindow);
+		XMapWindow(SDL_Display, SDL_Window);
+		XMapWindow(SDL_Display, WMwindow);
 		X11_WaitMapped(this, WMwindow);
 		if ( flags & SDL_FULLSCREEN ) {
 			screen->flags |= SDL_FULLSCREEN;
@@ -1008,7 +1011,7 @@
 		X11_SetSizeHints(this, w, h, flags);
 		window_w = w;
 		window_h = h;
-		pXResizeWindow(SDL_Display, WMwindow, w, h);
+		XResizeWindow(SDL_Display, WMwindow, w, h);
 
 		/* Resize the fullscreen and display windows */
 		if ( flags & SDL_FULLSCREEN ) {
@@ -1024,7 +1027,7 @@
 				X11_LeaveFullScreen(this);
 			}
 		}
-		pXResizeWindow(SDL_Display, SDL_Window, w, h);
+		XResizeWindow(SDL_Display, SDL_Window, w, h);
 	}
 	return(0);
 }
@@ -1046,7 +1049,7 @@
 	}
 
 	/* Flush any delayed updates */
-	pXSync(GFX_Display, False);
+	XSync(GFX_Display, False);
 
 	/* Set up the X11 window */
 	saved_flags = current->flags;
@@ -1076,7 +1079,7 @@
 
   done:
 	/* Release the event thread */
-	pXSync(SDL_Display, False);
+	XSync(SDL_Display, False);
 	SDL_Unlock_EventThread();
 
 	/* We're done! */
@@ -1125,7 +1128,7 @@
 
 	/* Lock the event thread, in multi-threading environments */
 	SDL_Lock_EventThread();
-	if ( pXQueryPointer(SDL_Display, SDL_Window, &u1, &current_win,
+	if ( XQueryPointer(SDL_Display, SDL_Window, &u1, &current_win,
 	                   &u2, &u2, &x, &y, &mask) ) {
 		if ( (x >= 0) && (x < SDL_VideoSurface->w) &&
 		     (y >= 0) && (y < SDL_VideoSurface->h) ) {
@@ -1162,7 +1165,7 @@
 	 * XQueryColors sets the flags in the XColor struct, so we use
 	 * that to keep track of which colours are available
 	 */
-	pXQueryColors(GFX_Display, SDL_XColorMap, all, 256);
+	XQueryColors(GFX_Display, SDL_XColorMap, all, 256);
 
 	for(i = 0; i < nwant; i++) {
 		XColor *c;
@@ -1188,7 +1191,7 @@
 		if(SDL_XPixels[best])
 			continue; /* already allocated, waste no more time */
 		c = all + best;
-		if(pXAllocColor(GFX_Display, SDL_XColorMap, c)) {
+		if(XAllocColor(GFX_Display, SDL_XColorMap, c)) {
 			/* got it */
 			colors[c->pixel].r = c->red >> 8;
 			colors[c->pixel].g = c->green >> 8;
@@ -1230,8 +1233,8 @@
 			xcmap[i].blue  = (colors[i].b<<8)|colors[i].b;
 			xcmap[i].flags = (DoRed|DoGreen|DoBlue);
 		}
-		pXStoreColors(GFX_Display, SDL_XColorMap, xcmap, ncolors);
-		pXSync(GFX_Display, False);
+		XStoreColors(GFX_Display, SDL_XColorMap, xcmap, ncolors);
+		XSync(GFX_Display, False);
 		SDL_stack_free(xcmap);
 	} else {
 	        /*
@@ -1259,7 +1262,7 @@
 				--SDL_XPixels[pixel];
 			}
 		}
-		pXFreeColors(GFX_Display, SDL_XColorMap, freelist, nfree, 0);
+		XFreeColors(GFX_Display, SDL_XColorMap, freelist, nfree, 0);
 		SDL_stack_free(freelist);
 
 		want = SDL_stack_alloc(SDL_Color, ncolors);
@@ -1276,7 +1279,7 @@
 			col.green = want[i].g << 8;
 			col.blue = want[i].b << 8;
 			col.flags = DoRed | DoGreen | DoBlue;
-			if(pXAllocColor(GFX_Display, SDL_XColorMap, &col)) {
+			if(XAllocColor(GFX_Display, SDL_XColorMap, &col)) {
 			        /* We got the colour, or at least the nearest
 				   the hardware could get. */
 			        colors[col.pixel].r = col.red >> 8;
@@ -1320,8 +1323,8 @@
 		xcmap[i].blue  = ramp[2*256+c];
 		xcmap[i].flags = (DoRed|DoGreen|DoBlue);
 	}
-	pXStoreColors(GFX_Display, SDL_XColorMap, xcmap, ncolors);
-	pXSync(GFX_Display, False);
+	XStoreColors(GFX_Display, SDL_XColorMap, xcmap, ncolors);
+	XSync(GFX_Display, False);
 	return(0);
 }
 
@@ -1334,16 +1337,16 @@
 	/* The event thread should be done, so we can touch SDL_Display */
 	if ( SDL_Display != NULL ) {
 		/* Flush any delayed updates */
-		pXSync(GFX_Display, False);
+		XSync(GFX_Display, False);
 
 		/* Close the connection with the IM server */
 		#ifdef X_HAVE_UTF8_STRING
 		if (SDL_IC != NULL) {
-			pXDestroyIC(SDL_IC);
+			XDestroyIC(SDL_IC);
 			SDL_IC = NULL;
 		}
 		if (SDL_IM != NULL) {
-			pXCloseIM(SDL_IM);
+			XCloseIM(SDL_IM);
 			SDL_IM = NULL;
 		}
 		#endif
@@ -1353,7 +1356,7 @@
 		X11_DestroyWindow(this, this->screen);
 		X11_FreeVideoModes(this);
 		if ( SDL_XColorMap != SDL_DisplayColormap ) {
-			pXFreeColormap(SDL_Display, SDL_XColorMap);
+			XFreeColormap(SDL_Display, SDL_XColorMap);
 		}
 		if ( SDL_iconcolors ) {
 			unsigned long pixel;
@@ -1361,7 +1364,7 @@
 							 SDL_Screen);
 			for(pixel = 0; pixel < 256; ++pixel) {
 				while(SDL_iconcolors[pixel] > 0) {
-					pXFreeColors(GFX_Display,
+					XFreeColors(GFX_Display,
 						    dcmap, &pixel, 1, 0);
 					--SDL_iconcolors[pixel];
 				}
@@ -1382,20 +1385,20 @@
 
 		/* Close the X11 graphics connection */
 		if ( GFX_Display != NULL ) {
-			pXCloseDisplay(GFX_Display);
+			XCloseDisplay(GFX_Display);
 			GFX_Display = NULL;
 		}
 
 		/* Close the X11 display connection */
-		pXCloseDisplay(SDL_Display);
+		XCloseDisplay(SDL_Display);
 		SDL_Display = NULL;
 
 		/* Reset the X11 error handlers */
 		if ( XIO_handler ) {
-			pXSetIOErrorHandler(XIO_handler);
+			XSetIOErrorHandler(XIO_handler);
 		}
 		if ( X_handler ) {
-			pXSetErrorHandler(X_handler);
+			XSetErrorHandler(X_handler);
 		}
 
 		/* Unload GL library after X11 shuts down */
--- a/src/video/x11/SDL_x11wm.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/x11/SDL_x11wm.c	Wed Mar 22 05:00:59 2006 +0000
@@ -116,7 +116,7 @@
 					SDL_iconcolors[i]--;
 				}
 			}
-			pXFreeColors(GFX_Display, dcmap, freelist, nfree, 0);
+			XFreeColors(GFX_Display, dcmap, freelist, nfree, 0);
 		}
 		if(!SDL_iconcolors)
 			SDL_iconcolors = SDL_malloc(256 * sizeof *SDL_iconcolors);
@@ -131,7 +131,7 @@
 			c.green = want[i].g << 8;
 			c.blue = want[i].b << 8;
 			c.flags = DoRed | DoGreen | DoBlue;
-			if(pXAllocColor(GFX_Display, dcmap, &c)) {
+			if(XAllocColor(GFX_Display, dcmap, &c)) {
 				/* got the colour */
 				SDL_iconcolors[c.pixel]++;
 				got[c.pixel] = want[i];
@@ -145,13 +145,13 @@
 			XColor cols[256];
 			for(i = 0; i < 256; i++)
 				cols[i].pixel = i;
-			pXQueryColors(GFX_Display, dcmap, cols, 256);
+			XQueryColors(GFX_Display, dcmap, cols, 256);
 			for(i = 0; i < 256; i++) {
 				got[i].r = cols[i].red >> 8;
 				got[i].g = cols[i].green >> 8;
 				got[i].b = cols[i].blue >> 8;
 				if(!SDL_iconcolors[i]) {
-					if(pXAllocColor(GFX_Display, dcmap,
+					if(XAllocColor(GFX_Display, dcmap,
 							cols + i)) {
 						SDL_iconcolors[i] = 1;
 					} else {
@@ -184,13 +184,13 @@
 	SDL_memset(LSBmask, 0, masksize);
 	for(i = 0; i < masksize; i++)
 		LSBmask[i] = reverse_byte(mask[i]);
-	mask_pixmap = pXCreatePixmapFromBitmapData(SDL_Display, WMwindow,
+	mask_pixmap = XCreatePixmapFromBitmapData(SDL_Display, WMwindow,
 						  (char *)LSBmask,
 						  sicon->w, sicon->h,
 						  1L, 0L, 1);
 
 	/* Transfer the image to an X11 pixmap */
-	icon_image = pXCreateImage(SDL_Display,
+	icon_image = XCreateImage(SDL_Display,
 				  DefaultVisual(SDL_Display, SDL_Screen),
 				  DefaultDepth(SDL_Display, SDL_Screen),
 				  ZPixmap, 0, sicon->pixels,
@@ -198,13 +198,13 @@
 				  32, 0);
 	icon_image->byte_order = (SDL_BYTEORDER == SDL_BIG_ENDIAN)
 		                 ? MSBFirst : LSBFirst;
-	icon_pixmap = pXCreatePixmap(SDL_Display, SDL_Root, sicon->w, sicon->h,
+	icon_pixmap = XCreatePixmap(SDL_Display, SDL_Root, sicon->w, sicon->h,
 				    DefaultDepth(SDL_Display, SDL_Screen));
-	gc = pXCreateGC(SDL_Display, icon_pixmap, 0, &GCvalues);
-	pXPutImage(SDL_Display, icon_pixmap, gc, icon_image,
+	gc = XCreateGC(SDL_Display, icon_pixmap, 0, &GCvalues);
+	XPutImage(SDL_Display, icon_pixmap, gc, icon_image,
 		  0, 0, 0, 0, sicon->w, sicon->h);
-	pXFreeGC(SDL_Display, gc);
-	pXDestroyImage(icon_image);
+	XFreeGC(SDL_Display, gc);
+	XDestroyImage(icon_image);
 	SDL_free(LSBmask);
 	sicon->pixels = NULL;
 
@@ -213,17 +213,17 @@
 	   it screws up others. The default is only to use a pixmap. */
 	p = SDL_getenv("SDL_VIDEO_X11_ICONWIN");
 	if(p && *p) {
-		icon_window = pXCreateSimpleWindow(SDL_Display, SDL_Root,
+		icon_window = XCreateSimpleWindow(SDL_Display, SDL_Root,
 						  0, 0, sicon->w, sicon->h, 0,
 						  CopyFromParent,
 						  CopyFromParent);
-		pXSetWindowBackgroundPixmap(SDL_Display, icon_window,
+		XSetWindowBackgroundPixmap(SDL_Display, icon_window,
 					   icon_pixmap);
-		pXClearWindow(SDL_Display, icon_window);
+		XClearWindow(SDL_Display, icon_window);
 	}
 
 	/* Set the window icon to the icon pixmap (and icon window) */
-	wmhints = pXAllocWMHints();
+	wmhints = XAllocWMHints();
 	wmhints->flags = (IconPixmapHint | IconMaskHint);
 	wmhints->icon_pixmap = icon_pixmap;
 	wmhints->icon_mask = mask_pixmap;
@@ -231,9 +231,9 @@
 		wmhints->flags |= IconWindowHint;
 		wmhints->icon_window = icon_window;
 	}
-	pXSetWMHints(SDL_Display, WMwindow, wmhints);
-	pXFree(wmhints);
-	pXSync(SDL_Display, False);
+	XSetWMHints(SDL_Display, WMwindow, wmhints);
+	XFree(wmhints);
+	XSync(SDL_Display, False);
 
   done:
 	SDL_Unlock_EventThread();
@@ -250,8 +250,10 @@
 	Atom _NET_WM_ICON_NAME;
 
 	/* Look up some useful Atoms */
-	_NET_WM_NAME = pXInternAtom(SDL_Display, "_NET_WM_NAME", False);
-	_NET_WM_ICON_NAME = pXInternAtom(SDL_Display, "_NET_WM_ICON_NAME", False);
+	if (SDL_X11_HAVE_UTF8) {
+		_NET_WM_NAME = XInternAtom(SDL_Display, "_NET_WM_NAME", False);
+		_NET_WM_ICON_NAME = XInternAtom(SDL_Display, "_NET_WM_ICON_NAME", False);
+	}
 #endif
 
 	/* Lock the event thread, in multi-threading environments */
@@ -263,18 +265,20 @@
 			SDL_OutOfMemory();
 			return;
 		}
-		status = pXStringListToTextProperty(&title_latin1, 1, &titleprop);
+		status = XStringListToTextProperty(&title_latin1, 1, &titleprop);
 		SDL_free(title_latin1);
 		if ( status ) {
-			pXSetTextProperty(SDL_Display, WMwindow, &titleprop, XA_WM_NAME);
-			pXFree(titleprop.value);
+			XSetTextProperty(SDL_Display, WMwindow, &titleprop, XA_WM_NAME);
+			XFree(titleprop.value);
 		}
 #ifdef X_HAVE_UTF8_STRING
-		status = pXutf8TextListToTextProperty(SDL_Display,
-				(char **)&title, 1, XUTF8StringStyle, &titleprop);
-		if ( status == Success ) {
-			pXSetTextProperty(SDL_Display, WMwindow, &titleprop, _NET_WM_NAME);
-			pXFree(titleprop.value);
+		if (SDL_X11_HAVE_UTF8) {
+			status = Xutf8TextListToTextProperty(SDL_Display,
+					(char **)&title, 1, XUTF8StringStyle, &titleprop);
+			if ( status == Success ) {
+				XSetTextProperty(SDL_Display, WMwindow, &titleprop, _NET_WM_NAME);
+				XFree(titleprop.value);
+			}
 		}
 #endif
 	}
@@ -284,22 +288,24 @@
 			SDL_OutOfMemory();
 			return;
 		}
-		status = pXStringListToTextProperty(&icon_latin1, 1, &iconprop);
+		status = XStringListToTextProperty(&icon_latin1, 1, &iconprop);
 		SDL_free(icon_latin1);
 		if ( status ) {
-			pXSetTextProperty(SDL_Display, WMwindow, &iconprop, XA_WM_ICON_NAME);
-			pXFree(iconprop.value);
+			XSetTextProperty(SDL_Display, WMwindow, &iconprop, XA_WM_ICON_NAME);
+			XFree(iconprop.value);
 		}
 #ifdef X_HAVE_UTF8_STRING
-		status = pXutf8TextListToTextProperty(SDL_Display,
-				(char **)&icon, 1, XUTF8StringStyle, &iconprop);
-		if ( status == Success ) {
-			pXSetTextProperty(SDL_Display, WMwindow, &iconprop, _NET_WM_ICON_NAME);
-			pXFree(iconprop.value);
+		if (SDL_X11_HAVE_UTF8) {
+			status = Xutf8TextListToTextProperty(SDL_Display,
+					(char **)&icon, 1, XUTF8StringStyle, &iconprop);
+			if ( status == Success ) {
+				XSetTextProperty(SDL_Display, WMwindow, &iconprop, _NET_WM_ICON_NAME);
+				XFree(iconprop.value);
+			}
 		}
 #endif
 	}
-	pXSync(SDL_Display, False);
+	XSync(SDL_Display, False);
 
 	SDL_Unlock_EventThread();
 }
@@ -310,8 +316,8 @@
 	int result;
 
 	SDL_Lock_EventThread();
-	result = pXIconifyWindow(SDL_Display, WMwindow, SDL_Screen);
-	pXSync(SDL_Display, False);
+	result = XIconifyWindow(SDL_Display, WMwindow, SDL_Screen);
+	XSync(SDL_Display, False);
 	SDL_Unlock_EventThread();
 	return(result);
 }
@@ -327,12 +333,12 @@
 		return(mode);	/* Will be set later on mode switch */
 	}
 	if ( mode == SDL_GRAB_OFF ) {
-		pXUngrabPointer(SDL_Display, CurrentTime);
-		pXUngrabKeyboard(SDL_Display, CurrentTime);
+		XUngrabPointer(SDL_Display, CurrentTime);
+		XUngrabKeyboard(SDL_Display, CurrentTime);
 	} else {
 		if ( this->screen->flags & SDL_FULLSCREEN ) {
 			/* Unbind the mouse from the fullscreen window */
-			pXUngrabPointer(SDL_Display, CurrentTime);
+			XUngrabPointer(SDL_Display, CurrentTime);
 		}
 		/* Try to grab the mouse */
 #if 0 /* We'll wait here until we actually grab, otherwise behavior undefined */
@@ -340,7 +346,7 @@
 #else
 		while ( 1 ) {
 #endif
-			result = pXGrabPointer(SDL_Display, SDL_Window, True, 0,
+			result = XGrabPointer(SDL_Display, SDL_Window, True, 0,
 						GrabModeAsync, GrabModeAsync,
 						SDL_Window, None, CurrentTime);
 			if ( result == GrabSuccess ) {
@@ -352,17 +358,17 @@
 			/* Uh, oh, what do we do here? */ ;
 		}
 		/* Now grab the keyboard */
-		pXGrabKeyboard(SDL_Display, WMwindow, True,
+		XGrabKeyboard(SDL_Display, WMwindow, True,
 				GrabModeAsync, GrabModeAsync, CurrentTime);
 
 		/* Raise the window if we grab the mouse */
 		if ( !(this->screen->flags & SDL_FULLSCREEN) )
-			pXRaiseWindow(SDL_Display, WMwindow);
+			XRaiseWindow(SDL_Display, WMwindow);
 
 		/* Make sure we register input focus */
 		SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
 	}
-	pXSync(SDL_Display, False);
+	XSync(SDL_Display, False);
 
 	return(mode);
 }
@@ -387,7 +393,7 @@
 {
 	/* Make sure any X11 transactions are completed */
 	SDL_VideoDevice *this = current_video;
-	pXSync(SDL_Display, False);
+	XSync(SDL_Display, False);
 	SDL_Unlock_EventThread();
 }
 int X11_GetWMInfo(_THIS, SDL_SysWMinfo *info)
--- a/src/video/x11/SDL_x11yuv.c	Wed Mar 22 04:51:44 2006 +0000
+++ b/src/video/x11/SDL_x11yuv.c	Wed Mar 22 05:00:59 2006 +0000
@@ -151,7 +151,7 @@
 					}
 				}
 				if ( formats ) {
-					pXFree(formats);
+					XFree(formats);
 				}
 			}
 		}
@@ -200,21 +200,21 @@
 		unsigned int i;
 
 		SDL_NAME(XvSelectPortNotify)(GFX_Display, xv_port, True);
-		X_handler = pXSetErrorHandler(xv_errhandler);
+		X_handler = XSetErrorHandler(xv_errhandler);
 		for ( i=0; i < sizeof(attr)/(sizeof attr[0]); ++i ) {
 			Atom a;
 
 			xv_error = False;
-			a = pXInternAtom(GFX_Display, attr[i], True);
+			a = XInternAtom(GFX_Display, attr[i], True);
 			if ( a != None ) {
      				SDL_NAME(XvSetPortAttribute)(GFX_Display, xv_port, a, 1);
-				pXSync(GFX_Display, True);
+				XSync(GFX_Display, True);
 				if ( ! xv_error ) {
 					break;
 				}
 			}
 		}
-		pXSetErrorHandler(X_handler);
+		XSetErrorHandler(X_handler);
 		SDL_NAME(XvSelectPortNotify)(GFX_Display, xv_port, False);
 	}
 
@@ -254,7 +254,7 @@
 #ifdef PITCH_WORKAROUND
 	if ( hwdata->image != NULL && hwdata->image->pitches[0] != (width*bpp) ) {
 		/* Ajust overlay width according to pitch */ 
-		pXFree(hwdata->image);
+		XFree(hwdata->image);
 		width = hwdata->image->pitches[0] / bpp;
 		hwdata->image = SDL_NAME(XvShmCreateImage)(GFX_Display, xv_port, format,
 							   0, width, height, yuvshm);
@@ -269,10 +269,10 @@
 			yuvshm->readOnly = False;
 			if ( yuvshm->shmaddr != (char *)-1 ) {
 				shm_error = False;
-				X_handler = pXSetErrorHandler(shm_errhandler);
-				pXShmAttach(GFX_Display, yuvshm);
-				pXSync(GFX_Display, True);
-				pXSetErrorHandler(X_handler);
+				X_handler = XSetErrorHandler(shm_errhandler);
+				XShmAttach(GFX_Display, yuvshm);
+				XSync(GFX_Display, True);
+				XSetErrorHandler(X_handler);
 				if ( shm_error )
 					shmdt(yuvshm->shmaddr);
 			} else {
@@ -283,7 +283,7 @@
 			shm_error = True;
 		}
 		if ( shm_error ) {
-			pXFree(hwdata->image);
+			XFree(hwdata->image);
 			hwdata->yuv_use_mitshm = 0;
 		} else {
 			hwdata->image->data = yuvshm->shmaddr;
@@ -298,7 +298,7 @@
 #ifdef PITCH_WORKAROUND
 		if ( hwdata->image != NULL && hwdata->image->pitches[0] != (width*bpp) ) {
 			/* Ajust overlay width according to pitch */ 
-			pXFree(hwdata->image);
+			XFree(hwdata->image);
 			width = hwdata->image->pitches[0] / bpp;
 			hwdata->image = SDL_NAME(XvCreateImage)(GFX_Display, xv_port, format,
 								0, width, height);
@@ -372,7 +372,7 @@
 				     hwdata->image, 0, 0, overlay->w, overlay->h,
 				     dstrect->x, dstrect->y, dstrect->w, dstrect->h);
 	}
-	pXSync(GFX_Display, False);
+	XSync(GFX_Display, False);
 	return(0);
 }
 
@@ -385,12 +385,12 @@
 		SDL_NAME(XvUngrabPort)(GFX_Display, hwdata->port, CurrentTime);
 #ifndef NO_SHARED_MEMORY
 		if ( hwdata->yuv_use_mitshm ) {
-			pXShmDetach(GFX_Display, &hwdata->yuvshm);
+			XShmDetach(GFX_Display, &hwdata->yuvshm);
 			shmdt(hwdata->yuvshm.shmaddr);
 		}
 #endif
 		if ( hwdata->image ) {
-			pXFree(hwdata->image);
+			XFree(hwdata->image);
 		}
 		SDL_free(hwdata);
 	}