include/SDL_syswm.h
changeset 4900 69d9db65f248
parent 4899 5d529386db73
child 4902 50d0bff24d81
     1.1 --- a/include/SDL_syswm.h	Mon Sep 27 00:50:46 2010 -0700
     1.2 +++ b/include/SDL_syswm.h	Mon Sep 27 01:24:05 2010 -0700
     1.3 @@ -54,8 +54,12 @@
     1.4  struct SDL_SysWMinfo;
     1.5  #else
     1.6  
     1.7 +#if defined(SDL_VIDEO_DRIVER_WIN32)
     1.8 +#define WIN32_LEAN_AND_MEAN
     1.9 +#include <windows.h>
    1.10 +#endif
    1.11 +
    1.12  /* This is the structure for custom window manager events */
    1.13 -#if defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_DIRECTFB)
    1.14  #if defined(SDL_VIDEO_DRIVER_X11)
    1.15  #if defined(__APPLE__) && defined(__MACH__)
    1.16  /* conflicts with Quickdraw.h */
    1.17 @@ -75,21 +79,29 @@
    1.18  #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
    1.19  #include <directfb/directfb.h>
    1.20  #endif
    1.21 +
    1.22 +#if defined(SDL_VIDEO_DRIVER_COCOA)
    1.23 +#ifdef __OBJC__
    1.24 +#include <Cocoa/Cocoa.h>
    1.25 +#else
    1.26 +typedef struct _NSWindow NSWindow;
    1.27 +#endif
    1.28 +#endif
    1.29 +
    1.30  /** 
    1.31 - *  These are the various supported subsystems under UNIX.
    1.32 + *  These are the various supported windowing subsystems
    1.33   */
    1.34  typedef enum
    1.35  {
    1.36 -#if defined(SDL_VIDEO_DRIVER_X11)
    1.37 +    SDL_SYSWM_UNKNOWN,
    1.38 +    SDL_SYSWM_WINDOWS,
    1.39      SDL_SYSWM_X11,
    1.40 -#endif
    1.41 -#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
    1.42      SDL_SYSWM_DIRECTFB,
    1.43 -#endif
    1.44 +    SDL_SYSWM_COCOA,
    1.45  } SDL_SYSWM_TYPE;
    1.46  
    1.47  /**
    1.48 - *  The UNIX custom event structure.
    1.49 + *  The custom event structure.
    1.50   */
    1.51  struct SDL_SysWMmsg
    1.52  {
    1.53 @@ -97,17 +109,35 @@
    1.54      SDL_SYSWM_TYPE subsystem;
    1.55      union
    1.56      {
    1.57 +#if defined(SDL_VIDEO_DRIVER_WIN32)
    1.58 +        struct {
    1.59 +            HWND hwnd;                  /**< The window for the message */
    1.60 +            UINT msg;                   /**< The type of message */
    1.61 +            WPARAM wParam;              /**< WORD message parameter */
    1.62 +            LPARAM lParam;              /**< LONG message parameter */
    1.63 +        } win;
    1.64 +#endif
    1.65  #if defined(SDL_VIDEO_DRIVER_X11)
    1.66 -        XEvent xevent;
    1.67 +        struct {
    1.68 +            XEvent event;
    1.69 +        } x11;
    1.70  #endif
    1.71  #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
    1.72 -        DFBEvent dfb_event;
    1.73 +        struct {
    1.74 +            DFBEvent event;
    1.75 +        } dfb;
    1.76  #endif
    1.77 -    } event;
    1.78 +#if defined(SDL_VIDEO_DRIVER_COCOA)
    1.79 +        struct
    1.80 +        {
    1.81 +            /* No Cocoa window events yet */
    1.82 +        } cocoa;
    1.83 +#endif
    1.84 +    } msg;
    1.85  };
    1.86  
    1.87  /**
    1.88 - *  The UNIX custom window manager information structure.
    1.89 + *  The custom window manager information structure.
    1.90   *
    1.91   *  When this structure is returned, it holds information about which
    1.92   *  low level system it is using, and will be one of SDL_SYSWM_TYPE.
    1.93 @@ -118,11 +148,17 @@
    1.94      SDL_SYSWM_TYPE subsystem;
    1.95      union
    1.96      {
    1.97 +#if defined(SDL_VIDEO_DRIVER_WIN32)
    1.98 +        struct
    1.99 +        {
   1.100 +            HWND window;                /**< The Win32 display window */
   1.101 +        } win;
   1.102 +#endif
   1.103  #if defined(SDL_VIDEO_DRIVER_X11)
   1.104          struct
   1.105          {
   1.106 -            Display *display;   /**< The X11 display */
   1.107 -            Window window;      /**< The X11 display window */
   1.108 +            Display *display;           /**< The X11 display */
   1.109 +            Window window;              /**< The X11 display window */
   1.110          } x11;
   1.111  #endif
   1.112  #if defined(SDL_VIDEO_DRIVER_DIRECTFB)
   1.113 @@ -131,106 +167,17 @@
   1.114          	IDirectFB *dfb;   			/**< The directfb main interface */
   1.115          	IDirectFBWindow *window;    /**< The directfb window handle */
   1.116          	IDirectFBSurface *surface;  /**< The directfb client surface */
   1.117 -        } directfb;
   1.118 +        } dfb;
   1.119 +#endif
   1.120 +#if defined(SDL_VIDEO_DRIVER_COCOA)
   1.121 +        struct
   1.122 +        {
   1.123 +            NSWindow *window;
   1.124 +        } cocoa;
   1.125  #endif
   1.126      } info;
   1.127  };
   1.128  
   1.129 -#elif defined(SDL_VIDEO_DRIVER_WIN32)
   1.130 -#define WIN32_LEAN_AND_MEAN
   1.131 -#include <windows.h>
   1.132 -
   1.133 -/**
   1.134 - *  The windows custom event structure.
   1.135 - */
   1.136 -struct SDL_SysWMmsg
   1.137 -{
   1.138 -    SDL_version version;
   1.139 -    HWND hwnd;                  /**< The window for the message */
   1.140 -    UINT msg;                   /**< The type of message */
   1.141 -    WPARAM wParam;              /**< WORD message parameter */
   1.142 -    LPARAM lParam;              /**< LONG message parameter */
   1.143 -};
   1.144 -
   1.145 -/**
   1.146 - *  The windows custom window manager information structure.
   1.147 - */
   1.148 -struct SDL_SysWMinfo
   1.149 -{
   1.150 -    SDL_version version;
   1.151 -    HWND window;                /**< The Win32 display window */
   1.152 -};
   1.153 -
   1.154 -#elif defined(SDL_VIDEO_DRIVER_RISCOS)
   1.155 -
   1.156 -/**
   1.157 - *  RISC OS custom event structure.
   1.158 - */
   1.159 -struct SDL_SysWMmsg
   1.160 -{
   1.161 -    SDL_version version;
   1.162 -    int eventCode;              /**< The window for the message */
   1.163 -    int pollBlock[64];
   1.164 -};
   1.165 -
   1.166 -/**
   1.167 - *  The RISC OS custom window manager information structure.
   1.168 - */
   1.169 -struct SDL_SysWMinfo
   1.170 -{
   1.171 -    SDL_version version;
   1.172 -    int wimpVersion;            /**< Wimp version running under */
   1.173 -    int taskHandle;             /**< The RISC OS task handle */
   1.174 -    int window;                 /**< The RISC OS display window */
   1.175 -};
   1.176 -
   1.177 -#elif defined(SDL_VIDEO_DRIVER_PHOTON) || defined(SDL_VIDEO_DRIVER_QNXGF)
   1.178 -#include <sys/neutrino.h>
   1.179 -#if defined(SDL_VIDEO_OPENGL_ES)
   1.180 -#include <gf/gf.h>
   1.181 -#endif /* SDL_VIDEO_OPENGL_ES */
   1.182 -#include <Ph.h>
   1.183 -
   1.184 -/**
   1.185 - * The QNX custom event structure.
   1.186 - */
   1.187 -struct SDL_SysWMmsg
   1.188 -{
   1.189 -    SDL_version version;
   1.190 -    int data;
   1.191 -};
   1.192 -
   1.193 -/**
   1.194 - *  The QNX Photon custom window manager information structure.
   1.195 - */
   1.196 -struct SDL_SysWMinfo
   1.197 -{
   1.198 -    SDL_version version;
   1.199 -    int data;
   1.200 -};
   1.201 -
   1.202 -#else
   1.203 -
   1.204 -/**
   1.205 - *  The generic custom event structure.
   1.206 - */
   1.207 -struct SDL_SysWMmsg
   1.208 -{
   1.209 -    SDL_version version;
   1.210 -    int data;
   1.211 -};
   1.212 -
   1.213 -/**
   1.214 - *  The generic custom window manager information structure.
   1.215 - */
   1.216 -struct SDL_SysWMinfo
   1.217 -{
   1.218 -    SDL_version version;
   1.219 -    int data;
   1.220 -};
   1.221 -
   1.222 -#endif /* video driver type */
   1.223 -
   1.224  #endif /* SDL_PROTOTYPES_ONLY */
   1.225  
   1.226  typedef struct SDL_SysWMinfo SDL_SysWMinfo;