Commit 8487ec66 authored by Ryan C. Gordon's avatar Ryan C. Gordon

Updated dynamic X11 code. See details in Bugzilla #170.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401579
parent e0c405fa
/* include/SDL_config.h. Generated by configure. */
/* /*
SDL - Simple DirectMedia Layer SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga Copyright (C) 1997-2006 Sam Lantinga
...@@ -23,56 +24,277 @@ ...@@ -23,56 +24,277 @@
#ifndef _SDL_config_h #ifndef _SDL_config_h
#define _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" #include "SDL_platform.h"
/* Add any platform that doesn't build using the configure system */ /* C language features */
#if defined(__AMIGA__) /* #undef const */
#include "SDL_config_amiga.h" /* #undef inline */
#elif defined(__DREAMCAST__) /* #undef volatile */
#include "SDL_config_dreamcast.h"
#elif defined(__MACOS__) /* C datatypes */
#include "SDL_config_macos.h" /* #undef size_t */
#elif defined(__MACOSX__) /* #undef int8_t */
#include "SDL_config_macosx.h" /* #undef uint8_t */
#elif defined(__WIN32__) /* #undef int16_t */
#include "SDL_config_win32.h" /* #undef uint16_t */
#elif defined(__OS2__) /* #undef int32_t */
#include "SDL_config_os2.h" /* #undef uint32_t */
#else /* #undef int64_t */
/* This is the minimal configuration that can be used to build SDL */ /* #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
/* We may need some replacement for stdarg.h here */
#include <stdarg.h> #include <stdarg.h>
#endif /* HAVE_LIBC */
/* 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; /* Enable various audio drivers */
typedef unsigned char uint8_t; /* #undef SDL_AUDIO_DRIVER_AHI */
typedef signed short int16_t; #define SDL_AUDIO_DRIVER_ALSA 1
typedef unsigned short uint16_t; #define SDL_AUDIO_DRIVER_ALSA_DYNAMIC "libasound.so.2"
typedef signed int int32_t; /* #undef SDL_AUDIO_DRIVER_ARTS */
typedef unsigned int uint32_t; /* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */
typedef unsigned int size_t; /* #undef SDL_AUDIO_DRIVER_BAUDIO */
typedef unsigned long uintptr_t; /* #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) */ /* Enable various cdrom drivers */
#define SDL_AUDIO_DRIVER_DUMMY 1 /* #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) */ /* Enable various input drivers */
#define SDL_CDROM_DISABLED 1 /* #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 the stub joystick driver (src/joystick/dummy/\*.c) */ /* Enable various shared object loading systems */
#define SDL_JOYSTICK_DISABLED 1 /* #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 shared object loader (src/loadso/dummy/\*.c) */ /* Enable various threading systems */
#define SDL_LOADSO_DISABLED 1 /* #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 thread support (src/thread/generic/\*.c) */ /* Enable various timer systems */
#define SDL_THREADS_DISABLED 1 /* #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 timer support (src/timer/dummy/\*.c) */ /* Enable various video drivers */
#define SDL_TIMERS_DISABLED 1 /* #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 dummy video driver (src/video/dummy/\*.c) */ /* Enable OpenGL support */
#define SDL_VIDEO_DRIVER_DUMMY 1 #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 */
#endif /* platform config */ /* Enable assembly routines */
#define SDL_ASSEMBLY_ROUTINES 1
/* #undef SDL_HERMES_BLITTERS */
/* #undef SDL_ALTIVEC_BLITTERS */
#endif /* _SDL_config_h */ #endif /* _SDL_config_h */
...@@ -4,3 +4,4 @@ Makefile ...@@ -4,3 +4,4 @@ Makefile
*.o *.o
*.lo *.lo
*.la *.la
SDL_config.h
...@@ -236,7 +236,7 @@ Bool XiGMiscQueryVersion(Display *dpy, int *major, int *minor) ...@@ -236,7 +236,7 @@ Bool XiGMiscQueryVersion(Display *dpy, int *major, int *minor)
xXiGMiscQueryVersionReply rep; xXiGMiscQueryVersionReply rep;
XExtDisplayInfo *info = XiGMiscFindDisplay(dpy); XExtDisplayInfo *info = XiGMiscFindDisplay(dpy);
if (!pXQueryExtension(dpy, XIGMISC_PROTOCOL_NAME, &opcode, &event, &error)) if (!XQueryExtension(dpy, XIGMISC_PROTOCOL_NAME, &opcode, &event, &error))
return xFalse; return xFalse;
XiGMiscCheckExtension(dpy, info, xFalse); XiGMiscCheckExtension(dpy, info, xFalse);
...@@ -247,7 +247,7 @@ Bool XiGMiscQueryVersion(Display *dpy, int *major, int *minor) ...@@ -247,7 +247,7 @@ Bool XiGMiscQueryVersion(Display *dpy, int *major, int *minor)
req->major = XIGMISC_MAJOR_VERSION; req->major = XIGMISC_MAJOR_VERSION;
req->minor = XIGMISC_MINOR_VERSION; req->minor = XIGMISC_MINOR_VERSION;
if (!p_XReply (dpy, (xReply *)&rep, 0, xTrue)) { if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return xFalse; return xFalse;
...@@ -274,7 +274,7 @@ int XiGMiscQueryViews(Display *dpy, int screen, XiGMiscViewInfo **pviews) ...@@ -274,7 +274,7 @@ int XiGMiscQueryViews(Display *dpy, int screen, XiGMiscViewInfo **pviews)
XiGMiscGetReq (XiGMiscQueryViews, req, info); XiGMiscGetReq (XiGMiscQueryViews, req, info);
req->screen = screen; req->screen = screen;
if (!p_XReply (dpy, (xReply *)&rep, 0, xFalse)) { if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return 0; return 0;
...@@ -286,13 +286,13 @@ int XiGMiscQueryViews(Display *dpy, int screen, XiGMiscViewInfo **pviews) ...@@ -286,13 +286,13 @@ int XiGMiscQueryViews(Display *dpy, int screen, XiGMiscViewInfo **pviews)
size = sizeof(XiGMiscViewInfo) * n; size = sizeof(XiGMiscViewInfo) * n;
views = (XiGMiscViewInfo*)Xmalloc(size); views = (XiGMiscViewInfo*)Xmalloc(size);
if (!views) { if (!views) {
p_XEatData(dpy, (unsigned long)size); _XEatData(dpy, (unsigned long)size);
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return 0; return 0;
} }
p_XReadPad(dpy, (void*)views, size); _XReadPad(dpy, (void*)views, size);
*pviews = views; *pviews = views;
} }
...@@ -317,7 +317,7 @@ int XiGMiscQueryResolutions(Display *dpy, int screen, int view, int *pactive, Xi ...@@ -317,7 +317,7 @@ int XiGMiscQueryResolutions(Display *dpy, int screen, int view, int *pactive, Xi
req->screen = screen; req->screen = screen;
req->view = view; req->view = view;
if (!p_XReply (dpy, (xReply *)&rep, 0, xFalse)) { if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return 0; return 0;
...@@ -329,13 +329,13 @@ int XiGMiscQueryResolutions(Display *dpy, int screen, int view, int *pactive, Xi ...@@ -329,13 +329,13 @@ int XiGMiscQueryResolutions(Display *dpy, int screen, int view, int *pactive, Xi
size = sizeof(XiGMiscResolutionInfo) * n; size = sizeof(XiGMiscResolutionInfo) * n;
resolutions = (XiGMiscResolutionInfo*)Xmalloc(size); resolutions = (XiGMiscResolutionInfo*)Xmalloc(size);
if (!resolutions) { if (!resolutions) {
p_XEatData(dpy, (unsigned long)size); _XEatData(dpy, (unsigned long)size);
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return 0; return 0;
} }
p_XReadPad(dpy, (void*)resolutions, size); _XReadPad(dpy, (void*)resolutions, size);
*presolutions = resolutions; *presolutions = resolutions;
*pactive = rep.active; *pactive = rep.active;
...@@ -383,7 +383,7 @@ Bool XiGMiscFullScreen(Display *dpy, int screen, XID window, XID cmap) ...@@ -383,7 +383,7 @@ Bool XiGMiscFullScreen(Display *dpy, int screen, XID window, XID cmap)
req->window = window; req->window = window;
req->cmap = cmap; req->cmap = cmap;
if (!p_XReply (dpy, (xReply *)&rep, 0, xTrue)) { if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return xFalse; return xFalse;
......
...@@ -113,7 +113,7 @@ Status SDL_NAME(XPanoramiXQueryVersion)( ...@@ -113,7 +113,7 @@ Status SDL_NAME(XPanoramiXQueryVersion)(
req->panoramiXReqType = X_PanoramiXQueryVersion; req->panoramiXReqType = X_PanoramiXQueryVersion;
req->clientMajor = PANORAMIX_MAJOR_VERSION; req->clientMajor = PANORAMIX_MAJOR_VERSION;
req->clientMinor = PANORAMIX_MINOR_VERSION; req->clientMinor = PANORAMIX_MINOR_VERSION;
if (!p_XReply (dpy, (xReply *) &rep, 0, xTrue)) { if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy); UnlockDisplay (dpy);
SyncHandle (); SyncHandle ();
return 0; return 0;
...@@ -147,7 +147,7 @@ Status SDL_NAME(XPanoramiXGetState) ( ...@@ -147,7 +147,7 @@ Status SDL_NAME(XPanoramiXGetState) (
req->reqType = info->codes->major_opcode; req->reqType = info->codes->major_opcode;
req->panoramiXReqType = X_PanoramiXGetState; req->panoramiXReqType = X_PanoramiXGetState;
req->window = drawable; req->window = drawable;
if (!p_XReply (dpy, (xReply *) &rep, 0, xTrue)) { if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy); UnlockDisplay (dpy);
SyncHandle (); SyncHandle ();
return 0; return 0;
...@@ -176,7 +176,7 @@ Status SDL_NAME(XPanoramiXGetScreenCount) ( ...@@ -176,7 +176,7 @@ Status SDL_NAME(XPanoramiXGetScreenCount) (
req->reqType = info->codes->major_opcode; req->reqType = info->codes->major_opcode;
req->panoramiXReqType = X_PanoramiXGetScreenCount; req->panoramiXReqType = X_PanoramiXGetScreenCount;
req->window = drawable; req->window = drawable;
if (!p_XReply (dpy, (xReply *) &rep, 0, xTrue)) { if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy); UnlockDisplay (dpy);
SyncHandle (); SyncHandle ();
return 0; return 0;
...@@ -207,7 +207,7 @@ Status SDL_NAME(XPanoramiXGetScreenSize) ( ...@@ -207,7 +207,7 @@ Status SDL_NAME(XPanoramiXGetScreenSize) (
req->panoramiXReqType = X_PanoramiXGetScreenSize; req->panoramiXReqType = X_PanoramiXGetScreenSize;
req->window = drawable; req->window = drawable;
req->screen = screen_num; /* need to define */ req->screen = screen_num; /* need to define */
if (!p_XReply (dpy, (xReply *) &rep, 0, xTrue)) { if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy); UnlockDisplay (dpy);
SyncHandle (); SyncHandle ();
return 0; return 0;
...@@ -287,7 +287,7 @@ SDL_NAME(XineramaQueryScreens)( ...@@ -287,7 +287,7 @@ SDL_NAME(XineramaQueryScreens)(
GetReq (XineramaQueryScreens, req); GetReq (XineramaQueryScreens, req);
req->reqType = info->codes->major_opcode; req->reqType = info->codes->major_opcode;
req->panoramiXReqType = X_XineramaQueryScreens; req->panoramiXReqType = X_XineramaQueryScreens;
if (!p_XReply (dpy, (xReply *) &rep, 0, xFalse)) { if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay (dpy); UnlockDisplay (dpy);
SyncHandle (); SyncHandle ();
return NULL; return NULL;
...@@ -299,7 +299,7 @@ SDL_NAME(XineramaQueryScreens)( ...@@ -299,7 +299,7 @@ SDL_NAME(XineramaQueryScreens)(
int i; int i;
for(i = 0; i < rep.number; 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].screen_number = i;
scrnInfo[i].x_org = scratch.x_org; scrnInfo[i].x_org = scratch.x_org;
scrnInfo[i].y_org = scratch.y_org; scrnInfo[i].y_org = scratch.y_org;
...@@ -309,7 +309,7 @@ SDL_NAME(XineramaQueryScreens)( ...@@ -309,7 +309,7 @@ SDL_NAME(XineramaQueryScreens)(
*number = rep.number; *number = rep.number;
} else } else
p_XEatData(dpy, rep.length << 2); _XEatData(dpy, rep.length << 2);
} }
UnlockDisplay (dpy); UnlockDisplay (dpy);
......
...@@ -121,7 +121,7 @@ SDL_NAME(XvQueryExtension)( ...@@ -121,7 +121,7 @@ SDL_NAME(XvQueryExtension)(
XvGetReq(QueryExtension, req); XvGetReq(QueryExtension, req);
if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) { if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return XvBadExtension; return XvBadExtension;
...@@ -171,7 +171,7 @@ SDL_NAME(XvQueryAdaptors)( ...@@ -171,7 +171,7 @@ SDL_NAME(XvQueryAdaptors)(
/* READ THE REPLY */ /* READ THE REPLY */
if (p_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return(XvBadReply); return(XvBadReply);
...@@ -183,7 +183,7 @@ SDL_NAME(XvQueryAdaptors)( ...@@ -183,7 +183,7 @@ SDL_NAME(XvQueryAdaptors)(
SyncHandle(); SyncHandle();
return(XvBadAlloc); return(XvBadAlloc);
} }
p_XRead (dpy, buffer, size); _XRead (dpy, buffer, size);
u.buffer = buffer; u.buffer = buffer;
...@@ -330,7 +330,7 @@ SDL_NAME(XvQueryEncodings)( ...@@ -330,7 +330,7 @@ SDL_NAME(XvQueryEncodings)(
/* READ THE REPLY */ /* READ THE REPLY */
if (p_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return(XvBadReply); return(XvBadReply);
...@@ -342,7 +342,7 @@ SDL_NAME(XvQueryEncodings)( ...@@ -342,7 +342,7 @@ SDL_NAME(XvQueryEncodings)(
SyncHandle(); SyncHandle();
return(XvBadAlloc); return(XvBadAlloc);
} }
p_XRead (dpy, buffer, size); _XRead (dpy, buffer, size);
u.buffer = buffer; u.buffer = buffer;
...@@ -617,7 +617,7 @@ SDL_NAME(XvGrabPort)( ...@@ -617,7 +617,7 @@ SDL_NAME(XvGrabPort)(
req->port = port; req->port = port;
req->time = time; req->time = time;
if (p_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0)
rep.result = GrabSuccess; rep.result = GrabSuccess;
result = rep.result; result = rep.result;
...@@ -745,7 +745,7 @@ SDL_NAME(XvGetPortAttribute) ( ...@@ -745,7 +745,7 @@ SDL_NAME(XvGetPortAttribute) (
/* READ THE REPLY */ /* READ THE REPLY */
if (p_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return(XvBadReply); return(XvBadReply);
...@@ -790,7 +790,7 @@ SDL_NAME(XvQueryBestSize)( ...@@ -790,7 +790,7 @@ SDL_NAME(XvQueryBestSize)(
/* READ THE REPLY */ /* READ THE REPLY */
if (p_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return(XvBadReply); return(XvBadReply);
...@@ -825,7 +825,7 @@ SDL_NAME(XvQueryPortAttributes)(Display *dpy, XvPortID port, int *num) ...@@ -825,7 +825,7 @@ SDL_NAME(XvQueryPortAttributes)(Display *dpy, XvPortID port, int *num)
/* READ THE REPLY */ /* READ THE REPLY */
if (p_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return ret; return ret;
...@@ -840,17 +840,17 @@ SDL_NAME(XvQueryPortAttributes)(Display *dpy, XvPortID port, int *num) ...@@ -840,17 +840,17 @@ SDL_NAME(XvQueryPortAttributes)(Display *dpy, XvPortID port, int *num)
int i; int i;
for(i = 0; i < rep.num_attributes; 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].flags = (int)Info.flags;
ret[i].min_value = Info.min; ret[i].min_value = Info.min;
ret[i].max_value = Info.max; ret[i].max_value = Info.max;
ret[i].name = marker; ret[i].name = marker;
p_XRead(dpy, marker, Info.size); _XRead(dpy, marker, Info.size);
marker += Info.size; marker += Info.size;
(*num)++; (*num)++;
} }
} else } else
p_XEatData(dpy, rep.length << 2); _XEatData(dpy, rep.length << 2);
} }
UnlockDisplay(dpy); UnlockDisplay(dpy);
...@@ -880,7 +880,7 @@ SDL_NAME(XvImageFormatValues) * SDL_NAME(XvListImageFormats) ( ...@@ -880,7 +880,7 @@ SDL_NAME(XvImageFormatValues) * SDL_NAME(XvListImageFormats) (
/* READ THE REPLY */ /* READ THE REPLY */
if (p_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return NULL; return NULL;
...@@ -894,7 +894,7 @@ SDL_NAME(XvImageFormatValues) * SDL_NAME(XvListImageFormats) ( ...@@ -894,7 +894,7 @@ SDL_NAME(XvImageFormatValues) * SDL_NAME(XvListImageFormats) (
int i; int i;
for(i = 0; i < rep.num_formats; 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].id = Info.id;
ret[i].type = Info.type; ret[i].type = Info.type;
ret[i].byte_order = Info.byte_order; ret[i].byte_order = Info.byte_order;
...@@ -920,7 +920,7 @@ SDL_NAME(XvImageFormatValues) * SDL_NAME(XvListImageFormats) ( ...@@ -920,7 +920,7 @@ SDL_NAME(XvImageFormatValues) * SDL_NAME(XvListImageFormats) (
(*num)++; (*num)++;
} }
} else } else
p_XEatData(dpy, rep.length << 2); _XEatData(dpy, rep.length << 2);
} }
UnlockDisplay(dpy); UnlockDisplay(dpy);
...@@ -954,7 +954,7 @@ SDL_NAME(XvImage) * SDL_NAME(XvCreateImage) ( ...@@ -954,7 +954,7 @@ SDL_NAME(XvImage) * SDL_NAME(XvCreateImage) (
/* READ THE REPLY */ /* READ THE REPLY */
if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) { if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return NULL; return NULL;
...@@ -970,10 +970,10 @@ SDL_NAME(XvImage) * SDL_NAME(XvCreateImage) ( ...@@ -970,10 +970,10 @@ SDL_NAME(XvImage) * SDL_NAME(XvCreateImage) (
ret->offsets = ret->pitches + rep.num_planes; ret->offsets = ret->pitches + rep.num_planes;
ret->data = data; ret->data = data;
ret->obdata = NULL; ret->obdata = NULL;
p_XRead(dpy, (char*)(ret->pitches), rep.num_planes << 2); _XRead(dpy, (char*)(ret->pitches), rep.num_planes << 2);
p_XRead(dpy, (char*)(ret->offsets), rep.num_planes << 2); _XRead(dpy, (char*)(ret->offsets), rep.num_planes << 2);
} else } else
p_XEatData(dpy, rep.length << 2); _XEatData(dpy, rep.length << 2);
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
...@@ -1122,7 +1122,7 @@ xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire) ...@@ -1122,7 +1122,7 @@ xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire)
case XvVideoNotify: case XvVideoNotify:
re->xvvideo.type = event->u.u.type & 0x7f; re->xvvideo.type = event->u.u.type & 0x7f;
re->xvvideo.serial = re->xvvideo.serial =
p_XSetLastRequestRead(dpy, (xGenericReply *)event); _XSetLastRequestRead(dpy, (xGenericReply *)event);
re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0); re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0);
re->xvvideo.display = dpy; re->xvvideo.display = dpy;
re->xvvideo.time = event->u.videoNotify.time; re->xvvideo.time = event->u.videoNotify.time;
...@@ -1133,7 +1133,7 @@ xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire) ...@@ -1133,7 +1133,7 @@ xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire)
case XvPortNotify: case XvPortNotify:
re->xvport.type = event->u.u.type & 0x7f; re->xvport.type = event->u.u.type & 0x7f;
re->xvport.serial = re->xvport.serial =
p_XSetLastRequestRead(dpy, (xGenericReply *)event); _XSetLastRequestRead(dpy, (xGenericReply *)event);
re->xvport.send_event = ((event->u.u.type & 0x80) != 0); re->xvport.send_event = ((event->u.u.type & 0x80) != 0);
re->xvport.display = dpy; re->xvport.display = dpy;
re->xvport.time = event->u.portNotify.time; re->xvport.time = event->u.portNotify.time;
......
...@@ -53,7 +53,7 @@ SOFTWARE. ...@@ -53,7 +53,7 @@ SOFTWARE.
#define XvGetReq(name, req) \ #define XvGetReq(name, req) \
WORD64ALIGN\ WORD64ALIGN\
if ((dpy->bufptr + SIZEOF(xv##name##Req)) > dpy->bufmax)\ if ((dpy->bufptr + SIZEOF(xv##name##Req)) > dpy->bufmax)\
p_XFlush(dpy);\ _XFlush(dpy);\
req = (xv##name##Req *)(dpy->last_req = dpy->bufptr);\ req = (xv##name##Req *)(dpy->last_req = dpy->bufptr);\
req->reqType = info->codes->major_opcode;\ req->reqType = info->codes->major_opcode;\
req->xvReqType = xv_##name; \ req->xvReqType = xv_##name; \
...@@ -65,7 +65,7 @@ SOFTWARE. ...@@ -65,7 +65,7 @@ SOFTWARE.
#define XvGetReq(name, req) \ #define XvGetReq(name, req) \
WORD64ALIGN\ WORD64ALIGN\
if ((dpy->bufptr + SIZEOF(xv/**/name/**/Req)) > dpy->bufmax)\ if ((dpy->bufptr + SIZEOF(xv/**/name/**/Req)) > dpy->bufmax)\
p_XFlush(dpy);\ _XFlush(dpy);\
req = (xv/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ req = (xv/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
req->reqType = info->codes->major_opcode;\ req->reqType = info->codes->major_opcode;\
req->xvReqType = xv_/**/name;\ req->xvReqType = xv_/**/name;\
......
...@@ -114,7 +114,7 @@ Bool SDL_NAME(XF86DGAGetVideoLL)( ...@@ -114,7 +114,7 @@ Bool SDL_NAME(XF86DGAGetVideoLL)(
req->reqType = info->codes->major_opcode; req->reqType = info->codes->major_opcode;
req->dgaReqType = X_XF86DGAGetVideoLL; req->dgaReqType = X_XF86DGAGetVideoLL;
req->screen = screen; req->screen = screen;
if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) { if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return False; return False;
...@@ -149,7 +149,7 @@ Bool SDL_NAME(XF86DGADirectVideoLL)( ...@@ -149,7 +149,7 @@ Bool SDL_NAME(XF86DGADirectVideoLL)(
req->enable = enable; req->enable = enable;
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
pXSync(dpy,False); XSync(dpy,False);
return True; return True;
} }
...@@ -170,7 +170,7 @@ Bool SDL_NAME(XF86DGAGetViewPortSize)( ...@@ -170,7 +170,7 @@ Bool SDL_NAME(XF86DGAGetViewPortSize)(
req->reqType = info->codes->major_opcode; req->reqType = info->codes->major_opcode;
req->dgaReqType = X_XF86DGAGetViewPortSize; req->dgaReqType = X_XF86DGAGetViewPortSize;
req->screen = screen; req->screen = screen;
if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) { if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return False; return False;
...@@ -205,7 +205,7 @@ Bool SDL_NAME(XF86DGASetViewPort)( ...@@ -205,7 +205,7 @@ Bool SDL_NAME(XF86DGASetViewPort)(
req->y = y; req->y = y;
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
pXSync(dpy,False); XSync(dpy,False);
return True; return True;
} }
...@@ -226,7 +226,7 @@ Bool SDL_NAME(XF86DGAGetVidPage)( ...@@ -226,7 +226,7 @@ Bool SDL_NAME(XF86DGAGetVidPage)(
req->reqType = info->codes->major_opcode; req->reqType = info->codes->major_opcode;
req->dgaReqType = X_XF86DGAGetVidPage; req->dgaReqType = X_XF86DGAGetVidPage;
req->screen = screen; req->screen = screen;
if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) { if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return False; return False;
...@@ -257,7 +257,7 @@ Bool SDL_NAME(XF86DGASetVidPage)( ...@@ -257,7 +257,7 @@ Bool SDL_NAME(XF86DGASetVidPage)(
req->vpage = vpage; req->vpage = vpage;
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
pXSync(dpy,False); XSync(dpy,False);
return True; return True;
} }
...@@ -279,7 +279,7 @@ Bool SDL_NAME(XF86DGAInstallColormap)( ...@@ -279,7 +279,7 @@ Bool SDL_NAME(XF86DGAInstallColormap)(
req->id = cmap; req->id = cmap;
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
pXSync(dpy,False); XSync(dpy,False);
return True; return True;
} }
...@@ -299,7 +299,7 @@ Bool SDL_NAME(XF86DGAQueryDirectVideo)( ...@@ -299,7 +299,7 @@ Bool SDL_NAME(XF86DGAQueryDirectVideo)(
req->reqType = info->codes->major_opcode; req->reqType = info->codes->major_opcode;
req->dgaReqType = X_XF86DGAQueryDirectVideo; req->dgaReqType = X_XF86DGAQueryDirectVideo;
req->screen = screen; req->screen = screen;
if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) { if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return False; return False;
...@@ -327,7 +327,7 @@ Bool SDL_NAME(XF86DGAViewPortChanged)( ...@@ -327,7 +327,7 @@ Bool SDL_NAME(XF86DGAViewPortChanged)(
req->dgaReqType = X_XF86DGAViewPortChanged; req->dgaReqType = X_XF86DGAViewPortChanged;
req->screen = screen; req->screen = screen;
req->n = n; req->n = n;
if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) { if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return False; return False;
...@@ -600,7 +600,7 @@ SDL_NAME(XF86DGAForkApp)(int screen) ...@@ -600,7 +600,7 @@ SDL_NAME(XF86DGAForkApp)(int screen)
for (i = 0; i < numScrs; i++) { for (i = 0; i < numScrs; i++) {
sp = scrList[i]; sp = scrList[i];
SDL_NAME(XF86DGADirectVideoLL)(sp->display, sp->screen, 0); SDL_NAME(XF86DGADirectVideoLL)(sp->display, sp->screen, 0);
pXSync(sp->display, False); XSync(sp->display, False);
} }
if (WIFEXITED(status)) if (WIFEXITED(status))
_exit(0); _exit(0);
...@@ -660,7 +660,7 @@ XF86cleanup(int sig) ...@@ -660,7 +660,7 @@ XF86cleanup(int sig)
for (i = 0; i < numScrs; i++) { for (i = 0; i < numScrs; i++) {
sp = scrList[i]; sp = scrList[i];
SDL_NAME(XF86DGADirectVideo)(sp->display, sp->screen, 0); SDL_NAME(XF86DGADirectVideo)(sp->display, sp->screen, 0);
pXSync(sp->display, False); XSync(sp->display, False);
} }
_exit(3); _exit(3);
} }
......
...@@ -107,7 +107,7 @@ xdga_wire_to_event( ...@@ -107,7 +107,7 @@ xdga_wire_to_event(
case MotionNotify: case MotionNotify:
mevent = (SDL_NAME(XDGAMotionEvent)*)event; mevent = (SDL_NAME(XDGAMotionEvent)*)event;
mevent->type = wire->u.u.type & 0x7F; mevent->type = wire->u.u.type & 0x7F;
mevent->serial = p_XSetLastRequestRead(dpy, (xGenericReply *)wire); mevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
mevent->display = dpy; mevent->display = dpy;
mevent->screen = wire->u.event.screen; mevent->screen = wire->u.event.screen;
mevent->time = wire->u.event.time; mevent->time = wire->u.event.time;
...@@ -119,7 +119,7 @@ xdga_wire_to_event( ...@@ -119,7 +119,7 @@ xdga_wire_to_event(
case ButtonRelease: case ButtonRelease:
bevent = (SDL_NAME(XDGAButtonEvent)*)event; bevent = (SDL_NAME(XDGAButtonEvent)*)event;
bevent->type = wire->u.u.type & 0x7F; bevent->type = wire->u.u.type & 0x7F;
bevent->serial = p_XSetLastRequestRead(dpy, (xGenericReply *)wire); bevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
bevent->display = dpy; bevent->display = dpy;
bevent->screen = wire->u.event.screen; bevent->screen = wire->u.event.screen;
bevent->time = wire->u.event.time; bevent->time = wire->u.event.time;
...@@ -130,7 +130,7 @@ xdga_wire_to_event( ...@@ -130,7 +130,7 @@ xdga_wire_to_event(
case KeyRelease: case KeyRelease:
kevent = (SDL_NAME(XDGAKeyEvent)*)event; kevent = (SDL_NAME(XDGAKeyEvent)*)event;
kevent->type = wire->u.u.type & 0x7F; kevent->type = wire->u.u.type & 0x7F;
kevent->serial = p_XSetLastRequestRead(dpy, (xGenericReply *)wire); kevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
kevent->display = dpy; kevent->display = dpy;
kevent->screen = wire->u.event.screen; kevent->screen = wire->u.event.screen;
kevent->time = wire->u.event.time; kevent->time = wire->u.event.time;
...@@ -175,7 +175,7 @@ Bool SDL_NAME(XDGAQueryVersion)( ...@@ -175,7 +175,7 @@ Bool SDL_NAME(XDGAQueryVersion)(
GetReq(XDGAQueryVersion, req); GetReq(XDGAQueryVersion, req);
req->reqType = info->codes->major_opcode; req->reqType = info->codes->major_opcode;
req->dgaReqType = X_XDGAQueryVersion; req->dgaReqType = X_XDGAQueryVersion;
if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) { if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return False; return False;
...@@ -192,8 +192,8 @@ Bool SDL_NAME(XDGAQueryVersion)( ...@@ -192,8 +192,8 @@ Bool SDL_NAME(XDGAQueryVersion)(
i < XF86DGANumberEvents; i < XF86DGANumberEvents;
i++, j++) i++, j++)
{ {
pXESetWireToEvent(dpy, j, xdga_wire_to_event); XESetWireToEvent(dpy, j, xdga_wire_to_event);
pXESetEventToWire(dpy, j, xdga_event_to_wire); XESetEventToWire(dpy, j, xdga_event_to_wire);
} }
SDL_NAME(XDGASetClientVersion)(dpy); SDL_NAME(XDGASetClientVersion)(dpy);
} }
...@@ -236,7 +236,7 @@ Bool SDL_NAME(XDGAOpenFramebuffer)( ...@@ -236,7 +236,7 @@ Bool SDL_NAME(XDGAOpenFramebuffer)(
req->reqType = info->codes->major_opcode; req->reqType = info->codes->major_opcode;
req->dgaReqType = X_XDGAOpenFramebuffer; req->dgaReqType = X_XDGAOpenFramebuffer;
req->screen = screen; req->screen = screen;
if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) { if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
return False; return False;
...@@ -244,7 +244,7 @@ Bool SDL_NAME(XDGAOpenFramebuffer)( ...@@ -244,7 +244,7 @@ Bool SDL_NAME(XDGAOpenFramebuffer)(
if(rep.length) { if(rep.length) {
deviceName = Xmalloc(rep.length << 2); deviceName = Xmalloc(rep.length << 2);
p_XRead(dpy, deviceName, rep.length << 2); _XRead(dpy, deviceName, rep.length << 2);
} }
ret = SDL_NAME(XDGAMapFramebuffer)(screen, deviceName, ret = SDL_NAME(XDGAMapFramebuffer)(screen, deviceName,
...@@ -301,7 +301,7 @@ SDL_NAME(XDGAMode)* SDL_NAME(XDGAQueryModes)( ...@@ -301,7 +301,7 @@ SDL_NAME(XDGAMode)* SDL_NAME(XDGAQueryModes)(
req->dgaReqType = X_XDGAQueryModes; req->dgaReqType = X_XDGAQueryModes;
req->screen = screen; req->screen = screen;
if (p_XReply(dpy, (xReply *)&rep, 0, xFalse)) { if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
if(rep.length) { if(rep.length) {
xXDGAModeInfo info; xXDGAModeInfo info;
int i, size; int i, size;
...@@ -315,7 +315,7 @@ SDL_NAME(XDGAMode)* SDL_NAME(XDGAQueryModes)( ...@@ -315,7 +315,7 @@ SDL_NAME(XDGAMode)* SDL_NAME(XDGAQueryModes)(
if(modes) { if(modes) {
for(i = 0; i < rep.number; i++) { 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].num = info.num;
modes[i].verticalRefresh = modes[i].verticalRefresh =
...@@ -343,13 +343,13 @@ SDL_NAME(XDGAMode)* SDL_NAME(XDGAQueryModes)( ...@@ -343,13 +343,13 @@ SDL_NAME(XDGAMode)* SDL_NAME(XDGAQueryModes)(
modes[i].reserved1 = info.reserved1; modes[i].reserved1 = info.reserved1;
modes[i].reserved2 = info.reserved2; modes[i].reserved2 = info.reserved2;
p_XRead(dpy, offset, info.name_size); _XRead(dpy, offset, info.name_size);
modes[i].name = offset; modes[i].name = offset;
offset += info.name_size; offset += info.name_size;
} }
*num = rep.number; *num = rep.number;
} else } else
p_XEatData(dpy, rep.length << 2); _XEatData(dpy, rep.length << 2);
} }
} }
...@@ -382,7 +382,7 @@ SDL_NAME(XDGASetMode)( ...@@ -382,7 +382,7 @@ SDL_NAME(XDGASetMode)(
req->mode = mode; req->mode = mode;
req->pid = pid = XAllocID(dpy); req->pid = pid = XAllocID(dpy);
if (p_XReply(dpy, (xReply *)&rep, 0, xFalse)) { if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
if(rep.length) { if(rep.length) {
xXDGAModeInfo info; xXDGAModeInfo info;
int size; int size;
...@@ -393,7 +393,7 @@ SDL_NAME(XDGASetMode)( ...@@ -393,7 +393,7 @@ SDL_NAME(XDGASetMode)(
dev = (SDL_NAME(XDGADevice)*)Xmalloc(sizeof(SDL_NAME(XDGADevice)) + size); dev = (SDL_NAME(XDGADevice)*)Xmalloc(sizeof(SDL_NAME(XDGADevice)) + size);
if(dev) { if(dev) {
p_XRead(dpy, (char*)(&info), sz_xXDGAModeInfo); _XRead(dpy, (char*)(&info), sz_xXDGAModeInfo);
dev->mode.num = info.num; dev->mode.num = info.num;
dev->mode.verticalRefresh = dev->mode.verticalRefresh =
...@@ -422,7 +422,7 @@ SDL_NAME(XDGASetMode)( ...@@ -422,7 +422,7 @@ SDL_NAME(XDGASetMode)(
dev->mode.reserved2 = info.reserved2; dev->mode.reserved2 = info.reserved2;
dev->mode.name = (char*)(&dev[1]); 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->pixmap = (rep.flags & XDGAPixmap) ? pid : 0;
dev->data = SDL_NAME(XDGAGetMappedMemory)(screen); dev->data = SDL_NAME(XDGAGetMappedMemory)(screen);
...@@ -613,7 +613,7 @@ int SDL_NAME(XDGAGetViewportStatus)( ...@@ -613,7 +613,7 @@ int SDL_NAME(XDGAGetViewportStatus)(
req->reqType = info->codes->major_opcode; req->reqType = info->codes->major_opcode;
req->dgaReqType = X_XDGAGetViewportStatus; req->dgaReqType = X_XDGAGetViewportStatus;
req->screen = screen; req->screen = screen;
if (!p_XReply(dpy, (xReply *)&rep, 0, xFalse)) if (!_XReply(dpy, (xReply *)&rep, 0, xFalse))
status = rep.status; status = rep.status;
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
...@@ -635,7 +635,7 @@ void SDL_NAME(XDGASync)( ...@@ -635,7 +635,7 @@ void SDL_NAME(XDGASync)(
req->reqType = info->codes->major_opcode; req->reqType = info->codes->major_opcode;
req->dgaReqType = X_XDGASync; req->dgaReqType = X_XDGASync;
req->screen = screen; req->screen = screen;
p_XReply(dpy, (xReply *)&rep, 0, xFalse); _XReply(dpy, (xReply *)&rep, 0, xFalse);
UnlockDisplay(dpy); UnlockDisplay(dpy);
SyncHandle(); SyncHandle();
} }
...@@ -662,7 +662,7 @@ void SDL_NAME(XDGAChangePixmapMode)( ...@@ -662,7 +662,7 @@ void SDL_NAME(XDGAChangePixmapMode)(
req->x = *x; req->x = *x;
req->y = *y; req->y = *y;
req->flags = mode; req->flags = mode;
p_XReply(dpy, (xReply *)&rep, 0, xFalse); _XReply(dpy, (xReply *)&rep, 0, xFalse);
*x = rep.x; *x = rep.x;
*y = rep.y; *y = rep.y;
UnlockDisplay(dpy); UnlockDisplay(dpy);
......
This diff is collapsed.
...@@ -175,9 +175,9 @@ extern XExtDisplayInfo *XextFindDisplay( ...@@ -175,9 +175,9 @@ extern XExtDisplayInfo *XextFindDisplay(
#define XextHasExtension(i) ((i) && ((i)->codes)) #define XextHasExtension(i) ((i) && ((i)->codes))
#define XextCheckExtension(dpy,i,name,val) \ #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) \ #define XextSimpleCheckExtension(dpy,i,name) \
if (!XextHasExtension(i)) { pXMissingExtension (dpy, name); return; } if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; }
/* /*
...@@ -190,9 +190,9 @@ extern XExtDisplayInfo *XextFindDisplay( ...@@ -190,9 +190,9 @@ extern XExtDisplayInfo *XextFindDisplay(
XExtDisplayInfo *proc (Display *dpy) \ XExtDisplayInfo *proc (Display *dpy) \
{ \ { \
XExtDisplayInfo *dpyinfo; \ XExtDisplayInfo *dpyinfo; \
if (!extinfo) { if (!(extinfo = pXextCreateExtension())) return NULL; } \ if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \
if (!(dpyinfo = pXextFindDisplay (extinfo, dpy))) \ if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \
dpyinfo = pXextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \ dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \
return dpyinfo; \ return dpyinfo; \
} }
...@@ -202,7 +202,7 @@ XExtDisplayInfo *proc (Display *dpy) \ ...@@ -202,7 +202,7 @@ XExtDisplayInfo *proc (Display *dpy) \
#define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \ #define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \
int proc (Display *dpy, XExtCodes *codes) \ int proc (Display *dpy, XExtCodes *codes) \
{ \ { \
return pXextRemoveDisplay (extinfo, dpy); \ return XextRemoveDisplay (extinfo, dpy); \
} }
#define XEXT_CLOSE_DISPLAY_PROTO(proc) \ #define XEXT_CLOSE_DISPLAY_PROTO(proc) \
...@@ -215,7 +215,7 @@ char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \ ...@@ -215,7 +215,7 @@ char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \
if (code >= 0 && code < nerr) { \ if (code >= 0 && code < nerr) { \
char tmp[256]; \ char tmp[256]; \
SDL_snprintf (tmp, SDL_arraysize(tmp), "%s.%d", extname, code); \ 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 buf; \
} \ } \
return (char *)0; \ return (char *)0; \
......
...@@ -45,7 +45,7 @@ static int DGA_DispatchEvent(_THIS) ...@@ -45,7 +45,7 @@ static int DGA_DispatchEvent(_THIS)
int posted; int posted;
SDL_NAME(XDGAEvent) xevent; SDL_NAME(XDGAEvent) xevent;
pXNextEvent(DGA_Display, (XEvent *)&xevent); XNextEvent(DGA_Display, (XEvent *)&xevent);
posted = 0; posted = 0;
xevent.type -= DGA_event_base; xevent.type -= DGA_event_base;
...@@ -96,7 +96,7 @@ printf("KeyPress (X11 keycode = 0x%X)\n", xkey.keycode); ...@@ -96,7 +96,7 @@ printf("KeyPress (X11 keycode = 0x%X)\n", xkey.keycode);
static XComposeStatus state; static XComposeStatus state;
char keybuf[32]; 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 * FIXME: XLookupString() may yield more than one
* character, so we need a mechanism to allow for * character, so we need a mechanism to allow for
......
...@@ -73,9 +73,9 @@ static int DGA_Available(void) ...@@ -73,9 +73,9 @@ static int DGA_Available(void)
and the DGA 2.0+ extension is available, and we can map mem. and the DGA 2.0+ extension is available, and we can map mem.
*/ */
if ( SDL_X11_LoadSymbols() ) { if ( SDL_X11_LoadSymbols() ) {
if ( (SDL_strncmp(pXDisplayName(display), ":", 1) == 0) || if ( (SDL_strncmp(XDisplayName(display), ":", 1) == 0) ||
(SDL_strncmp(pXDisplayName(display), "unix:", 5) == 0) ) { (SDL_strncmp(XDisplayName(display), "unix:", 5) == 0) ) {
dpy = pXOpenDisplay(display); dpy = XOpenDisplay(display);
if ( dpy ) { if ( dpy ) {
int events, errors, major, minor; int events, errors, major, minor;
...@@ -90,7 +90,7 @@ static int DGA_Available(void) ...@@ -90,7 +90,7 @@ static int DGA_Available(void)
SDL_NAME(XDGACloseFramebuffer)(dpy, screen); SDL_NAME(XDGACloseFramebuffer)(dpy, screen);
} }
} }
pXCloseDisplay(dpy); XCloseDisplay(dpy);
} }
} }
SDL_X11_UnloadSymbols(); SDL_X11_UnloadSymbols();
...@@ -329,7 +329,7 @@ static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -329,7 +329,7 @@ static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat)
/* Open the X11 display */ /* Open the X11 display */
display = NULL; /* Get it from DISPLAY environment variable */ display = NULL; /* Get it from DISPLAY environment variable */
DGA_Display = pXOpenDisplay(display); DGA_Display = XOpenDisplay(display);
if ( DGA_Display == NULL ) { if ( DGA_Display == NULL ) {
SDL_SetError("Couldn't open X11 display"); SDL_SetError("Couldn't open X11 display");
return(-1); return(-1);
...@@ -339,12 +339,12 @@ static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -339,12 +339,12 @@ static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat)
if ( ! SDL_NAME(XDGAQueryExtension)(DGA_Display, &event_base, &error_base) || if ( ! SDL_NAME(XDGAQueryExtension)(DGA_Display, &event_base, &error_base) ||
! SDL_NAME(XDGAQueryVersion)(DGA_Display, &major_version, &minor_version) ) { ! SDL_NAME(XDGAQueryVersion)(DGA_Display, &major_version, &minor_version) ) {
SDL_SetError("DGA extension not available"); SDL_SetError("DGA extension not available");
pXCloseDisplay(DGA_Display); XCloseDisplay(DGA_Display);
return(-1); return(-1);
} }
if ( major_version < 2 ) { if ( major_version < 2 ) {
SDL_SetError("DGA driver requires DGA 2.0 or newer"); SDL_SetError("DGA driver requires DGA 2.0 or newer");
pXCloseDisplay(DGA_Display); XCloseDisplay(DGA_Display);
return(-1); return(-1);
} }
DGA_event_base = event_base; DGA_event_base = event_base;
...@@ -360,10 +360,10 @@ static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -360,10 +360,10 @@ static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat)
int i, num_formats; int i, num_formats;
vformat->BitsPerPixel = DefaultDepth(DGA_Display, DGA_Screen); 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 ) { if ( pix_format == NULL ) {
SDL_SetError("Couldn't determine screen formats"); SDL_SetError("Couldn't determine screen formats");
pXCloseDisplay(DGA_Display); XCloseDisplay(DGA_Display);
return(-1); return(-1);
} }
for ( i=0; i<num_formats; ++i ) { for ( i=0; i<num_formats; ++i ) {
...@@ -372,7 +372,7 @@ static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -372,7 +372,7 @@ static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat)
} }
if ( i != num_formats ) if ( i != num_formats )
vformat->BitsPerPixel = pix_format[i].bits_per_pixel; vformat->BitsPerPixel = pix_format[i].bits_per_pixel;
pXFree((char *)pix_format); XFree((char *)pix_format);
} }
if ( vformat->BitsPerPixel > 8 ) { if ( vformat->BitsPerPixel > 8 ) {
vformat->Rmask = visual->red_mask; vformat->Rmask = visual->red_mask;
...@@ -383,7 +383,7 @@ static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -383,7 +383,7 @@ static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat)
/* Open access to the framebuffer */ /* Open access to the framebuffer */
if ( ! SDL_NAME(XDGAOpenFramebuffer)(DGA_Display, DGA_Screen) ) { if ( ! SDL_NAME(XDGAOpenFramebuffer)(DGA_Display, DGA_Screen) ) {
SDL_SetError("Unable to map the video memory"); SDL_SetError("Unable to map the video memory");
pXCloseDisplay(DGA_Display); XCloseDisplay(DGA_Display);
return(-1); return(-1);
} }
...@@ -403,7 +403,7 @@ static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -403,7 +403,7 @@ static int DGA_VideoInit(_THIS, SDL_PixelFormat *vformat)
} }
} }
UpdateHWInfo(this, modes); UpdateHWInfo(this, modes);
pXFree(modes); XFree(modes);
/* Create the hardware surface lock mutex */ /* Create the hardware surface lock mutex */
hw_lock = SDL_CreateMutex(); hw_lock = SDL_CreateMutex();
...@@ -442,7 +442,7 @@ SDL_Surface *DGA_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -442,7 +442,7 @@ SDL_Surface *DGA_SetVideoMode(_THIS, SDL_Surface *current,
/* Free any previous colormap */ /* Free any previous colormap */
if ( DGA_colormap ) { if ( DGA_colormap ) {
pXFreeColormap(DGA_Display, DGA_colormap); XFreeColormap(DGA_Display, DGA_colormap);
DGA_colormap = 0; DGA_colormap = 0;
} }
...@@ -473,7 +473,7 @@ SDL_Surface *DGA_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -473,7 +473,7 @@ SDL_Surface *DGA_SetVideoMode(_THIS, SDL_Surface *current,
/* Set the video mode */ /* Set the video mode */
mode = SDL_NAME(XDGASetMode)(DGA_Display, DGA_Screen, modes[i].num); mode = SDL_NAME(XDGASetMode)(DGA_Display, DGA_Screen, modes[i].num);
pXFree(modes); XFree(modes);
if ( mode == NULL ) { if ( mode == NULL ) {
SDL_SetError("Unable to switch to requested mode"); SDL_SetError("Unable to switch to requested mode");
return(NULL); return(NULL);
...@@ -821,7 +821,7 @@ static int DGA_FillHWRect(_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color) ...@@ -821,7 +821,7 @@ static int DGA_FillHWRect(_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color)
#endif #endif
SDL_NAME(XDGAFillRectangle)(DGA_Display, DGA_Screen, x, y, w, h, color); SDL_NAME(XDGAFillRectangle)(DGA_Display, DGA_Screen, x, y, w, h, color);
if ( !(this->screen->flags & SDL_DOUBLEBUF) ) { if ( !(this->screen->flags & SDL_DOUBLEBUF) ) {
pXFlush(DGA_Display); XFlush(DGA_Display);
} }
DGA_AddBusySurface(dst); DGA_AddBusySurface(dst);
UNLOCK_DISPLAY(); UNLOCK_DISPLAY();
...@@ -863,7 +863,7 @@ static int HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect, ...@@ -863,7 +863,7 @@ static int HWAccelBlit(SDL_Surface *src, SDL_Rect *srcrect,
srcx, srcy, w, h, dstx, dsty); srcx, srcy, w, h, dstx, dsty);
} }
if ( !(this->screen->flags & SDL_DOUBLEBUF) ) { if ( !(this->screen->flags & SDL_DOUBLEBUF) ) {
pXFlush(DGA_Display); XFlush(DGA_Display);
} }
DGA_AddBusySurface(src); DGA_AddBusySurface(src);
DGA_AddBusySurface(dst); DGA_AddBusySurface(dst);
...@@ -943,7 +943,7 @@ static int DGA_FlipHWSurface(_THIS, SDL_Surface *surface) ...@@ -943,7 +943,7 @@ static int DGA_FlipHWSurface(_THIS, SDL_Surface *surface)
DGA_WaitFlip(this); DGA_WaitFlip(this);
SDL_NAME(XDGASetViewport)(DGA_Display, DGA_Screen, SDL_NAME(XDGASetViewport)(DGA_Display, DGA_Screen,
0, flip_yoffset[flip_page], XDGAFlipRetrace); 0, flip_yoffset[flip_page], XDGAFlipRetrace);
pXFlush(DGA_Display); XFlush(DGA_Display);
UNLOCK_DISPLAY(); UNLOCK_DISPLAY();
was_flipped = 1; was_flipped = 1;
flip_page = !flip_page; flip_page = !flip_page;
...@@ -976,8 +976,8 @@ static int DGA_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) ...@@ -976,8 +976,8 @@ static int DGA_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
xcmap[i].flags = (DoRed|DoGreen|DoBlue); xcmap[i].flags = (DoRed|DoGreen|DoBlue);
} }
LOCK_DISPLAY(); LOCK_DISPLAY();
pXStoreColors(DGA_Display, DGA_colormap, xcmap, ncolors); XStoreColors(DGA_Display, DGA_colormap, xcmap, ncolors);
pXSync(DGA_Display, False); XSync(DGA_Display, False);
UNLOCK_DISPLAY(); UNLOCK_DISPLAY();
SDL_stack_free(xcmap); SDL_stack_free(xcmap);
...@@ -1011,8 +1011,8 @@ int DGA_SetGammaRamp(_THIS, Uint16 *ramp) ...@@ -1011,8 +1011,8 @@ int DGA_SetGammaRamp(_THIS, Uint16 *ramp)
xcmap[i].flags = (DoRed|DoGreen|DoBlue); xcmap[i].flags = (DoRed|DoGreen|DoBlue);
} }
LOCK_DISPLAY(); LOCK_DISPLAY();
pXStoreColors(DGA_Display, DGA_colormap, xcmap, ncolors); XStoreColors(DGA_Display, DGA_colormap, xcmap, ncolors);
pXSync(DGA_Display, False); XSync(DGA_Display, False);
UNLOCK_DISPLAY(); UNLOCK_DISPLAY();
return(0); return(0);
} }
...@@ -1024,7 +1024,7 @@ void DGA_VideoQuit(_THIS) ...@@ -1024,7 +1024,7 @@ void DGA_VideoQuit(_THIS)
if ( DGA_Display ) { if ( DGA_Display ) {
/* Free colormap, if necessary */ /* Free colormap, if necessary */
if ( DGA_colormap ) { if ( DGA_colormap ) {
pXFreeColormap(DGA_Display, DGA_colormap); XFreeColormap(DGA_Display, DGA_colormap);
DGA_colormap = 0; DGA_colormap = 0;
} }
...@@ -1064,6 +1064,6 @@ void DGA_VideoQuit(_THIS) ...@@ -1064,6 +1064,6 @@ void DGA_VideoQuit(_THIS)
DGA_FreeHWSurfaces(this); DGA_FreeHWSurfaces(this);
/* Close up the display */ /* Close up the display */
pXCloseDisplay(DGA_Display); XCloseDisplay(DGA_Display);
} }
} }
...@@ -21,11 +21,10 @@ ...@@ -21,11 +21,10 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#if 0 #if 1
#define DEBUG_DYNAMIC_X11 1 #define DEBUG_DYNAMIC_X11 1
#endif #endif
#define __SDL_NO_REDEFINE_X11_HEADER_SYMS 1
#include "SDL_x11dyn.h" #include "SDL_x11dyn.h"
#ifdef DEBUG_DYNAMIC_X11 #ifdef DEBUG_DYNAMIC_X11
...@@ -41,51 +40,88 @@ static void *x11_handle = NULL; ...@@ -41,51 +40,88 @@ static void *x11_handle = NULL;
static const char *x11ext_library = SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT; static const char *x11ext_library = SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT;
static void *x11ext_handle = NULL; static void *x11ext_handle = NULL;
static void *X11_GetSym(int required, const char *fnname, int *rc) typedef struct
{ {
void *fn = NULL; void *lib;
if (*rc) { /* haven't already failed on a previous lookup? */ const char *libname;
fn = SDL_LoadFunction(x11_handle, fnname); } x11libitem;
#if DEBUG_DYNAMIC_X11
if (fn != NULL)
printf("X11: Found '%s' in libX11 (%p)\n", fnname, fn);
#endif
if (fn == NULL) { /* not found? Check libX11ext ... */ static void *X11_GetSym(const char *fnname, int *rc)
fn = SDL_LoadFunction(x11ext_handle, fnname); {
#if DEBUG_DYNAMIC_X11 int i;
void *fn = NULL;
const x11libitem libs[] =
{
{ x11_handle, "libX11" },
{ x11ext_handle, "libX11ext" },
};
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) if (fn != NULL)
printf("X11: Found '%s' in libXext (%p)\n", fnname, fn); break;
else
printf("X11: Symbol '%s' NOT FOUND!%s\n", fnname,
required ? "" : " (...but not required!)");
#endif
} }
*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; 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 */ #endif /* SDL_VIDEO_DRIVER_X11_DYNAMIC */
/* Define all the function pointers... */ /* Annoying varargs entry point... */
#define SDL_X11_SYM(req,ret,fn,params) ret (*p##fn) params = NULL; #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" #include "SDL_x11sym.h"
#undef SDL_X11_MODULE
#undef SDL_X11_SYM #undef SDL_X11_SYM
static int x11_load_refcount = 0; static int x11_load_refcount = 0;
void SDL_X11_UnloadSymbols(void) void SDL_X11_UnloadSymbols(void)
{ {
#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC
/* Don't actually unload if more than one module is using the libs... */ /* Don't actually unload if more than one module is using the libs... */
if (x11_load_refcount > 0) { if (x11_load_refcount > 0) {
if (--x11_load_refcount == 0) { if (--x11_load_refcount == 0) {
/* set all the function pointers to NULL. */ /* 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" #include "SDL_x11sym.h"
#undef SDL_X11_MODULE
#undef SDL_X11_SYM #undef SDL_X11_SYM
#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC #ifdef X_HAVE_UTF8_STRING
pXCreateIC = NULL;
#endif
if (x11_handle != NULL) { if (x11_handle != NULL) {
SDL_UnloadObject(x11_handle); SDL_UnloadObject(x11_handle);
x11_handle = NULL; x11_handle = NULL;
...@@ -94,35 +130,41 @@ void SDL_X11_UnloadSymbols(void) ...@@ -94,35 +130,41 @@ void SDL_X11_UnloadSymbols(void)
SDL_UnloadObject(x11ext_handle); SDL_UnloadObject(x11ext_handle);
x11ext_handle = NULL; x11ext_handle = NULL;
} }
#endif
} }
} }
#endif
} }
/* returns non-zero if all needed symbols were loaded. */ /* returns non-zero if all needed symbols were loaded. */
int SDL_X11_LoadSymbols(void) 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) { if (x11_load_refcount++ == 0) {
#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC int *thismod = NULL;
x11_handle = SDL_LoadObject(x11_library); x11_handle = SDL_LoadObject(x11_library);
x11ext_handle = SDL_LoadObject(x11ext_library); x11ext_handle = SDL_LoadObject(x11ext_library);
rc = ((x11_handle != NULL) && (x11ext_handle != NULL)); #define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname;
#define SDL_X11_SYM(req,r,fn,arg) p##fn = X11_GetSym(req,#fn, &rc); #define SDL_X11_SYM(a,fn,x,y,z) p##fn = X11_GetSym(#fn,thismod);
#include "SDL_x11sym.h" #include "SDL_x11sym.h"
#undef SDL_X11_SYM #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);
#else
#define SDL_X11_SYM(req,r,fn,arg) p##fn = fn;
#include "SDL_x11sym.h"
#undef SDL_X11_SYM
#endif #endif
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; return rc;
} }
......
...@@ -39,59 +39,40 @@ ...@@ -39,59 +39,40 @@
#endif #endif
/* /*
* Never reference Xlib directly...we might load it dynamically at runtime. * When using the "dynamic X11" functionality, we duplicate all the Xlib
* Even if we don't, for readability, we still use the function pointers * symbols that would be referenced by SDL inside of SDL itself.
* (although the symbol resolution will be done by the loader in that case). * 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 * This allows us to use Xlib as-is when linking against it directly, but
* goals, without having to duplicate those function signatures. * 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 #ifdef __cplusplus
extern "C" { extern "C" {
#endif #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... */ /* evil function signatures... */
typedef Bool (*SDL_X11_XESetWireToEventRetType)(Display*,XEvent*,xEvent*); typedef Bool (*SDL_X11_XESetWireToEventRetType)(Display*,XEvent*,xEvent*);
typedef int (*SDL_X11_XSynchronizeRetType)(Display*); typedef int (*SDL_X11_XSynchronizeRetType)(Display*);
typedef Status (*SDL_X11_XESetEventToWireRetType)(Display*,XEvent*,xEvent*); typedef Status (*SDL_X11_XESetEventToWireRetType)(Display*,XEvent*,xEvent*);
typedef int (*SDL_X11_XSetExtensionErrorHandlerType)(Display *,char *,char *); 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);
#include "SDL_x11sym.h" void SDL_X11_UnloadSymbols(void);
#undef SDL_X11_SYM
/* Macro in the xlib headers, not an actual symbol... */ /* That's really annoying...make this a function pointer no matter what. */
#define pXDestroyImage XDestroyImage #ifdef X_HAVE_UTF8_STRING
extern XIC (*pXCreateIC)(XIM,...);
/* 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
#endif /* !__SDL_NO_REDEFINE_X11_HEADER_SYMS */ /* 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
int SDL_X11_LoadSymbols(void);
void SDL_X11_UnloadSymbols(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -187,13 +187,13 @@ static int X11_KeyRepeat(Display *display, XEvent *event) ...@@ -187,13 +187,13 @@ static int X11_KeyRepeat(Display *display, XEvent *event)
int repeated; int repeated;
repeated = 0; repeated = 0;
if ( pXPending(display) ) { if ( XPending(display) ) {
pXPeekEvent(display, &peekevent); XPeekEvent(display, &peekevent);
if ( (peekevent.type == KeyPress) && if ( (peekevent.type == KeyPress) &&
(peekevent.xkey.keycode == event->xkey.keycode) && (peekevent.xkey.keycode == event->xkey.keycode) &&
((peekevent.xkey.time-event->xkey.time) < 2) ) { ((peekevent.xkey.time-event->xkey.time) < 2) ) {
repeated = 1; repeated = 1;
pXNextEvent(display, &peekevent); XNextEvent(display, &peekevent);
} }
} }
return(repeated); return(repeated);
...@@ -228,7 +228,7 @@ static __inline__ int X11_WarpedMotion(_THIS, XEvent *xevent) ...@@ -228,7 +228,7 @@ static __inline__ int X11_WarpedMotion(_THIS, XEvent *xevent)
(xevent->xmotion.y < MOUSE_FUDGE_FACTOR) || (xevent->xmotion.y < MOUSE_FUDGE_FACTOR) ||
(xevent->xmotion.y > (h-MOUSE_FUDGE_FACTOR)) ) { (xevent->xmotion.y > (h-MOUSE_FUDGE_FACTOR)) ) {
/* Get the events that have accumulated */ /* 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; deltax = xevent->xmotion.x - mouse_last.x;
deltay = xevent->xmotion.y - mouse_last.y; deltay = xevent->xmotion.y - mouse_last.y;
#ifdef DEBUG_MOTION #ifdef DEBUG_MOTION
...@@ -240,10 +240,10 @@ static __inline__ int X11_WarpedMotion(_THIS, XEvent *xevent) ...@@ -240,10 +240,10 @@ static __inline__ int X11_WarpedMotion(_THIS, XEvent *xevent)
} }
mouse_last.x = w/2; mouse_last.x = w/2;
mouse_last.y = h/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); mouse_last.x, mouse_last.y);
for ( i=0; i<10; ++i ) { for ( i=0; i<10; ++i ) {
pXMaskEvent(SDL_Display, PointerMotionMask, xevent); XMaskEvent(SDL_Display, PointerMotionMask, xevent);
if ( (xevent->xmotion.x > if ( (xevent->xmotion.x >
(mouse_last.x-MOUSE_FUDGE_FACTOR)) && (mouse_last.x-MOUSE_FUDGE_FACTOR)) &&
(xevent->xmotion.x < (xevent->xmotion.x <
...@@ -273,7 +273,7 @@ static int X11_DispatchEvent(_THIS) ...@@ -273,7 +273,7 @@ static int X11_DispatchEvent(_THIS)
XEvent xevent; XEvent xevent;
SDL_memset(&xevent, '\0', sizeof (XEvent)); /* valgrind fix. --ryan. */ SDL_memset(&xevent, '\0', sizeof (XEvent)); /* valgrind fix. --ryan. */
pXNextEvent(SDL_Display, &xevent); XNextEvent(SDL_Display, &xevent);
posted = 0; posted = 0;
switch (xevent.type) { switch (xevent.type) {
...@@ -332,7 +332,7 @@ printf("FocusIn!\n"); ...@@ -332,7 +332,7 @@ printf("FocusIn!\n");
#ifdef X_HAVE_UTF8_STRING #ifdef X_HAVE_UTF8_STRING
if ( SDL_IC != NULL ) { if ( SDL_IC != NULL ) {
pXSetICFocus(SDL_IC); XSetICFocus(SDL_IC);
} }
#endif #endif
/* Queue entry into fullscreen mode */ /* Queue entry into fullscreen mode */
...@@ -350,7 +350,7 @@ printf("FocusOut!\n"); ...@@ -350,7 +350,7 @@ printf("FocusOut!\n");
#ifdef X_HAVE_UTF8_STRING #ifdef X_HAVE_UTF8_STRING
if ( SDL_IC != NULL ) { if ( SDL_IC != NULL ) {
pXUnsetICFocus(SDL_IC); XUnsetICFocus(SDL_IC);
} }
#endif #endif
/* Queue leaving fullscreen mode */ /* Queue leaving fullscreen mode */
...@@ -433,7 +433,7 @@ printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode); ...@@ -433,7 +433,7 @@ printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode);
break; break;
} }
if ( pXFilterEvent(&xevent, None) ) { if ( XFilterEvent(&xevent, None) ) {
if ( xevent.xkey.keycode ) { if ( xevent.xkey.keycode ) {
posted = SDL_PrivateKeyboard(SDL_PRESSED, &keysym); posted = SDL_PrivateKeyboard(SDL_PRESSED, &keysym);
} else { } else {
...@@ -450,7 +450,7 @@ printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode); ...@@ -450,7 +450,7 @@ printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode);
static Status state; static Status state;
/* A UTF-8 character can be at most 6 bytes */ /* A UTF-8 character can be at most 6 bytes */
char keybuf[6]; char keybuf[6];
if ( pXutf8LookupString(SDL_IC, &xevent.xkey, if ( Xutf8LookupString(SDL_IC, &xevent.xkey,
keybuf, sizeof(keybuf), keybuf, sizeof(keybuf),
NULL, &state) ) { NULL, &state) ) {
keysym.unicode = Utf8ToUcs4((Uint8*)keybuf); keysym.unicode = Utf8ToUcs4((Uint8*)keybuf);
...@@ -462,7 +462,7 @@ printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode); ...@@ -462,7 +462,7 @@ printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode);
static XComposeStatus state; static XComposeStatus state;
char keybuf[32]; char keybuf[32];
if ( pXLookupString(&xevent.xkey, if ( XLookupString(&xevent.xkey,
keybuf, sizeof(keybuf), keybuf, sizeof(keybuf),
NULL, &state) ) { NULL, &state) ) {
/* /*
...@@ -622,8 +622,8 @@ printf("Unhandled event %d\n", xevent.type); ...@@ -622,8 +622,8 @@ printf("Unhandled event %d\n", xevent.type);
int X11_Pending(Display *display) int X11_Pending(Display *display)
{ {
/* Flush the display connection and look to see if events are queued */ /* Flush the display connection and look to see if events are queued */
pXFlush(display); XFlush(display);
if ( pXEventsQueued(display, QueuedAlready) ) { if ( XEventsQueued(display, QueuedAlready) ) {
return(1); return(1);
} }
...@@ -637,7 +637,7 @@ int X11_Pending(Display *display) ...@@ -637,7 +637,7 @@ int X11_Pending(Display *display)
FD_ZERO(&fdset); FD_ZERO(&fdset);
FD_SET(x11_fd, &fdset); FD_SET(x11_fd, &fdset);
if ( select(x11_fd+1, &fdset, NULL, NULL, &zero_time) == 1 ) { if ( select(x11_fd+1, &fdset, NULL, NULL, &zero_time) == 1 ) {
return(pXPending(display)); return(XPending(display));
} }
} }
...@@ -827,7 +827,7 @@ SDLKey X11_TranslateKeycode(Display *display, KeyCode kc) ...@@ -827,7 +827,7 @@ SDLKey X11_TranslateKeycode(Display *display, KeyCode kc)
KeySym xsym; KeySym xsym;
SDLKey key; SDLKey key;
xsym = pXKeycodeToKeysym(display, kc, 0); xsym = XKeycodeToKeysym(display, kc, 0);
#ifdef DEBUG_KEYS #ifdef DEBUG_KEYS
fprintf(stderr, "Translating key code %d -> 0x%.4x\n", kc, xsym); fprintf(stderr, "Translating key code %d -> 0x%.4x\n", kc, xsym);
#endif #endif
...@@ -914,12 +914,12 @@ static void get_modifier_masks(Display *display) ...@@ -914,12 +914,12 @@ static void get_modifier_masks(Display *display)
if(got_masks) if(got_masks)
return; return;
xmods = pXGetModifierMapping(display); xmods = XGetModifierMapping(display);
n = xmods->max_keypermod; n = xmods->max_keypermod;
for(i = 3; i < 8; i++) { for(i = 3; i < 8; i++) {
for(j = 0; j < n; j++) { for(j = 0; j < n; j++) {
KeyCode kc = xmods->modifiermap[i * 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; unsigned mask = 1 << i;
switch(ks) { switch(ks) {
case XK_Num_Lock: case XK_Num_Lock:
...@@ -937,7 +937,7 @@ static void get_modifier_masks(Display *display) ...@@ -937,7 +937,7 @@ static void get_modifier_masks(Display *display)
} }
} }
} }
pXFreeModifiermap(xmods); XFreeModifiermap(xmods);
got_masks = 1; got_masks = 1;
} }
...@@ -979,7 +979,7 @@ Uint16 X11_KeyToUnicode(SDLKey keysym, SDLMod modifiers) ...@@ -979,7 +979,7 @@ Uint16 X11_KeyToUnicode(SDLKey keysym, SDLMod modifiers)
} }
} }
xkey.keycode = pXKeysymToKeycode(xkey.display, xsym); xkey.keycode = XKeysymToKeycode(xkey.display, xsym);
get_modifier_masks(SDL_Display); get_modifier_masks(SDL_Display);
if(modifiers & KMOD_SHIFT) if(modifiers & KMOD_SHIFT)
...@@ -1002,7 +1002,7 @@ Uint16 X11_KeyToUnicode(SDLKey keysym, SDLMod modifiers) ...@@ -1002,7 +1002,7 @@ Uint16 X11_KeyToUnicode(SDLKey keysym, SDLMod modifiers)
xkey.state |= num_mask; xkey.state |= num_mask;
unicode = 0; unicode = 0;
if ( pXLookupString(&xkey, keybuf, sizeof(keybuf), NULL, NULL) ) if ( XLookupString(&xkey, keybuf, sizeof(keybuf), NULL, NULL) )
unicode = (unsigned char)keybuf[0]; unicode = (unsigned char)keybuf[0];
return(unicode); return(unicode);
} }
...@@ -1025,14 +1025,14 @@ void X11_SetKeyboardState(Display *display, const char *key_vec) ...@@ -1025,14 +1025,14 @@ void X11_SetKeyboardState(Display *display, const char *key_vec)
/* The first time the window is mapped, we initialize key state */ /* The first time the window is mapped, we initialize key state */
if ( ! key_vec ) { if ( ! key_vec ) {
pXQueryKeymap(display, keys_return); XQueryKeymap(display, keys_return);
key_vec = keys_return; key_vec = keys_return;
} }
/* Get the keyboard modifier state */ /* Get the keyboard modifier state */
modstate = 0; modstate = 0;
get_modifier_masks(display); get_modifier_masks(display);
if ( pXQueryPointer(display, DefaultRootWindow(display), if ( XQueryPointer(display, DefaultRootWindow(display),
&junk_window, &junk_window, &x, &y, &x, &y, &mask) ) { &junk_window, &junk_window, &x, &y, &x, &y, &mask) ) {
if ( mask & LockMask ) { if ( mask & LockMask ) {
modstate |= KMOD_CAPS; modstate |= KMOD_CAPS;
......
...@@ -64,7 +64,7 @@ static int X11_SetGammaNoLock(_THIS, float red, float green, float blue) ...@@ -64,7 +64,7 @@ static int X11_SetGammaNoLock(_THIS, float red, float green, float blue)
} }
if ( SDL_GetAppState() & SDL_APPACTIVE ) { if ( SDL_GetAppState() & SDL_APPACTIVE ) {
succeeded = SDL_NAME(XF86VidModeSetGamma)(SDL_Display, SDL_Screen, &gamma); succeeded = SDL_NAME(XF86VidModeSetGamma)(SDL_Display, SDL_Screen, &gamma);
pXSync(SDL_Display, False); XSync(SDL_Display, False);
} else { } else {
gamma_saved[0] = gamma.red; gamma_saved[0] = gamma.red;
gamma_saved[1] = gamma.green; gamma_saved[1] = gamma.green;
......
...@@ -64,10 +64,10 @@ XVisualInfo *X11_GL_GetVisual(_THIS) ...@@ -64,10 +64,10 @@ XVisualInfo *X11_GL_GetVisual(_THIS)
XVisualInfo vi_in; XVisualInfo vi_in;
int out_count; int out_count;
pXGetWindowAttributes(SDL_Display, SDL_Window, &a); XGetWindowAttributes(SDL_Display, SDL_Window, &a);
vi_in.screen = SDL_Screen; vi_in.screen = SDL_Screen;
vi_in.visualid = pXVisualIDFromVisual(a.visual); vi_in.visualid = XVisualIDFromVisual(a.visual);
glx_visualinfo = pXGetVisualInfo(SDL_Display, glx_visualinfo = XGetVisualInfo(SDL_Display,
VisualScreenMask|VisualIDMask, &vi_in, &out_count); VisualScreenMask|VisualIDMask, &vi_in, &out_count);
return glx_visualinfo; return glx_visualinfo;
} }
...@@ -186,7 +186,7 @@ int X11_GL_CreateWindow(_THIS, int w, int h) ...@@ -186,7 +186,7 @@ int X11_GL_CreateWindow(_THIS, int w, int h)
attributes.colormap = SDL_XColorMap; attributes.colormap = SDL_XColorMap;
mask = CWBackPixel | CWBorderPixel | CWColormap; mask = CWBackPixel | CWBorderPixel | CWColormap;
SDL_Window = pXCreateWindow(SDL_Display, WMwindow, SDL_Window = XCreateWindow(SDL_Display, WMwindow,
0, 0, w, h, 0, glx_visualinfo->depth, 0, 0, w, h, 0, glx_visualinfo->depth,
InputOutput, glx_visualinfo->visual, InputOutput, glx_visualinfo->visual,
mask, &attributes); mask, &attributes);
...@@ -207,10 +207,10 @@ int X11_GL_CreateContext(_THIS) ...@@ -207,10 +207,10 @@ int X11_GL_CreateContext(_THIS)
int retval; int retval;
#if SDL_VIDEO_OPENGL_GLX #if SDL_VIDEO_OPENGL_GLX
/* We do this to create a clean separation between X and GLX errors. */ /* 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_context = this->gl_data->glXCreateContext(GFX_Display,
glx_visualinfo, NULL, True); glx_visualinfo, NULL, True);
pXSync( GFX_Display, False ); XSync( GFX_Display, False );
if (glx_context == NULL) { if (glx_context == NULL) {
SDL_SetError("Could not create GL context"); SDL_SetError("Could not create GL context");
...@@ -258,7 +258,7 @@ int X11_GL_MakeCurrent(_THIS) ...@@ -258,7 +258,7 @@ int X11_GL_MakeCurrent(_THIS)
SDL_SetError("Unable to make GL context current"); SDL_SetError("Unable to make GL context current");
retval = -1; retval = -1;
} }
pXSync( GFX_Display, False ); XSync( GFX_Display, False );
/* More Voodoo X server workarounds... Grr... */ /* More Voodoo X server workarounds... Grr... */
SDL_Lock_EventThread(); SDL_Lock_EventThread();
......
...@@ -44,6 +44,10 @@ static int shm_errhandler(Display *d, XErrorEvent *e) ...@@ -44,6 +44,10 @@ static int shm_errhandler(Display *d, XErrorEvent *e)
static void try_mitshm(_THIS, SDL_Surface *screen) 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) if(!use_mitshm)
return; return;
shminfo.shmid = shmget(IPC_PRIVATE, screen->h*screen->pitch, shminfo.shmid = shmget(IPC_PRIVATE, screen->h*screen->pitch,
...@@ -53,10 +57,10 @@ static void try_mitshm(_THIS, SDL_Surface *screen) ...@@ -53,10 +57,10 @@ static void try_mitshm(_THIS, SDL_Surface *screen)
shminfo.readOnly = False; shminfo.readOnly = False;
if ( shminfo.shmaddr != (char *)-1 ) { if ( shminfo.shmaddr != (char *)-1 ) {
shm_error = False; shm_error = False;
X_handler = pXSetErrorHandler(shm_errhandler); X_handler = XSetErrorHandler(shm_errhandler);
pXShmAttach(SDL_Display, &shminfo); XShmAttach(SDL_Display, &shminfo);
pXSync(SDL_Display, True); XSync(SDL_Display, True);
pXSetErrorHandler(X_handler); XSetErrorHandler(X_handler);
if ( shm_error ) if ( shm_error )
shmdt(shminfo.shmaddr); shmdt(shminfo.shmaddr);
} else { } else {
...@@ -82,13 +86,13 @@ int X11_SetupImage(_THIS, SDL_Surface *screen) ...@@ -82,13 +86,13 @@ int X11_SetupImage(_THIS, SDL_Surface *screen)
#ifndef NO_SHARED_MEMORY #ifndef NO_SHARED_MEMORY
try_mitshm(this, screen); try_mitshm(this, screen);
if(use_mitshm) { if(use_mitshm) {
SDL_Ximage = pXShmCreateImage(SDL_Display, SDL_Visual, SDL_Ximage = XShmCreateImage(SDL_Display, SDL_Visual,
this->hidden->depth, ZPixmap, this->hidden->depth, ZPixmap,
shminfo.shmaddr, &shminfo, shminfo.shmaddr, &shminfo,
screen->w, screen->h); screen->w, screen->h);
if(!SDL_Ximage) { if(!SDL_Ximage) {
pXShmDetach(SDL_Display, &shminfo); XShmDetach(SDL_Display, &shminfo);
pXSync(SDL_Display, False); XSync(SDL_Display, False);
shmdt(shminfo.shmaddr); shmdt(shminfo.shmaddr);
screen->pixels = NULL; screen->pixels = NULL;
goto error; goto error;
...@@ -105,7 +109,7 @@ int X11_SetupImage(_THIS, SDL_Surface *screen) ...@@ -105,7 +109,7 @@ int X11_SetupImage(_THIS, SDL_Surface *screen)
return -1; return -1;
} }
bpp = screen->format->BytesPerPixel; bpp = screen->format->BytesPerPixel;
SDL_Ximage = pXCreateImage(SDL_Display, SDL_Visual, SDL_Ximage = XCreateImage(SDL_Display, SDL_Visual,
this->hidden->depth, ZPixmap, 0, this->hidden->depth, ZPixmap, 0,
(char *)screen->pixels, (char *)screen->pixels,
screen->w, screen->h, screen->w, screen->h,
...@@ -128,11 +132,11 @@ error: ...@@ -128,11 +132,11 @@ error:
void X11_DestroyImage(_THIS, SDL_Surface *screen) void X11_DestroyImage(_THIS, SDL_Surface *screen)
{ {
if ( SDL_Ximage ) { if ( SDL_Ximage ) {
pXDestroyImage(SDL_Ximage); XDestroyImage(SDL_Ximage);
#ifndef NO_SHARED_MEMORY #ifndef NO_SHARED_MEMORY
if ( use_mitshm ) { if ( use_mitshm ) {
pXShmDetach(SDL_Display, &shminfo); XShmDetach(SDL_Display, &shminfo);
pXSync(SDL_Display, False); XSync(SDL_Display, False);
shmdt(shminfo.shmaddr); shmdt(shminfo.shmaddr);
} }
#endif /* ! NO_SHARED_MEMORY */ #endif /* ! NO_SHARED_MEMORY */
...@@ -213,7 +217,7 @@ void X11_FreeHWSurface(_THIS, SDL_Surface *surface) ...@@ -213,7 +217,7 @@ void X11_FreeHWSurface(_THIS, SDL_Surface *surface)
int X11_LockHWSurface(_THIS, SDL_Surface *surface) int X11_LockHWSurface(_THIS, SDL_Surface *surface)
{ {
if ( (surface == SDL_VideoSurface) && blit_queued ) { if ( (surface == SDL_VideoSurface) && blit_queued ) {
pXSync(GFX_Display, False); XSync(GFX_Display, False);
blit_queued = 0; blit_queued = 0;
} }
return(0); return(0);
...@@ -236,15 +240,15 @@ static void X11_NormalUpdate(_THIS, int numrects, SDL_Rect *rects) ...@@ -236,15 +240,15 @@ static void X11_NormalUpdate(_THIS, int numrects, SDL_Rect *rects)
if ( rects[i].w == 0 || rects[i].h == 0 ) { /* Clipped? */ if ( rects[i].w == 0 || rects[i].h == 0 ) { /* Clipped? */
continue; 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].x, rects[i].y, rects[i].w, rects[i].h); rects[i].x, rects[i].y, rects[i].w, rects[i].h);
} }
if ( SDL_VideoSurface->flags & SDL_ASYNCBLIT ) { if ( SDL_VideoSurface->flags & SDL_ASYNCBLIT ) {
pXFlush(GFX_Display); XFlush(GFX_Display);
blit_queued = 1; blit_queued = 1;
} else { } else {
pXSync(GFX_Display, False); XSync(GFX_Display, False);
} }
} }
...@@ -257,16 +261,16 @@ static void X11_MITSHMUpdate(_THIS, int numrects, SDL_Rect *rects) ...@@ -257,16 +261,16 @@ static void X11_MITSHMUpdate(_THIS, int numrects, SDL_Rect *rects)
if ( rects[i].w == 0 || rects[i].h == 0 ) { /* Clipped? */ if ( rects[i].w == 0 || rects[i].h == 0 ) { /* Clipped? */
continue; 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].x, rects[i].y, rects[i].w, rects[i].h, rects[i].x, rects[i].y, rects[i].w, rects[i].h,
False); False);
} }
if ( SDL_VideoSurface->flags & SDL_ASYNCBLIT ) { if ( SDL_VideoSurface->flags & SDL_ASYNCBLIT ) {
pXFlush(GFX_Display); XFlush(GFX_Display);
blit_queued = 1; blit_queued = 1;
} else { } else {
pXSync(GFX_Display, False); XSync(GFX_Display, False);
} }
#endif /* ! NO_SHARED_MEMORY */ #endif /* ! NO_SHARED_MEMORY */
} }
...@@ -300,14 +304,15 @@ void X11_RefreshDisplay(_THIS) ...@@ -300,14 +304,15 @@ void X11_RefreshDisplay(_THIS)
} }
#ifndef NO_SHARED_MEMORY #ifndef NO_SHARED_MEMORY
if ( this->UpdateRects == X11_MITSHMUpdate ) { 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, 0, 0, 0, 0, this->screen->w, this->screen->h,
False); False);
} else } else
#endif /* ! NO_SHARED_MEMORY */ #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); 0, 0, 0, 0, this->screen->w, this->screen->h);
} }
pXSync(SDL_Display, False); XSync(SDL_Display, False);
} }
...@@ -135,7 +135,7 @@ static void set_best_resolution(_THIS, int width, int height) ...@@ -135,7 +135,7 @@ static void set_best_resolution(_THIS, int width, int height)
(modes[i]->vdisplay != mode.vdisplay) ) { (modes[i]->vdisplay != mode.vdisplay) ) {
SDL_NAME(XF86VidModeSwitchToMode)(SDL_Display, SDL_Screen, modes[i]); SDL_NAME(XF86VidModeSwitchToMode)(SDL_Display, SDL_Screen, modes[i]);
} }
pXFree(modes); XFree(modes);
} }
} }
#endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */ #endif /* SDL_VIDEO_DRIVER_X11_VIDMODE */
...@@ -174,7 +174,7 @@ static void set_best_resolution(_THIS, int width, int height) ...@@ -174,7 +174,7 @@ static void set_best_resolution(_THIS, int width, int height)
SDL_modelist[i]->w, SDL_modelist[i]->w,
SDL_modelist[i]->h, SDL_modelist[i]->h,
0); 0);
pXSync(SDL_Display, False); XSync(SDL_Display, False);
} }
} }
} }
...@@ -224,7 +224,7 @@ void X11_WaitMapped(_THIS, Window win) ...@@ -224,7 +224,7 @@ void X11_WaitMapped(_THIS, Window win)
{ {
XEvent event; XEvent event;
do { do {
pXMaskEvent(SDL_Display, StructureNotifyMask, &event); XMaskEvent(SDL_Display, StructureNotifyMask, &event);
} while ( (event.type != MapNotify) || (event.xmap.event != win) ); } while ( (event.type != MapNotify) || (event.xmap.event != win) );
} }
...@@ -233,19 +233,19 @@ void X11_WaitUnmapped(_THIS, Window win) ...@@ -233,19 +233,19 @@ void X11_WaitUnmapped(_THIS, Window win)
{ {
XEvent event; XEvent event;
do { do {
pXMaskEvent(SDL_Display, StructureNotifyMask, &event); XMaskEvent(SDL_Display, StructureNotifyMask, &event);
} while ( (event.type != UnmapNotify) || (event.xunmap.event != win) ); } while ( (event.type != UnmapNotify) || (event.xunmap.event != win) );
} }
static void move_cursor_to(_THIS, int x, int y) 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) static int add_visual(_THIS, int depth, int class)
{ {
XVisualInfo vi; 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; int n = this->hidden->nvisuals;
this->hidden->visuals[n].depth = vi.depth; this->hidden->visuals[n].depth = vi.depth;
this->hidden->visuals[n].visual = vi.visual; this->hidden->visuals[n].visual = vi.visual;
...@@ -261,13 +261,13 @@ static int add_visual_byid(_THIS, const char *visual_id) ...@@ -261,13 +261,13 @@ static int add_visual_byid(_THIS, const char *visual_id)
if ( visual_id ) { if ( visual_id ) {
SDL_memset(&template, 0, (sizeof template)); SDL_memset(&template, 0, (sizeof template));
template.visualid = SDL_strtol(visual_id, NULL, 0); template.visualid = SDL_strtol(visual_id, NULL, 0);
vi = pXGetVisualInfo(SDL_Display, VisualIDMask, &template, &nvis); vi = XGetVisualInfo(SDL_Display, VisualIDMask, &template, &nvis);
if ( vi ) { if ( vi ) {
int n = this->hidden->nvisuals; int n = this->hidden->nvisuals;
this->hidden->visuals[n].depth = vi->depth; this->hidden->visuals[n].depth = vi->depth;
this->hidden->visuals[n].visual = vi->visual; this->hidden->visuals[n].visual = vi->visual;
this->hidden->nvisuals++; this->hidden->nvisuals++;
pXFree(vi); XFree(vi);
} }
} }
return(this->hidden->nvisuals); return(this->hidden->nvisuals);
...@@ -403,7 +403,7 @@ int X11_GetVideoModes(_THIS) ...@@ -403,7 +403,7 @@ int X11_GetVideoModes(_THIS)
} }
SDL_modelist[n] = NULL; SDL_modelist[n] = NULL;
} }
pXFree(modes); XFree(modes);
use_vidmode = vm_major * 100 + vm_minor; use_vidmode = vm_major * 100 + vm_minor;
save_mode(this); save_mode(this);
...@@ -477,7 +477,7 @@ int X11_GetVideoModes(_THIS) ...@@ -477,7 +477,7 @@ int X11_GetVideoModes(_THIS)
use_xme = 0; use_xme = 0;
} }
if ( modelist ) { if ( modelist ) {
pXFree(modelist); XFree(modelist);
} }
#endif /* SDL_VIDEO_DRIVER_X11_XME */ #endif /* SDL_VIDEO_DRIVER_X11_XME */
...@@ -512,7 +512,7 @@ int X11_GetVideoModes(_THIS) ...@@ -512,7 +512,7 @@ int X11_GetVideoModes(_THIS)
} }
/* look up the pixel quantum for each depth */ /* 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++) { for(i = 0; i < this->hidden->nvisuals; i++) {
int d = this->hidden->visuals[i].depth; int d = this->hidden->visuals[i].depth;
for(j = 0; j < np; j++) for(j = 0; j < np; j++)
...@@ -521,7 +521,7 @@ int X11_GetVideoModes(_THIS) ...@@ -521,7 +521,7 @@ int X11_GetVideoModes(_THIS)
this->hidden->visuals[i].bpp = j < np ? pf[j].bits_per_pixel : d; this->hidden->visuals[i].bpp = j < np ? pf[j].bits_per_pixel : d;
} }
pXFree(pf); XFree(pf);
} }
if ( SDL_modelist == NULL ) { if ( SDL_modelist == NULL ) {
...@@ -595,7 +595,7 @@ int X11_GetVideoModes(_THIS) ...@@ -595,7 +595,7 @@ int X11_GetVideoModes(_THIS)
xinerama_y = xinerama[i].y_org; xinerama_y = xinerama[i].y_org;
} }
} }
pXFree(xinerama); XFree(xinerama);
} }
#endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */ #endif /* SDL_VIDEO_DRIVER_X11_XINERAMA */
...@@ -661,15 +661,15 @@ int X11_ResizeFullScreen(_THIS) ...@@ -661,15 +661,15 @@ int X11_ResizeFullScreen(_THIS)
if ( window_h > real_h ) { if ( window_h > real_h ) {
real_h = MAX(real_h, screen_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); move_cursor_to(this, real_w/2, real_h/2);
/* Center and reparent the drawing window */ /* Center and reparent the drawing window */
x = (real_w - window_w)/2; x = (real_w - window_w)/2;
y = (real_h - window_h)/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 */ /* 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); return(1);
} }
...@@ -679,7 +679,7 @@ void X11_QueueEnterFullScreen(_THIS) ...@@ -679,7 +679,7 @@ void X11_QueueEnterFullScreen(_THIS)
switch_waiting = 0x01 | SDL_FULLSCREEN; switch_waiting = 0x01 | SDL_FULLSCREEN;
switch_time = SDL_GetTicks() + 1500; switch_time = SDL_GetTicks() + 1500;
#if 0 /* This causes a BadMatch error if the window is iconified (not needed) */ #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 #endif
} }
...@@ -712,14 +712,14 @@ int X11_EnterFullScreen(_THIS) ...@@ -712,14 +712,14 @@ int X11_EnterFullScreen(_THIS)
if ( window_h > real_h ) { if ( window_h > real_h ) {
real_h = MAX(real_h, screen_h); real_h = MAX(real_h, screen_h);
} }
pXMoveResizeWindow(SDL_Display, FSwindow, XMoveResizeWindow(SDL_Display, FSwindow,
xinerama_x, xinerama_y, real_w, real_h); xinerama_x, xinerama_y, real_w, real_h);
pXMapRaised(SDL_Display, FSwindow); XMapRaised(SDL_Display, FSwindow);
X11_WaitMapped(this, FSwindow); X11_WaitMapped(this, FSwindow);
#if 0 /* This seems to break WindowMaker in focus-follows-mouse mode */ #if 0 /* This seems to break WindowMaker in focus-follows-mouse mode */
/* Make sure we got to the top of the window stack */ /* 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 ) { &windows, &nwindows) && windows ) {
/* If not, try to put us there - if fail... oh well */ /* If not, try to put us there - if fail... oh well */
if ( windows[nwindows-1] != FSwindow ) { if ( windows[nwindows-1] != FSwindow ) {
...@@ -732,13 +732,13 @@ int X11_EnterFullScreen(_THIS) ...@@ -732,13 +732,13 @@ int X11_EnterFullScreen(_THIS)
} }
} }
windows[nwindows-1] = FSwindow; windows[nwindows-1] = FSwindow;
pXRestackWindows(SDL_Display, windows, nwindows); XRestackWindows(SDL_Display, windows, nwindows);
pXSync(SDL_Display, False); XSync(SDL_Display, False);
} }
pXFree(windows); XFree(windows);
} }
#else #else
pXRaiseWindow(SDL_Display, FSwindow); XRaiseWindow(SDL_Display, FSwindow);
#endif #endif
#if SDL_VIDEO_DRIVER_X11_VIDMODE #if SDL_VIDEO_DRIVER_X11_VIDMODE
...@@ -756,7 +756,7 @@ int X11_EnterFullScreen(_THIS) ...@@ -756,7 +756,7 @@ int X11_EnterFullScreen(_THIS)
} }
/* Set the colormap */ /* Set the colormap */
if ( SDL_XColorMap ) { if ( SDL_XColorMap ) {
pXInstallColormap(SDL_Display, SDL_XColorMap); XInstallColormap(SDL_Display, SDL_XColorMap);
} }
if ( okay ) if ( okay )
X11_GrabInputNoLock(this, this->input_grab | SDL_GRAB_FULLSCREEN); X11_GrabInputNoLock(this, this->input_grab | SDL_GRAB_FULLSCREEN);
...@@ -777,7 +777,7 @@ int X11_EnterFullScreen(_THIS) ...@@ -777,7 +777,7 @@ int X11_EnterFullScreen(_THIS)
int X11_LeaveFullScreen(_THIS) int X11_LeaveFullScreen(_THIS)
{ {
if ( currently_fullscreen ) { 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 SDL_VIDEO_DRIVER_X11_VIDMODE
if ( use_vidmode ) { if ( use_vidmode ) {
restore_mode(this); restore_mode(this);
...@@ -799,14 +799,14 @@ int X11_LeaveFullScreen(_THIS) ...@@ -799,14 +799,14 @@ int X11_LeaveFullScreen(_THIS)
saved_res.width, saved_res.width,
saved_res.height, saved_res.height,
0); 0);
pXSync(SDL_Display, False); XSync(SDL_Display, False);
} }
} }
#endif #endif
pXUnmapWindow(SDL_Display, FSwindow); XUnmapWindow(SDL_Display, FSwindow);
X11_WaitUnmapped(this, 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; currently_fullscreen = 0;
} }
/* If we get popped out of fullscreen mode for some reason, input_grab /* If we get popped out of fullscreen mode for some reason, input_grab
......
...@@ -41,8 +41,8 @@ void X11_FreeWMCursor(_THIS, WMcursor *cursor) ...@@ -41,8 +41,8 @@ void X11_FreeWMCursor(_THIS, WMcursor *cursor)
{ {
if ( SDL_Display != NULL ) { if ( SDL_Display != NULL ) {
SDL_Lock_EventThread(); SDL_Lock_EventThread();
pXFreeCursor(SDL_Display, cursor->x_cursor); XFreeCursor(SDL_Display, cursor->x_cursor);
pXSync(SDL_Display, False); XSync(SDL_Display, False);
SDL_Unlock_EventThread(); SDL_Unlock_EventThread();
} }
SDL_free(cursor); SDL_free(cursor);
...@@ -96,48 +96,48 @@ WMcursor *X11_CreateWMCursor(_THIS, ...@@ -96,48 +96,48 @@ WMcursor *X11_CreateWMCursor(_THIS,
SDL_Lock_EventThread(); SDL_Lock_EventThread();
/* Create the data image */ /* Create the data image */
data_image = pXCreateImage(SDL_Display, data_image = XCreateImage(SDL_Display,
DefaultVisual(SDL_Display, SDL_Screen), DefaultVisual(SDL_Display, SDL_Screen),
1, XYBitmap, 0, x_data, w, h, 8, w/8); 1, XYBitmap, 0, x_data, w, h, 8, w/8);
data_image->byte_order = MSBFirst; data_image->byte_order = MSBFirst;
data_image->bitmap_bit_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 */ /* Create the data mask */
mask_image = pXCreateImage(SDL_Display, mask_image = XCreateImage(SDL_Display,
DefaultVisual(SDL_Display, SDL_Screen), DefaultVisual(SDL_Display, SDL_Screen),
1, XYBitmap, 0, x_mask, w, h, 8, w/8); 1, XYBitmap, 0, x_mask, w, h, 8, w/8);
mask_image->byte_order = MSBFirst; mask_image->byte_order = MSBFirst;
mask_image->bitmap_bit_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 */ /* Create the graphics context */
GCvalues.function = GXcopy; GCvalues.function = GXcopy;
GCvalues.foreground = ~0; GCvalues.foreground = ~0;
GCvalues.background = 0; GCvalues.background = 0;
GCvalues.plane_mask = AllPlanes; GCvalues.plane_mask = AllPlanes;
GCcursor = pXCreateGC(SDL_Display, data_pixmap, GCcursor = XCreateGC(SDL_Display, data_pixmap,
(GCFunction|GCForeground|GCBackground|GCPlaneMask), (GCFunction|GCForeground|GCBackground|GCPlaneMask),
&GCvalues); &GCvalues);
/* Blit the images to the pixmaps */ /* 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); 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); 0, 0, 0, 0, w, h);
pXFreeGC(SDL_Display, GCcursor); XFreeGC(SDL_Display, GCcursor);
/* These free the x_data and x_mask memory pointers */ /* These free the x_data and x_mask memory pointers */
pXDestroyImage(data_image); XDestroyImage(data_image);
pXDestroyImage(mask_image); XDestroyImage(mask_image);
/* Create the cursor */ /* 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); mask_pixmap, &black, &white, hot_x, hot_y);
pXFreePixmap(SDL_Display, data_pixmap); XFreePixmap(SDL_Display, data_pixmap);
pXFreePixmap(SDL_Display, mask_pixmap); XFreePixmap(SDL_Display, mask_pixmap);
/* Release the event thread */ /* Release the event thread */
pXSync(SDL_Display, False); XSync(SDL_Display, False);
SDL_Unlock_EventThread(); SDL_Unlock_EventThread();
return(cursor); return(cursor);
...@@ -155,13 +155,13 @@ int X11_ShowWMCursor(_THIS, WMcursor *cursor) ...@@ -155,13 +155,13 @@ int X11_ShowWMCursor(_THIS, WMcursor *cursor)
SDL_Lock_EventThread(); SDL_Lock_EventThread();
if ( cursor == NULL ) { if ( cursor == NULL ) {
if ( SDL_BlankCursor != NULL ) { if ( SDL_BlankCursor != NULL ) {
pXDefineCursor(SDL_Display, SDL_Window, XDefineCursor(SDL_Display, SDL_Window,
SDL_BlankCursor->x_cursor); SDL_BlankCursor->x_cursor);
} }
} else { } 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(); SDL_Unlock_EventThread();
} }
return(1); return(1);
...@@ -178,8 +178,8 @@ void X11_WarpWMCursor(_THIS, Uint16 x, Uint16 y) ...@@ -178,8 +178,8 @@ void X11_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
SDL_PrivateMouseMotion(0, 0, x, y); SDL_PrivateMouseMotion(0, 0, x, y);
} else { } else {
SDL_Lock_EventThread(); SDL_Lock_EventThread();
pXWarpPointer(SDL_Display, None, SDL_Window, 0, 0, 0, 0, x, y); XWarpPointer(SDL_Display, None, SDL_Window, 0, 0, 0, 0, x, y);
pXSync(SDL_Display, False); XSync(SDL_Display, False);
SDL_Unlock_EventThread(); SDL_Unlock_EventThread();
} }
} }
...@@ -217,7 +217,7 @@ static void SetMouseAccel(_THIS, const char *accel_param) ...@@ -217,7 +217,7 @@ static void SetMouseAccel(_THIS, const char *accel_param)
} }
} }
if ( mouse_param_buf ) { if ( mouse_param_buf ) {
pXChangePointerControl(SDL_Display, True, True, XChangePointerControl(SDL_Display, True, True,
accel_value[0], accel_value[1], accel_value[2]); accel_value[0], accel_value[1], accel_value[2]);
SDL_free(mouse_param_buf); SDL_free(mouse_param_buf);
} }
...@@ -250,7 +250,7 @@ void X11_CheckMouseModeNoLock(_THIS) ...@@ -250,7 +250,7 @@ void X11_CheckMouseModeNoLock(_THIS)
SDL_GetMouseState(&mouse_last.x, &mouse_last.y); SDL_GetMouseState(&mouse_last.x, &mouse_last.y);
/* Use as raw mouse mickeys as possible */ /* Use as raw mouse mickeys as possible */
pXGetPointerControl(SDL_Display, XGetPointerControl(SDL_Display,
&mouse_accel.numerator, &mouse_accel.numerator,
&mouse_accel.denominator, &mouse_accel.denominator,
&mouse_accel.threshold); &mouse_accel.threshold);
...@@ -266,7 +266,7 @@ void X11_CheckMouseModeNoLock(_THIS) ...@@ -266,7 +266,7 @@ void X11_CheckMouseModeNoLock(_THIS)
if ( using_dga & DGA_MOUSE ) { if ( using_dga & DGA_MOUSE ) {
X11_DisableDGAMouse(this); X11_DisableDGAMouse(this);
} else { } else {
pXChangePointerControl(SDL_Display, True, True, XChangePointerControl(SDL_Display, True, True,
mouse_accel.numerator, mouse_accel.numerator,
mouse_accel.denominator, mouse_accel.denominator,
mouse_accel.threshold); mouse_accel.threshold);
......
This diff is collapsed.
This diff is collapsed.
...@@ -116,7 +116,7 @@ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask) ...@@ -116,7 +116,7 @@ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
SDL_iconcolors[i]--; SDL_iconcolors[i]--;
} }
} }
pXFreeColors(GFX_Display, dcmap, freelist, nfree, 0); XFreeColors(GFX_Display, dcmap, freelist, nfree, 0);
} }
if(!SDL_iconcolors) if(!SDL_iconcolors)
SDL_iconcolors = SDL_malloc(256 * sizeof *SDL_iconcolors); SDL_iconcolors = SDL_malloc(256 * sizeof *SDL_iconcolors);
...@@ -131,7 +131,7 @@ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask) ...@@ -131,7 +131,7 @@ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
c.green = want[i].g << 8; c.green = want[i].g << 8;
c.blue = want[i].b << 8; c.blue = want[i].b << 8;
c.flags = DoRed | DoGreen | DoBlue; c.flags = DoRed | DoGreen | DoBlue;
if(pXAllocColor(GFX_Display, dcmap, &c)) { if(XAllocColor(GFX_Display, dcmap, &c)) {
/* got the colour */ /* got the colour */
SDL_iconcolors[c.pixel]++; SDL_iconcolors[c.pixel]++;
got[c.pixel] = want[i]; got[c.pixel] = want[i];
...@@ -145,13 +145,13 @@ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask) ...@@ -145,13 +145,13 @@ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
XColor cols[256]; XColor cols[256];
for(i = 0; i < 256; i++) for(i = 0; i < 256; i++)
cols[i].pixel = i; cols[i].pixel = i;
pXQueryColors(GFX_Display, dcmap, cols, 256); XQueryColors(GFX_Display, dcmap, cols, 256);
for(i = 0; i < 256; i++) { for(i = 0; i < 256; i++) {
got[i].r = cols[i].red >> 8; got[i].r = cols[i].red >> 8;
got[i].g = cols[i].green >> 8; got[i].g = cols[i].green >> 8;
got[i].b = cols[i].blue >> 8; got[i].b = cols[i].blue >> 8;
if(!SDL_iconcolors[i]) { if(!SDL_iconcolors[i]) {
if(pXAllocColor(GFX_Display, dcmap, if(XAllocColor(GFX_Display, dcmap,
cols + i)) { cols + i)) {
SDL_iconcolors[i] = 1; SDL_iconcolors[i] = 1;
} else { } else {
...@@ -184,13 +184,13 @@ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask) ...@@ -184,13 +184,13 @@ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
SDL_memset(LSBmask, 0, masksize); SDL_memset(LSBmask, 0, masksize);
for(i = 0; i < masksize; i++) for(i = 0; i < masksize; i++)
LSBmask[i] = reverse_byte(mask[i]); LSBmask[i] = reverse_byte(mask[i]);
mask_pixmap = pXCreatePixmapFromBitmapData(SDL_Display, WMwindow, mask_pixmap = XCreatePixmapFromBitmapData(SDL_Display, WMwindow,
(char *)LSBmask, (char *)LSBmask,
sicon->w, sicon->h, sicon->w, sicon->h,
1L, 0L, 1); 1L, 0L, 1);
/* Transfer the image to an X11 pixmap */ /* Transfer the image to an X11 pixmap */
icon_image = pXCreateImage(SDL_Display, icon_image = XCreateImage(SDL_Display,
DefaultVisual(SDL_Display, SDL_Screen), DefaultVisual(SDL_Display, SDL_Screen),
DefaultDepth(SDL_Display, SDL_Screen), DefaultDepth(SDL_Display, SDL_Screen),
ZPixmap, 0, sicon->pixels, ZPixmap, 0, sicon->pixels,
...@@ -198,13 +198,13 @@ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask) ...@@ -198,13 +198,13 @@ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
32, 0); 32, 0);
icon_image->byte_order = (SDL_BYTEORDER == SDL_BIG_ENDIAN) icon_image->byte_order = (SDL_BYTEORDER == SDL_BIG_ENDIAN)
? MSBFirst : LSBFirst; ? 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)); DefaultDepth(SDL_Display, SDL_Screen));
gc = pXCreateGC(SDL_Display, icon_pixmap, 0, &GCvalues); gc = XCreateGC(SDL_Display, icon_pixmap, 0, &GCvalues);
pXPutImage(SDL_Display, icon_pixmap, gc, icon_image, XPutImage(SDL_Display, icon_pixmap, gc, icon_image,
0, 0, 0, 0, sicon->w, sicon->h); 0, 0, 0, 0, sicon->w, sicon->h);
pXFreeGC(SDL_Display, gc); XFreeGC(SDL_Display, gc);
pXDestroyImage(icon_image); XDestroyImage(icon_image);
SDL_free(LSBmask); SDL_free(LSBmask);
sicon->pixels = NULL; sicon->pixels = NULL;
...@@ -213,17 +213,17 @@ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask) ...@@ -213,17 +213,17 @@ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
it screws up others. The default is only to use a pixmap. */ it screws up others. The default is only to use a pixmap. */
p = SDL_getenv("SDL_VIDEO_X11_ICONWIN"); p = SDL_getenv("SDL_VIDEO_X11_ICONWIN");
if(p && *p) { if(p && *p) {
icon_window = pXCreateSimpleWindow(SDL_Display, SDL_Root, icon_window = XCreateSimpleWindow(SDL_Display, SDL_Root,
0, 0, sicon->w, sicon->h, 0, 0, 0, sicon->w, sicon->h, 0,
CopyFromParent, CopyFromParent,
CopyFromParent); CopyFromParent);
pXSetWindowBackgroundPixmap(SDL_Display, icon_window, XSetWindowBackgroundPixmap(SDL_Display, icon_window,
icon_pixmap); icon_pixmap);
pXClearWindow(SDL_Display, icon_window); XClearWindow(SDL_Display, icon_window);
} }
/* Set the window icon to the icon pixmap (and icon window) */ /* Set the window icon to the icon pixmap (and icon window) */
wmhints = pXAllocWMHints(); wmhints = XAllocWMHints();
wmhints->flags = (IconPixmapHint | IconMaskHint); wmhints->flags = (IconPixmapHint | IconMaskHint);
wmhints->icon_pixmap = icon_pixmap; wmhints->icon_pixmap = icon_pixmap;
wmhints->icon_mask = mask_pixmap; wmhints->icon_mask = mask_pixmap;
...@@ -231,9 +231,9 @@ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask) ...@@ -231,9 +231,9 @@ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
wmhints->flags |= IconWindowHint; wmhints->flags |= IconWindowHint;
wmhints->icon_window = icon_window; wmhints->icon_window = icon_window;
} }
pXSetWMHints(SDL_Display, WMwindow, wmhints); XSetWMHints(SDL_Display, WMwindow, wmhints);
pXFree(wmhints); XFree(wmhints);
pXSync(SDL_Display, False); XSync(SDL_Display, False);
done: done:
SDL_Unlock_EventThread(); SDL_Unlock_EventThread();
...@@ -250,8 +250,10 @@ void X11_SetCaption(_THIS, const char *title, const char *icon) ...@@ -250,8 +250,10 @@ void X11_SetCaption(_THIS, const char *title, const char *icon)
Atom _NET_WM_ICON_NAME; Atom _NET_WM_ICON_NAME;
/* Look up some useful Atoms */ /* Look up some useful Atoms */
_NET_WM_NAME = pXInternAtom(SDL_Display, "_NET_WM_NAME", False); if (SDL_X11_HAVE_UTF8) {
_NET_WM_ICON_NAME = pXInternAtom(SDL_Display, "_NET_WM_ICON_NAME", False); _NET_WM_NAME = XInternAtom(SDL_Display, "_NET_WM_NAME", False);
_NET_WM_ICON_NAME = XInternAtom(SDL_Display, "_NET_WM_ICON_NAME", False);
}
#endif #endif
/* Lock the event thread, in multi-threading environments */ /* Lock the event thread, in multi-threading environments */
...@@ -263,18 +265,20 @@ void X11_SetCaption(_THIS, const char *title, const char *icon) ...@@ -263,18 +265,20 @@ void X11_SetCaption(_THIS, const char *title, const char *icon)
SDL_OutOfMemory(); SDL_OutOfMemory();
return; return;
} }
status = pXStringListToTextProperty(&title_latin1, 1, &titleprop); status = XStringListToTextProperty(&title_latin1, 1, &titleprop);
SDL_free(title_latin1); SDL_free(title_latin1);
if ( status ) { if ( status ) {
pXSetTextProperty(SDL_Display, WMwindow, &titleprop, XA_WM_NAME); XSetTextProperty(SDL_Display, WMwindow, &titleprop, XA_WM_NAME);
pXFree(titleprop.value); XFree(titleprop.value);
} }
#ifdef X_HAVE_UTF8_STRING #ifdef X_HAVE_UTF8_STRING
status = pXutf8TextListToTextProperty(SDL_Display, if (SDL_X11_HAVE_UTF8) {
(char **)&title, 1, XUTF8StringStyle, &titleprop); status = Xutf8TextListToTextProperty(SDL_Display,
if ( status == Success ) { (char **)&title, 1, XUTF8StringStyle, &titleprop);
pXSetTextProperty(SDL_Display, WMwindow, &titleprop, _NET_WM_NAME); if ( status == Success ) {
pXFree(titleprop.value); XSetTextProperty(SDL_Display, WMwindow, &titleprop, _NET_WM_NAME);
XFree(titleprop.value);
}
} }
#endif #endif
} }
...@@ -284,22 +288,24 @@ void X11_SetCaption(_THIS, const char *title, const char *icon) ...@@ -284,22 +288,24 @@ void X11_SetCaption(_THIS, const char *title, const char *icon)
SDL_OutOfMemory(); SDL_OutOfMemory();
return; return;
} }
status = pXStringListToTextProperty(&icon_latin1, 1, &iconprop); status = XStringListToTextProperty(&icon_latin1, 1, &iconprop);
SDL_free(icon_latin1); SDL_free(icon_latin1);
if ( status ) { if ( status ) {
pXSetTextProperty(SDL_Display, WMwindow, &iconprop, XA_WM_ICON_NAME); XSetTextProperty(SDL_Display, WMwindow, &iconprop, XA_WM_ICON_NAME);
pXFree(iconprop.value); XFree(iconprop.value);
} }
#ifdef X_HAVE_UTF8_STRING #ifdef X_HAVE_UTF8_STRING
status = pXutf8TextListToTextProperty(SDL_Display, if (SDL_X11_HAVE_UTF8) {
(char **)&icon, 1, XUTF8StringStyle, &iconprop); status = Xutf8TextListToTextProperty(SDL_Display,
if ( status == Success ) { (char **)&icon, 1, XUTF8StringStyle, &iconprop);
pXSetTextProperty(SDL_Display, WMwindow, &iconprop, _NET_WM_ICON_NAME); if ( status == Success ) {
pXFree(iconprop.value); XSetTextProperty(SDL_Display, WMwindow, &iconprop, _NET_WM_ICON_NAME);
XFree(iconprop.value);
}
} }
#endif #endif
} }
pXSync(SDL_Display, False); XSync(SDL_Display, False);
SDL_Unlock_EventThread(); SDL_Unlock_EventThread();
} }
...@@ -310,8 +316,8 @@ int X11_IconifyWindow(_THIS) ...@@ -310,8 +316,8 @@ int X11_IconifyWindow(_THIS)
int result; int result;
SDL_Lock_EventThread(); SDL_Lock_EventThread();
result = pXIconifyWindow(SDL_Display, WMwindow, SDL_Screen); result = XIconifyWindow(SDL_Display, WMwindow, SDL_Screen);
pXSync(SDL_Display, False); XSync(SDL_Display, False);
SDL_Unlock_EventThread(); SDL_Unlock_EventThread();
return(result); return(result);
} }
...@@ -327,12 +333,12 @@ SDL_GrabMode X11_GrabInputNoLock(_THIS, SDL_GrabMode mode) ...@@ -327,12 +333,12 @@ SDL_GrabMode X11_GrabInputNoLock(_THIS, SDL_GrabMode mode)
return(mode); /* Will be set later on mode switch */ return(mode); /* Will be set later on mode switch */
} }
if ( mode == SDL_GRAB_OFF ) { if ( mode == SDL_GRAB_OFF ) {
pXUngrabPointer(SDL_Display, CurrentTime); XUngrabPointer(SDL_Display, CurrentTime);
pXUngrabKeyboard(SDL_Display, CurrentTime); XUngrabKeyboard(SDL_Display, CurrentTime);
} else { } else {
if ( this->screen->flags & SDL_FULLSCREEN ) { if ( this->screen->flags & SDL_FULLSCREEN ) {
/* Unbind the mouse from the fullscreen window */ /* Unbind the mouse from the fullscreen window */
pXUngrabPointer(SDL_Display, CurrentTime); XUngrabPointer(SDL_Display, CurrentTime);
} }
/* Try to grab the mouse */ /* Try to grab the mouse */
#if 0 /* We'll wait here until we actually grab, otherwise behavior undefined */ #if 0 /* We'll wait here until we actually grab, otherwise behavior undefined */
...@@ -340,7 +346,7 @@ SDL_GrabMode X11_GrabInputNoLock(_THIS, SDL_GrabMode mode) ...@@ -340,7 +346,7 @@ SDL_GrabMode X11_GrabInputNoLock(_THIS, SDL_GrabMode mode)
#else #else
while ( 1 ) { while ( 1 ) {
#endif #endif
result = pXGrabPointer(SDL_Display, SDL_Window, True, 0, result = XGrabPointer(SDL_Display, SDL_Window, True, 0,
GrabModeAsync, GrabModeAsync, GrabModeAsync, GrabModeAsync,
SDL_Window, None, CurrentTime); SDL_Window, None, CurrentTime);
if ( result == GrabSuccess ) { if ( result == GrabSuccess ) {
...@@ -352,17 +358,17 @@ SDL_GrabMode X11_GrabInputNoLock(_THIS, SDL_GrabMode mode) ...@@ -352,17 +358,17 @@ SDL_GrabMode X11_GrabInputNoLock(_THIS, SDL_GrabMode mode)
/* Uh, oh, what do we do here? */ ; /* Uh, oh, what do we do here? */ ;
} }
/* Now grab the keyboard */ /* Now grab the keyboard */
pXGrabKeyboard(SDL_Display, WMwindow, True, XGrabKeyboard(SDL_Display, WMwindow, True,
GrabModeAsync, GrabModeAsync, CurrentTime); GrabModeAsync, GrabModeAsync, CurrentTime);
/* Raise the window if we grab the mouse */ /* Raise the window if we grab the mouse */
if ( !(this->screen->flags & SDL_FULLSCREEN) ) if ( !(this->screen->flags & SDL_FULLSCREEN) )
pXRaiseWindow(SDL_Display, WMwindow); XRaiseWindow(SDL_Display, WMwindow);
/* Make sure we register input focus */ /* Make sure we register input focus */
SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS); SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
} }
pXSync(SDL_Display, False); XSync(SDL_Display, False);
return(mode); return(mode);
} }
...@@ -387,7 +393,7 @@ static void unlock_display(void) ...@@ -387,7 +393,7 @@ static void unlock_display(void)
{ {
/* Make sure any X11 transactions are completed */ /* Make sure any X11 transactions are completed */
SDL_VideoDevice *this = current_video; SDL_VideoDevice *this = current_video;
pXSync(SDL_Display, False); XSync(SDL_Display, False);
SDL_Unlock_EventThread(); SDL_Unlock_EventThread();
} }
int X11_GetWMInfo(_THIS, SDL_SysWMinfo *info) int X11_GetWMInfo(_THIS, SDL_SysWMinfo *info)
......
...@@ -151,7 +151,7 @@ SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, S ...@@ -151,7 +151,7 @@ SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, S
} }
} }
if ( formats ) { if ( formats ) {
pXFree(formats); XFree(formats);
} }
} }
} }
...@@ -200,21 +200,21 @@ SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, S ...@@ -200,21 +200,21 @@ SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, S
unsigned int i; unsigned int i;
SDL_NAME(XvSelectPortNotify)(GFX_Display, xv_port, True); 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 ) { for ( i=0; i < sizeof(attr)/(sizeof attr[0]); ++i ) {
Atom a; Atom a;
xv_error = False; xv_error = False;
a = pXInternAtom(GFX_Display, attr[i], True); a = XInternAtom(GFX_Display, attr[i], True);
if ( a != None ) { if ( a != None ) {
SDL_NAME(XvSetPortAttribute)(GFX_Display, xv_port, a, 1); SDL_NAME(XvSetPortAttribute)(GFX_Display, xv_port, a, 1);
pXSync(GFX_Display, True); XSync(GFX_Display, True);
if ( ! xv_error ) { if ( ! xv_error ) {
break; break;
} }
} }
} }
pXSetErrorHandler(X_handler); XSetErrorHandler(X_handler);
SDL_NAME(XvSelectPortNotify)(GFX_Display, xv_port, False); SDL_NAME(XvSelectPortNotify)(GFX_Display, xv_port, False);
} }
...@@ -254,7 +254,7 @@ SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, S ...@@ -254,7 +254,7 @@ SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, S
#ifdef PITCH_WORKAROUND #ifdef PITCH_WORKAROUND
if ( hwdata->image != NULL && hwdata->image->pitches[0] != (width*bpp) ) { if ( hwdata->image != NULL && hwdata->image->pitches[0] != (width*bpp) ) {
/* Ajust overlay width according to pitch */ /* Ajust overlay width according to pitch */
pXFree(hwdata->image); XFree(hwdata->image);
width = hwdata->image->pitches[0] / bpp; width = hwdata->image->pitches[0] / bpp;
hwdata->image = SDL_NAME(XvShmCreateImage)(GFX_Display, xv_port, format, hwdata->image = SDL_NAME(XvShmCreateImage)(GFX_Display, xv_port, format,
0, width, height, yuvshm); 0, width, height, yuvshm);
...@@ -269,10 +269,10 @@ SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, S ...@@ -269,10 +269,10 @@ SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, S
yuvshm->readOnly = False; yuvshm->readOnly = False;
if ( yuvshm->shmaddr != (char *)-1 ) { if ( yuvshm->shmaddr != (char *)-1 ) {
shm_error = False; shm_error = False;
X_handler = pXSetErrorHandler(shm_errhandler); X_handler = XSetErrorHandler(shm_errhandler);
pXShmAttach(GFX_Display, yuvshm); XShmAttach(GFX_Display, yuvshm);
pXSync(GFX_Display, True); XSync(GFX_Display, True);
pXSetErrorHandler(X_handler); XSetErrorHandler(X_handler);
if ( shm_error ) if ( shm_error )
shmdt(yuvshm->shmaddr); shmdt(yuvshm->shmaddr);
} else { } else {
...@@ -283,7 +283,7 @@ SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, S ...@@ -283,7 +283,7 @@ SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, S
shm_error = True; shm_error = True;
} }
if ( shm_error ) { if ( shm_error ) {
pXFree(hwdata->image); XFree(hwdata->image);
hwdata->yuv_use_mitshm = 0; hwdata->yuv_use_mitshm = 0;
} else { } else {
hwdata->image->data = yuvshm->shmaddr; hwdata->image->data = yuvshm->shmaddr;
...@@ -298,7 +298,7 @@ SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, S ...@@ -298,7 +298,7 @@ SDL_Overlay *X11_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, S
#ifdef PITCH_WORKAROUND #ifdef PITCH_WORKAROUND
if ( hwdata->image != NULL && hwdata->image->pitches[0] != (width*bpp) ) { if ( hwdata->image != NULL && hwdata->image->pitches[0] != (width*bpp) ) {
/* Ajust overlay width according to pitch */ /* Ajust overlay width according to pitch */
pXFree(hwdata->image); XFree(hwdata->image);
width = hwdata->image->pitches[0] / bpp; width = hwdata->image->pitches[0] / bpp;
hwdata->image = SDL_NAME(XvCreateImage)(GFX_Display, xv_port, format, hwdata->image = SDL_NAME(XvCreateImage)(GFX_Display, xv_port, format,
0, width, height); 0, width, height);
...@@ -372,7 +372,7 @@ int X11_DisplayYUVOverlay(_THIS, SDL_Overlay *overlay, SDL_Rect *dstrect) ...@@ -372,7 +372,7 @@ int X11_DisplayYUVOverlay(_THIS, SDL_Overlay *overlay, SDL_Rect *dstrect)
hwdata->image, 0, 0, overlay->w, overlay->h, hwdata->image, 0, 0, overlay->w, overlay->h,
dstrect->x, dstrect->y, dstrect->w, dstrect->h); dstrect->x, dstrect->y, dstrect->w, dstrect->h);
} }
pXSync(GFX_Display, False); XSync(GFX_Display, False);
return(0); return(0);
} }
...@@ -385,12 +385,12 @@ void X11_FreeYUVOverlay(_THIS, SDL_Overlay *overlay) ...@@ -385,12 +385,12 @@ void X11_FreeYUVOverlay(_THIS, SDL_Overlay *overlay)
SDL_NAME(XvUngrabPort)(GFX_Display, hwdata->port, CurrentTime); SDL_NAME(XvUngrabPort)(GFX_Display, hwdata->port, CurrentTime);
#ifndef NO_SHARED_MEMORY #ifndef NO_SHARED_MEMORY
if ( hwdata->yuv_use_mitshm ) { if ( hwdata->yuv_use_mitshm ) {
pXShmDetach(GFX_Display, &hwdata->yuvshm); XShmDetach(GFX_Display, &hwdata->yuvshm);
shmdt(hwdata->yuvshm.shmaddr); shmdt(hwdata->yuvshm.shmaddr);
} }
#endif #endif
if ( hwdata->image ) { if ( hwdata->image ) {
pXFree(hwdata->image); XFree(hwdata->image);
} }
SDL_free(hwdata); SDL_free(hwdata);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment