Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix compilation with libX11 >= 1.5.99.902.
These changes fixes bug #1769 for SDL2
(http://bugzilla.libsdl.org/show_bug.cgi?id=1769).
  • Loading branch information
winterheart committed Jun 2, 2013
1 parent b8f173f commit 8cc8168
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmake/sdlchecks.cmake
Expand Up @@ -356,6 +356,14 @@ macro(CheckX11)
set(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1)
endif(HAVE_XGENERICEVENT)

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(HAVE_CONST_XDATA32)

check_function_exists(XkbKeycodeToKeysym SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM)

if(VIDEO_X11_XCURSOR AND HAVE_XCURSOR_H)
Expand Down
29 changes: 29 additions & 0 deletions configure
Expand Up @@ -19492,6 +19492,35 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_const_param_XextAddDisplay" >&5
$as_echo "$have_const_param_XextAddDisplay" >&6; }

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for const parameter to _XData32" >&5
$as_echo_n "checking for const parameter to _XData32... " >&6; }
have_const_param_xdata32=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

#include <X11/Xlibint.h>
extern int _XData32(Display *dpy,register _Xconst long *data,unsigned len);

int
main ()
{


;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :

have_const_param_xdata32=yes
$as_echo "#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 1" >>confdefs.h


fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_const_param_xdata32" >&5
$as_echo "$have_const_param_xdata32" >&6; }

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XGenericEvent" >&5
$as_echo_n "checking for XGenericEvent... " >&6; }
have_XGenericEvent=no
Expand Down
12 changes: 12 additions & 0 deletions configure.in
Expand Up @@ -1144,6 +1144,18 @@ 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: 1 addition & 0 deletions include/SDL_config.h.cmake
Expand Up @@ -266,6 +266,7 @@
#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: 1 addition & 0 deletions include/SDL_config.h.in
Expand Up @@ -268,6 +268,7 @@
#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

Expand Down
4 changes: 4 additions & 0 deletions src/video/x11/SDL_x11sym.h
Expand Up @@ -203,7 +203,11 @@ 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 8cc8168

Please sign in to comment.