Skip to content

Commit

Permalink
configure/cmake/x11: Removed SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
icculus committed Jun 8, 2015
1 parent f5dce3c commit e3f4ca0
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 27 deletions.
8 changes: 0 additions & 8 deletions cmake/sdlchecks.cmake
Expand Up @@ -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)
Expand Down
12 changes: 0 additions & 12 deletions configure.in
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion include/SDL_config.h.cmake
Expand Up @@ -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@

Expand Down
1 change: 0 additions & 1 deletion include/SDL_config.h.in
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/video/x11/SDL_x11dyn.c
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions src/video/x11/SDL_x11sym.h
Expand Up @@ -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

Expand Down

0 comments on commit e3f4ca0

Please sign in to comment.