From 12f743d4072bd3014c7f75d2551850957f8b1e5f Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Fri, 11 May 2018 20:32:57 +0000 Subject: [PATCH] applied fix for SDL bug #4159 git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1582 af15c1b1-3010-417e-b628-4374ebc0bcbd --- .../Versions/A/Headers/SDL_stdinc.h | 44 ++++++------ .../Versions/A/Headers/SDL_syswm.h | 68 ++++++++++--------- .../Versions/A/Headers/SDL_stdinc.h | 45 ++++++------ .../Versions/A/Headers/SDL_syswm.h | 12 ++-- Windows/SDL/include/SDL_stdinc.h | 44 ++++++------ Windows/SDL/include/SDL_syswm.h | 68 ++++++++++--------- Windows/SDL2/include/SDL_stdinc.h | 45 ++++++------ Windows/SDL2/include/SDL_syswm.h | 12 ++-- 8 files changed, 174 insertions(+), 164 deletions(-) diff --git a/MacOSX/SDL.framework/Versions/A/Headers/SDL_stdinc.h b/MacOSX/SDL.framework/Versions/A/Headers/SDL_stdinc.h index 35a4fdde..674415bd 100644 --- a/MacOSX/SDL.framework/Versions/A/Headers/SDL_stdinc.h +++ b/MacOSX/SDL.framework/Versions/A/Headers/SDL_stdinc.h @@ -73,6 +73,28 @@ #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) # include #endif +#if defined(HAVE_ALLOCA) && !defined(alloca) +# if defined(HAVE_ALLOCA_H) +# include +# elif defined(__GNUC__) +# define alloca __builtin_alloca +# elif defined(_MSC_VER) +# include +# define alloca _alloca +# elif defined(__WATCOMC__) +# include +# elif defined(__BORLANDC__) +# include +# elif defined(__DMC__) +# include +# elif defined(__AIX__) + #pragma alloca +# elif defined(__MRC__) + void *alloca (unsigned); +# else + char *alloca (); +# endif +#endif /** The number of elements in an array */ #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) @@ -182,28 +204,6 @@ extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size); extern DECLSPEC void SDLCALL SDL_free(void *mem); #endif -#if defined(HAVE_ALLOCA) && !defined(alloca) -# if defined(HAVE_ALLOCA_H) -# include -# elif defined(__GNUC__) -# define alloca __builtin_alloca -# elif defined(_MSC_VER) -# include -# define alloca _alloca -# elif defined(__WATCOMC__) -# include -# elif defined(__BORLANDC__) -# include -# elif defined(__DMC__) -# include -# elif defined(__AIX__) - #pragma alloca -# elif defined(__MRC__) - void *alloca (unsigned); -# else - char *alloca (); -# endif -#endif #ifdef HAVE_ALLOCA #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) #define SDL_stack_free(data) diff --git a/MacOSX/SDL.framework/Versions/A/Headers/SDL_syswm.h b/MacOSX/SDL.framework/Versions/A/Headers/SDL_syswm.h index 78433c6a..40845b64 100644 --- a/MacOSX/SDL.framework/Versions/A/Headers/SDL_syswm.h +++ b/MacOSX/SDL.framework/Versions/A/Headers/SDL_syswm.h @@ -31,6 +31,29 @@ #include "SDL_error.h" #include "SDL_version.h" +#ifndef SDL_PROTOTYPES_ONLY +# if defined(SDL_VIDEO_DRIVER_X11) +# if defined(__APPLE__) && defined(__MACH__) +# define Cursor X11Cursor /* conflicts with Quickdraw.h */ +# endif +# include +# include +# if defined(__APPLE__) && defined(__MACH__) +# undef Cursor +# endif +# elif defined(SDL_VIDEO_DRIVER_NANOX) +# include +# elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# elif defined(SDL_VIDEO_DRIVER_PHOTON) +# include +# include +# endif +#endif + #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus @@ -43,25 +66,13 @@ extern "C" { * an unhandled window event occurs. This event is ignored by default, but * you can enable it with SDL_EventState() */ -#ifdef SDL_PROTOTYPES_ONLY struct SDL_SysWMinfo; typedef struct SDL_SysWMinfo SDL_SysWMinfo; -#else + +#ifndef SDL_PROTOTYPES_ONLY /* This is the structure for custom window manager events */ #if defined(SDL_VIDEO_DRIVER_X11) -#if defined(__APPLE__) && defined(__MACH__) -/* conflicts with Quickdraw.h */ -#define Cursor X11Cursor -#endif - -#include -#include - -#if defined(__APPLE__) && defined(__MACH__) -/* matches the re-define above */ -#undef Cursor -#endif /** These are the various supported subsystems under UNIX */ typedef enum { @@ -81,7 +92,7 @@ struct SDL_SysWMmsg { * When this structure is returned, it holds information about which * low level system it is using, and will be one of SDL_SYSWM_TYPE. */ -typedef struct SDL_SysWMinfo { +struct SDL_SysWMinfo { SDL_version version; SDL_SYSWM_TYPE subsystem; union { @@ -111,10 +122,9 @@ typedef struct SDL_SysWMinfo { /*@}*/ } x11; } info; -} SDL_SysWMinfo; +}; #elif defined(SDL_VIDEO_DRIVER_NANOX) -#include /** The generic custom event structure */ struct SDL_SysWMmsg { @@ -123,14 +133,12 @@ struct SDL_SysWMmsg { }; /** The windows custom window manager information structure */ -typedef struct SDL_SysWMinfo { +struct SDL_SysWMinfo { SDL_version version ; GR_WINDOW_ID window ; /* The display window */ -} SDL_SysWMinfo; +}; #elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI) -#define WIN32_LEAN_AND_MEAN -#include /** The windows custom event structure */ struct SDL_SysWMmsg { @@ -142,11 +150,11 @@ struct SDL_SysWMmsg { }; /** The windows custom window manager information structure */ -typedef struct SDL_SysWMinfo { +struct SDL_SysWMinfo { SDL_version version; HWND window; /**< The Win32 display window */ HGLRC hglrc; /**< The OpenGL context, if any */ -} SDL_SysWMinfo; +}; #elif defined(SDL_VIDEO_DRIVER_RISCOS) @@ -158,16 +166,14 @@ struct SDL_SysWMmsg { }; /** The RISC OS custom window manager information structure */ -typedef struct SDL_SysWMinfo { +struct SDL_SysWMinfo { SDL_version version; int wimpVersion; /**< Wimp version running under */ int taskHandle; /**< The RISC OS task handle */ int window; /**< The RISC OS display window */ -} SDL_SysWMinfo; +}; #elif defined(SDL_VIDEO_DRIVER_PHOTON) -#include -#include /** The QNX custom event structure */ struct SDL_SysWMmsg { @@ -176,10 +182,10 @@ struct SDL_SysWMmsg { }; /** The QNX custom window manager information structure */ -typedef struct SDL_SysWMinfo { +struct SDL_SysWMinfo { SDL_version version; int data; -} SDL_SysWMinfo; +}; #else @@ -190,10 +196,10 @@ struct SDL_SysWMmsg { }; /** The generic custom window manager information structure */ -typedef struct SDL_SysWMinfo { +struct SDL_SysWMinfo { SDL_version version; int data; -} SDL_SysWMinfo; +}; #endif /* video driver type */ diff --git a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_stdinc.h b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_stdinc.h index 111a0645..92fcbcc2 100644 --- a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_stdinc.h +++ b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_stdinc.h @@ -86,6 +86,28 @@ #ifdef HAVE_FLOAT_H # include #endif +#if defined(HAVE_ALLOCA) && !defined(alloca) +# if defined(HAVE_ALLOCA_H) +# include +# elif defined(__GNUC__) +# define alloca __builtin_alloca +# elif defined(_MSC_VER) +# include +# define alloca _alloca +# elif defined(__WATCOMC__) +# include +# elif defined(__BORLANDC__) +# include +# elif defined(__DMC__) +# include +# elif defined(__AIX__) +#pragma alloca +# elif defined(__MRC__) +void *alloca(unsigned); +# else +char *alloca(); +# endif +#endif /** * The number of elements in an array. @@ -328,28 +350,6 @@ SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); extern "C" { #endif -#if defined(HAVE_ALLOCA) && !defined(alloca) -# if defined(HAVE_ALLOCA_H) -# include -# elif defined(__GNUC__) -# define alloca __builtin_alloca -# elif defined(_MSC_VER) -# include -# define alloca _alloca -# elif defined(__WATCOMC__) -# include -# elif defined(__BORLANDC__) -# include -# elif defined(__DMC__) -# include -# elif defined(__AIX__) -#pragma alloca -# elif defined(__MRC__) -void *alloca(unsigned); -# else -char *alloca(); -# endif -#endif #ifdef HAVE_ALLOCA #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) #define SDL_stack_free(data) @@ -445,7 +445,6 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords) #endif } - extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); diff --git a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_syswm.h b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_syswm.h index fa310eab..a4dfcfed 100644 --- a/MacOSX/SDL2.framework/Versions/A/Headers/SDL_syswm.h +++ b/MacOSX/SDL2.framework/Versions/A/Headers/SDL_syswm.h @@ -33,12 +33,6 @@ #include "SDL_video.h" #include "SDL_version.h" -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - /** * \file SDL_syswm.h * @@ -115,6 +109,12 @@ typedef void *EGLSurface; #include #endif +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + /** * These are the various supported windowing subsystems */ diff --git a/Windows/SDL/include/SDL_stdinc.h b/Windows/SDL/include/SDL_stdinc.h index 35a4fdde..674415bd 100644 --- a/Windows/SDL/include/SDL_stdinc.h +++ b/Windows/SDL/include/SDL_stdinc.h @@ -73,6 +73,28 @@ #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) # include #endif +#if defined(HAVE_ALLOCA) && !defined(alloca) +# if defined(HAVE_ALLOCA_H) +# include +# elif defined(__GNUC__) +# define alloca __builtin_alloca +# elif defined(_MSC_VER) +# include +# define alloca _alloca +# elif defined(__WATCOMC__) +# include +# elif defined(__BORLANDC__) +# include +# elif defined(__DMC__) +# include +# elif defined(__AIX__) + #pragma alloca +# elif defined(__MRC__) + void *alloca (unsigned); +# else + char *alloca (); +# endif +#endif /** The number of elements in an array */ #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) @@ -182,28 +204,6 @@ extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size); extern DECLSPEC void SDLCALL SDL_free(void *mem); #endif -#if defined(HAVE_ALLOCA) && !defined(alloca) -# if defined(HAVE_ALLOCA_H) -# include -# elif defined(__GNUC__) -# define alloca __builtin_alloca -# elif defined(_MSC_VER) -# include -# define alloca _alloca -# elif defined(__WATCOMC__) -# include -# elif defined(__BORLANDC__) -# include -# elif defined(__DMC__) -# include -# elif defined(__AIX__) - #pragma alloca -# elif defined(__MRC__) - void *alloca (unsigned); -# else - char *alloca (); -# endif -#endif #ifdef HAVE_ALLOCA #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) #define SDL_stack_free(data) diff --git a/Windows/SDL/include/SDL_syswm.h b/Windows/SDL/include/SDL_syswm.h index 78433c6a..40845b64 100644 --- a/Windows/SDL/include/SDL_syswm.h +++ b/Windows/SDL/include/SDL_syswm.h @@ -31,6 +31,29 @@ #include "SDL_error.h" #include "SDL_version.h" +#ifndef SDL_PROTOTYPES_ONLY +# if defined(SDL_VIDEO_DRIVER_X11) +# if defined(__APPLE__) && defined(__MACH__) +# define Cursor X11Cursor /* conflicts with Quickdraw.h */ +# endif +# include +# include +# if defined(__APPLE__) && defined(__MACH__) +# undef Cursor +# endif +# elif defined(SDL_VIDEO_DRIVER_NANOX) +# include +# elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# elif defined(SDL_VIDEO_DRIVER_PHOTON) +# include +# include +# endif +#endif + #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus @@ -43,25 +66,13 @@ extern "C" { * an unhandled window event occurs. This event is ignored by default, but * you can enable it with SDL_EventState() */ -#ifdef SDL_PROTOTYPES_ONLY struct SDL_SysWMinfo; typedef struct SDL_SysWMinfo SDL_SysWMinfo; -#else + +#ifndef SDL_PROTOTYPES_ONLY /* This is the structure for custom window manager events */ #if defined(SDL_VIDEO_DRIVER_X11) -#if defined(__APPLE__) && defined(__MACH__) -/* conflicts with Quickdraw.h */ -#define Cursor X11Cursor -#endif - -#include -#include - -#if defined(__APPLE__) && defined(__MACH__) -/* matches the re-define above */ -#undef Cursor -#endif /** These are the various supported subsystems under UNIX */ typedef enum { @@ -81,7 +92,7 @@ struct SDL_SysWMmsg { * When this structure is returned, it holds information about which * low level system it is using, and will be one of SDL_SYSWM_TYPE. */ -typedef struct SDL_SysWMinfo { +struct SDL_SysWMinfo { SDL_version version; SDL_SYSWM_TYPE subsystem; union { @@ -111,10 +122,9 @@ typedef struct SDL_SysWMinfo { /*@}*/ } x11; } info; -} SDL_SysWMinfo; +}; #elif defined(SDL_VIDEO_DRIVER_NANOX) -#include /** The generic custom event structure */ struct SDL_SysWMmsg { @@ -123,14 +133,12 @@ struct SDL_SysWMmsg { }; /** The windows custom window manager information structure */ -typedef struct SDL_SysWMinfo { +struct SDL_SysWMinfo { SDL_version version ; GR_WINDOW_ID window ; /* The display window */ -} SDL_SysWMinfo; +}; #elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI) -#define WIN32_LEAN_AND_MEAN -#include /** The windows custom event structure */ struct SDL_SysWMmsg { @@ -142,11 +150,11 @@ struct SDL_SysWMmsg { }; /** The windows custom window manager information structure */ -typedef struct SDL_SysWMinfo { +struct SDL_SysWMinfo { SDL_version version; HWND window; /**< The Win32 display window */ HGLRC hglrc; /**< The OpenGL context, if any */ -} SDL_SysWMinfo; +}; #elif defined(SDL_VIDEO_DRIVER_RISCOS) @@ -158,16 +166,14 @@ struct SDL_SysWMmsg { }; /** The RISC OS custom window manager information structure */ -typedef struct SDL_SysWMinfo { +struct SDL_SysWMinfo { SDL_version version; int wimpVersion; /**< Wimp version running under */ int taskHandle; /**< The RISC OS task handle */ int window; /**< The RISC OS display window */ -} SDL_SysWMinfo; +}; #elif defined(SDL_VIDEO_DRIVER_PHOTON) -#include -#include /** The QNX custom event structure */ struct SDL_SysWMmsg { @@ -176,10 +182,10 @@ struct SDL_SysWMmsg { }; /** The QNX custom window manager information structure */ -typedef struct SDL_SysWMinfo { +struct SDL_SysWMinfo { SDL_version version; int data; -} SDL_SysWMinfo; +}; #else @@ -190,10 +196,10 @@ struct SDL_SysWMmsg { }; /** The generic custom window manager information structure */ -typedef struct SDL_SysWMinfo { +struct SDL_SysWMinfo { SDL_version version; int data; -} SDL_SysWMinfo; +}; #endif /* video driver type */ diff --git a/Windows/SDL2/include/SDL_stdinc.h b/Windows/SDL2/include/SDL_stdinc.h index 111a0645..92fcbcc2 100644 --- a/Windows/SDL2/include/SDL_stdinc.h +++ b/Windows/SDL2/include/SDL_stdinc.h @@ -86,6 +86,28 @@ #ifdef HAVE_FLOAT_H # include #endif +#if defined(HAVE_ALLOCA) && !defined(alloca) +# if defined(HAVE_ALLOCA_H) +# include +# elif defined(__GNUC__) +# define alloca __builtin_alloca +# elif defined(_MSC_VER) +# include +# define alloca _alloca +# elif defined(__WATCOMC__) +# include +# elif defined(__BORLANDC__) +# include +# elif defined(__DMC__) +# include +# elif defined(__AIX__) +#pragma alloca +# elif defined(__MRC__) +void *alloca(unsigned); +# else +char *alloca(); +# endif +#endif /** * The number of elements in an array. @@ -328,28 +350,6 @@ SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); extern "C" { #endif -#if defined(HAVE_ALLOCA) && !defined(alloca) -# if defined(HAVE_ALLOCA_H) -# include -# elif defined(__GNUC__) -# define alloca __builtin_alloca -# elif defined(_MSC_VER) -# include -# define alloca _alloca -# elif defined(__WATCOMC__) -# include -# elif defined(__BORLANDC__) -# include -# elif defined(__DMC__) -# include -# elif defined(__AIX__) -#pragma alloca -# elif defined(__MRC__) -void *alloca(unsigned); -# else -char *alloca(); -# endif -#endif #ifdef HAVE_ALLOCA #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) #define SDL_stack_free(data) @@ -445,7 +445,6 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords) #endif } - extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); diff --git a/Windows/SDL2/include/SDL_syswm.h b/Windows/SDL2/include/SDL_syswm.h index fa310eab..a4dfcfed 100644 --- a/Windows/SDL2/include/SDL_syswm.h +++ b/Windows/SDL2/include/SDL_syswm.h @@ -33,12 +33,6 @@ #include "SDL_video.h" #include "SDL_version.h" -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - /** * \file SDL_syswm.h * @@ -115,6 +109,12 @@ typedef void *EGLSurface; #include #endif +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + /** * These are the various supported windowing subsystems */