Skip to content
Permalink
Browse files

backport fixes for bug #4159

  • Loading branch information
sezero committed May 10, 2018
1 parent 8b1921e commit 55e97877556c73cf707c2f9753c6dea85b51dfd7
Showing with 59 additions and 53 deletions.
  1. +22 −22 include/SDL_stdinc.h
  2. +37 −31 include/SDL_syswm.h
@@ -73,6 +73,28 @@
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
# include <iconv.h>
#endif
#if defined(HAVE_ALLOCA) && !defined(alloca)
# if defined(HAVE_ALLOCA_H)
# include <alloca.h>
# elif defined(__GNUC__)
# define alloca __builtin_alloca
# elif defined(_MSC_VER)
# include <malloc.h>
# define alloca _alloca
# elif defined(__WATCOMC__)
# include <malloc.h>
# elif defined(__BORLANDC__)
# include <malloc.h>
# elif defined(__DMC__)
# include <stdlib.h>
# 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 <alloca.h>
# elif defined(__GNUC__)
# define alloca __builtin_alloca
# elif defined(_MSC_VER)
# include <malloc.h>
# define alloca _alloca
# elif defined(__WATCOMC__)
# include <malloc.h>
# elif defined(__BORLANDC__)
# include <malloc.h>
# elif defined(__DMC__)
# include <stdlib.h>
# 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)
@@ -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 <X11/Xlib.h>
# include <X11/Xatom.h>
# if defined(__APPLE__) && defined(__MACH__)
# undef Cursor
# endif
# elif defined(SDL_VIDEO_DRIVER_NANOX)
# include <microwin/nano-X.h>
# 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 <windows.h>
# elif defined(SDL_VIDEO_DRIVER_PHOTON)
# include <sys/neutrino.h>
# include <Ph.h>
# 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 <X11/Xlib.h>
#include <X11/Xatom.h>

#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 <microwin/nano-X.h>

/** 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 <windows.h>

/** 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 <sys/neutrino.h>
#include <Ph.h>

/** 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 */

0 comments on commit 55e9787

Please sign in to comment.