configure/cmake/x11: Removed SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 test.

This was the only thing that made SDL_config.h generate differently between
32 and 64-bit versions of Linux, so instead we force a function cast in our
X11 code to match our dynamic loader version, which removes the compile error
on some machines that prompted this test in the first place.

Xlib never wrote to this data, so if you're on an older Xlib where this param
wasn't const, your data should still be intact when we force the caller to
think it was actually const after all.

Fixes Bugzilla #1893.
This commit is contained in:
Ryan C. Gordon 2015-06-08 01:13:51 -04:00
parent f5dce3c63c
commit e3f4ca0d71
6 changed files with 1 additions and 27 deletions

View File

@ -409,14 +409,6 @@ macro(CheckX11)
set(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1)
endif()
check_c_source_compiles("
#include <X11/Xlibint.h>
extern int _XData32(Display *dpy,register _Xconst long *data,unsigned len);
int main(int argc, char **argv) {}" HAVE_CONST_XDATA32)
if(HAVE_CONST_XDATA32)
set(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 1)
endif()
check_function_exists(XkbKeycodeToKeysym SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM)
if(VIDEO_X11_XCURSOR AND HAVE_XCURSOR_H)

View File

@ -1492,18 +1492,6 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma
])
AC_MSG_RESULT($have_const_param_XextAddDisplay)
AC_MSG_CHECKING(for const parameter to _XData32)
have_const_param_xdata32=no
AC_TRY_COMPILE([
#include <X11/Xlibint.h>
extern int _XData32(Display *dpy,register _Xconst long *data,unsigned len);
],[
],[
have_const_param_xdata32=yes
AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32)
])
AC_MSG_RESULT($have_const_param_xdata32)
dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
AC_MSG_CHECKING([for XGenericEvent])
have_XGenericEvent=no

View File

@ -305,7 +305,6 @@
#cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE @SDL_VIDEO_DRIVER_X11_XSHAPE@
#cmakedefine SDL_VIDEO_DRIVER_X11_XVIDMODE @SDL_VIDEO_DRIVER_X11_XVIDMODE@
#cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@
#cmakedefine SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 @SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32@
#cmakedefine SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY @SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY@
#cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@

View File

@ -308,7 +308,6 @@
#undef SDL_VIDEO_DRIVER_X11_XSHAPE
#undef SDL_VIDEO_DRIVER_X11_XVIDMODE
#undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
#undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32
#undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY
#undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
#undef SDL_VIDEO_DRIVER_NACL

View File

@ -207,7 +207,7 @@ SDL_X11_LoadSymbols(void)
#else /* no dynamic X11 */
#define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */
#define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = fn;
#define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) fn;
#include "SDL_x11sym.h"
#undef SDL_X11_MODULE
#undef SDL_X11_SYM

View File

@ -203,11 +203,7 @@ SDL_X11_SYM(Bool,XShmQueryExtension,(Display* a),(a),return)
*/
#ifdef LONG64
SDL_X11_MODULE(IO_32BIT)
#if SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32
SDL_X11_SYM(int,_XData32,(Display *dpy,register _Xconst long *data,unsigned len),(dpy,data,len),return)
#else
SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
#endif
SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,len),)
#endif