backport fixes for bug #4159 SDL-1.2
authorOzkan Sezer <sezeroz@gmail.com>
Thu, 10 May 2018 08:47:00 +0300
branchSDL-1.2
changeset 11979d684a767e240
parent 11978 2dfa07d52047
child 12026 67f391c74aee
backport fixes for bug #4159
include/SDL_stdinc.h
include/SDL_syswm.h
     1.1 --- a/include/SDL_stdinc.h	Sun Mar 25 01:21:10 2018 +0300
     1.2 +++ b/include/SDL_stdinc.h	Thu May 10 08:47:00 2018 +0300
     1.3 @@ -73,6 +73,28 @@
     1.4  #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
     1.5  # include <iconv.h>
     1.6  #endif
     1.7 +#if defined(HAVE_ALLOCA) && !defined(alloca)
     1.8 +# if defined(HAVE_ALLOCA_H)
     1.9 +#  include <alloca.h>
    1.10 +# elif defined(__GNUC__)
    1.11 +#  define alloca __builtin_alloca
    1.12 +# elif defined(_MSC_VER)
    1.13 +#  include <malloc.h>
    1.14 +#  define alloca _alloca
    1.15 +# elif defined(__WATCOMC__)
    1.16 +#  include <malloc.h>
    1.17 +# elif defined(__BORLANDC__)
    1.18 +#  include <malloc.h>
    1.19 +# elif defined(__DMC__)
    1.20 +#  include <stdlib.h>
    1.21 +# elif defined(__AIX__)
    1.22 +  #pragma alloca
    1.23 +# elif defined(__MRC__)
    1.24 +   void *alloca (unsigned);
    1.25 +# else
    1.26 +   char *alloca ();
    1.27 +# endif
    1.28 +#endif
    1.29  
    1.30  /** The number of elements in an array */
    1.31  #define SDL_arraysize(array)	(sizeof(array)/sizeof(array[0]))
    1.32 @@ -182,28 +204,6 @@
    1.33  extern DECLSPEC void SDLCALL SDL_free(void *mem);
    1.34  #endif
    1.35  
    1.36 -#if defined(HAVE_ALLOCA) && !defined(alloca)
    1.37 -# if defined(HAVE_ALLOCA_H)
    1.38 -#  include <alloca.h>
    1.39 -# elif defined(__GNUC__)
    1.40 -#  define alloca __builtin_alloca
    1.41 -# elif defined(_MSC_VER)
    1.42 -#  include <malloc.h>
    1.43 -#  define alloca _alloca
    1.44 -# elif defined(__WATCOMC__)
    1.45 -#  include <malloc.h>
    1.46 -# elif defined(__BORLANDC__)
    1.47 -#  include <malloc.h>
    1.48 -# elif defined(__DMC__)
    1.49 -#  include <stdlib.h>
    1.50 -# elif defined(__AIX__)
    1.51 -  #pragma alloca
    1.52 -# elif defined(__MRC__)
    1.53 -   void *alloca (unsigned);
    1.54 -# else
    1.55 -   char *alloca ();
    1.56 -# endif
    1.57 -#endif
    1.58  #ifdef HAVE_ALLOCA
    1.59  #define SDL_stack_alloc(type, count)    (type*)alloca(sizeof(type)*(count))
    1.60  #define SDL_stack_free(data)
     2.1 --- a/include/SDL_syswm.h	Sun Mar 25 01:21:10 2018 +0300
     2.2 +++ b/include/SDL_syswm.h	Thu May 10 08:47:00 2018 +0300
     2.3 @@ -31,6 +31,29 @@
     2.4  #include "SDL_error.h"
     2.5  #include "SDL_version.h"
     2.6  
     2.7 +#ifndef SDL_PROTOTYPES_ONLY
     2.8 +# if defined(SDL_VIDEO_DRIVER_X11)
     2.9 +#  if defined(__APPLE__) && defined(__MACH__)
    2.10 +#   define Cursor X11Cursor /* conflicts with Quickdraw.h */
    2.11 +#  endif
    2.12 +#  include <X11/Xlib.h>
    2.13 +#  include <X11/Xatom.h>
    2.14 +#  if defined(__APPLE__) && defined(__MACH__)
    2.15 +#   undef Cursor
    2.16 +#  endif
    2.17 +# elif defined(SDL_VIDEO_DRIVER_NANOX)
    2.18 +#  include <microwin/nano-X.h>
    2.19 +# elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
    2.20 +#  ifndef WIN32_LEAN_AND_MEAN
    2.21 +#  define WIN32_LEAN_AND_MEAN
    2.22 +#  endif
    2.23 +#  include <windows.h>
    2.24 +# elif defined(SDL_VIDEO_DRIVER_PHOTON)
    2.25 +#  include <sys/neutrino.h>
    2.26 +#  include <Ph.h>
    2.27 +# endif
    2.28 +#endif
    2.29 +
    2.30  #include "begin_code.h"
    2.31  /* Set up for C function definitions, even when using C++ */
    2.32  #ifdef __cplusplus
    2.33 @@ -43,25 +66,13 @@
    2.34   *  an unhandled window event occurs.  This event is ignored by default, but
    2.35   *  you can enable it with SDL_EventState()
    2.36   */
    2.37 -#ifdef SDL_PROTOTYPES_ONLY
    2.38  struct SDL_SysWMinfo;
    2.39  typedef struct SDL_SysWMinfo SDL_SysWMinfo;
    2.40 -#else
    2.41 +
    2.42 +#ifndef SDL_PROTOTYPES_ONLY
    2.43  
    2.44  /* This is the structure for custom window manager events */
    2.45  #if defined(SDL_VIDEO_DRIVER_X11)
    2.46 -#if defined(__APPLE__) && defined(__MACH__)
    2.47 -/* conflicts with Quickdraw.h */
    2.48 -#define Cursor X11Cursor
    2.49 -#endif
    2.50 -
    2.51 -#include <X11/Xlib.h>
    2.52 -#include <X11/Xatom.h>
    2.53 -
    2.54 -#if defined(__APPLE__) && defined(__MACH__)
    2.55 -/* matches the re-define above */
    2.56 -#undef Cursor
    2.57 -#endif
    2.58  
    2.59  /** These are the various supported subsystems under UNIX */
    2.60  typedef enum {
    2.61 @@ -81,7 +92,7 @@
    2.62   *  When this structure is returned, it holds information about which
    2.63   *  low level system it is using, and will be one of SDL_SYSWM_TYPE.
    2.64   */
    2.65 -typedef struct SDL_SysWMinfo {
    2.66 +struct SDL_SysWMinfo {
    2.67  	SDL_version version;
    2.68  	SDL_SYSWM_TYPE subsystem;
    2.69  	union {
    2.70 @@ -111,10 +122,9 @@
    2.71                  /*@}*/
    2.72  	    } x11;
    2.73  	} info;
    2.74 -} SDL_SysWMinfo;
    2.75 +};
    2.76  
    2.77  #elif defined(SDL_VIDEO_DRIVER_NANOX)
    2.78 -#include <microwin/nano-X.h>
    2.79  
    2.80  /** The generic custom event structure */
    2.81  struct SDL_SysWMmsg {
    2.82 @@ -123,14 +133,12 @@
    2.83  };
    2.84  
    2.85  /** The windows custom window manager information structure */
    2.86 -typedef struct SDL_SysWMinfo {
    2.87 +struct SDL_SysWMinfo {
    2.88  	SDL_version version ;
    2.89  	GR_WINDOW_ID window ;	/* The display window */
    2.90 -} SDL_SysWMinfo;
    2.91 +};
    2.92  
    2.93  #elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
    2.94 -#define WIN32_LEAN_AND_MEAN
    2.95 -#include <windows.h>
    2.96  
    2.97  /** The windows custom event structure */
    2.98  struct SDL_SysWMmsg {
    2.99 @@ -142,11 +150,11 @@
   2.100  };
   2.101  
   2.102  /** The windows custom window manager information structure */
   2.103 -typedef struct SDL_SysWMinfo {
   2.104 +struct SDL_SysWMinfo {
   2.105  	SDL_version version;
   2.106  	HWND window;			/**< The Win32 display window */
   2.107  	HGLRC hglrc;			/**< The OpenGL context, if any */
   2.108 -} SDL_SysWMinfo;
   2.109 +};
   2.110  
   2.111  #elif defined(SDL_VIDEO_DRIVER_RISCOS)
   2.112  
   2.113 @@ -158,16 +166,14 @@
   2.114  };
   2.115  
   2.116  /** The RISC OS custom window manager information structure */
   2.117 -typedef struct SDL_SysWMinfo {
   2.118 +struct SDL_SysWMinfo {
   2.119  	SDL_version version;
   2.120  	int wimpVersion;    /**< Wimp version running under */
   2.121  	int taskHandle;     /**< The RISC OS task handle */
   2.122  	int window;		/**< The RISC OS display window */
   2.123 -} SDL_SysWMinfo;
   2.124 +};
   2.125  
   2.126  #elif defined(SDL_VIDEO_DRIVER_PHOTON)
   2.127 -#include <sys/neutrino.h>
   2.128 -#include <Ph.h>
   2.129  
   2.130  /** The QNX custom event structure */
   2.131  struct SDL_SysWMmsg {
   2.132 @@ -176,10 +182,10 @@
   2.133  };
   2.134  
   2.135  /** The QNX custom window manager information structure */
   2.136 -typedef struct SDL_SysWMinfo {
   2.137 +struct SDL_SysWMinfo {
   2.138  	SDL_version version;
   2.139  	int data;
   2.140 -} SDL_SysWMinfo;
   2.141 +};
   2.142  
   2.143  #else
   2.144  
   2.145 @@ -190,10 +196,10 @@
   2.146  };
   2.147  
   2.148  /** The generic custom window manager information structure */
   2.149 -typedef struct SDL_SysWMinfo {
   2.150 +struct SDL_SysWMinfo {
   2.151  	SDL_version version;
   2.152  	int data;
   2.153 -} SDL_SysWMinfo;
   2.154 +};
   2.155  
   2.156  #endif /* video driver type */
   2.157