include/SDL_syswm.h
changeset 1895 c121d94672cb
parent 1760 a9be6a3a51d1
child 1956 ba0d62354872
     1.1 --- a/include/SDL_syswm.h	Thu Jul 06 18:01:37 2006 +0000
     1.2 +++ b/include/SDL_syswm.h	Mon Jul 10 21:04:37 2006 +0000
     1.3 @@ -20,19 +20,26 @@
     1.4      slouken@libsdl.org
     1.5  */
     1.6  
     1.7 -/* Include file for SDL custom system window manager hooks */
     1.8 +/**
     1.9 + * \file SDL_syswm.h
    1.10 + *
    1.11 + * Include file for SDL custom system window manager hooks
    1.12 + */
    1.13  
    1.14  #ifndef _SDL_syswm_h
    1.15  #define _SDL_syswm_h
    1.16  
    1.17  #include "SDL_stdinc.h"
    1.18  #include "SDL_error.h"
    1.19 +#include "SDL_video.h"
    1.20  #include "SDL_version.h"
    1.21  
    1.22  #include "begin_code.h"
    1.23  /* Set up for C function definitions, even when using C++ */
    1.24  #ifdef __cplusplus
    1.25 +/* *INDENT-OFF* */
    1.26  extern "C" {
    1.27 +/* *INDENT-ON* */
    1.28  #endif
    1.29  
    1.30  /* Your application has access to a special type of event 'SDL_SYSWMEVENT',
    1.31 @@ -42,7 +49,6 @@
    1.32  */
    1.33  #ifdef SDL_PROTOTYPES_ONLY
    1.34  struct SDL_SysWMinfo;
    1.35 -typedef struct SDL_SysWMinfo SDL_SysWMinfo;
    1.36  #else
    1.37  
    1.38  /* This is the structure for custom window manager events */
    1.39 @@ -61,150 +67,179 @@
    1.40  #endif
    1.41  
    1.42  /* These are the various supported subsystems under UNIX */
    1.43 -typedef enum {
    1.44 -	SDL_SYSWM_X11
    1.45 +typedef enum
    1.46 +{
    1.47 +    SDL_SYSWM_X11
    1.48  } SDL_SYSWM_TYPE;
    1.49  
    1.50  /* The UNIX custom event structure */
    1.51 -struct SDL_SysWMmsg {
    1.52 -	SDL_version version;
    1.53 -	SDL_SYSWM_TYPE subsystem;
    1.54 -	union {
    1.55 -	    XEvent xevent;
    1.56 -	} event;
    1.57 +struct SDL_SysWMmsg
    1.58 +{
    1.59 +    SDL_version version;
    1.60 +    SDL_SYSWM_TYPE subsystem;
    1.61 +    union
    1.62 +    {
    1.63 +        XEvent xevent;
    1.64 +    } event;
    1.65  };
    1.66  
    1.67  /* The UNIX custom window manager information structure.
    1.68     When this structure is returned, it holds information about which
    1.69     low level system it is using, and will be one of SDL_SYSWM_TYPE.
    1.70   */
    1.71 -typedef struct SDL_SysWMinfo {
    1.72 -	SDL_version version;
    1.73 -	SDL_SYSWM_TYPE subsystem;
    1.74 -	union {
    1.75 -	    struct {
    1.76 -	    	Display *display;	/* The X11 display */
    1.77 -	    	Window window;		/* The X11 display window */
    1.78 -		/* These locking functions should be called around
    1.79 -                   any X11 functions using the display variable.
    1.80 -                   They lock the event thread, so should not be
    1.81 -		   called around event functions or from event filters.
    1.82 -		 */
    1.83 -		void (*lock_func)(void);
    1.84 -		void (*unlock_func)(void);
    1.85 +struct SDL_SysWMinfo
    1.86 +{
    1.87 +    SDL_version version;
    1.88 +    SDL_SYSWM_TYPE subsystem;
    1.89 +    union
    1.90 +    {
    1.91 +        struct
    1.92 +        {
    1.93 +            Display *display;   /* The X11 display */
    1.94 +            Window window;      /* The X11 display window */
    1.95 +            /* These locking functions should be called around
    1.96 +               any X11 functions using the display variable.
    1.97 +               They lock the event thread, so should not be
    1.98 +               called around event functions or from event filters.
    1.99 +             */
   1.100 +            void (*lock_func) (void);
   1.101 +            void (*unlock_func) (void);
   1.102  
   1.103 -		/* Introduced in SDL 1.0.2 */
   1.104 -	    	Window fswindow;	/* The X11 fullscreen window */
   1.105 -	    	Window wmwindow;	/* The X11 managed input window */
   1.106 -	    } x11;
   1.107 -	} info;
   1.108 -} SDL_SysWMinfo;
   1.109 +            /* Introduced in SDL 1.0.2 */
   1.110 +            Window fswindow;    /* The X11 fullscreen window */
   1.111 +            Window wmwindow;    /* The X11 managed input window */
   1.112 +        } x11;
   1.113 +    } info;
   1.114 +};
   1.115  
   1.116  #elif defined(SDL_VIDEO_DRIVER_NANOX)
   1.117  #include <microwin/nano-X.h>
   1.118  
   1.119  /* The generic custom event structure */
   1.120 -struct SDL_SysWMmsg {
   1.121 -	SDL_version version;
   1.122 -	int data;
   1.123 +struct SDL_SysWMmsg
   1.124 +{
   1.125 +    SDL_version version;
   1.126 +    int data;
   1.127  };
   1.128  
   1.129  /* The windows custom window manager information structure */
   1.130 -typedef struct SDL_SysWMinfo {
   1.131 -	SDL_version version ;
   1.132 -	GR_WINDOW_ID window ;	/* The display window */
   1.133 -} SDL_SysWMinfo;
   1.134 +struct SDL_SysWMinfo
   1.135 +{
   1.136 +    SDL_version version;
   1.137 +    GR_WINDOW_ID window;        /* The display window */
   1.138 +};
   1.139  
   1.140 -#elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
   1.141 +#elif defined(SDL_VIDEO_DRIVER_WIN32)
   1.142  #define WIN32_LEAN_AND_MEAN
   1.143  #include <windows.h>
   1.144  
   1.145  /* The windows custom event structure */
   1.146 -struct SDL_SysWMmsg {
   1.147 -	SDL_version version;
   1.148 -	HWND hwnd;			/* The window for the message */
   1.149 -	UINT msg;			/* The type of message */
   1.150 -	WPARAM wParam;			/* WORD message parameter */
   1.151 -	LPARAM lParam;			/* LONG message parameter */
   1.152 +struct SDL_SysWMmsg
   1.153 +{
   1.154 +    SDL_version version;
   1.155 +    HWND hwnd;                  /* The window for the message */
   1.156 +    UINT msg;                   /* The type of message */
   1.157 +    WPARAM wParam;              /* WORD message parameter */
   1.158 +    LPARAM lParam;              /* LONG message parameter */
   1.159  };
   1.160  
   1.161  /* The windows custom window manager information structure */
   1.162 -typedef struct SDL_SysWMinfo {
   1.163 -	SDL_version version;
   1.164 -	HWND window;			/* The Win32 display window */
   1.165 -	HGLRC hglrc;			/* The OpenGL context, if any */
   1.166 -} SDL_SysWMinfo;
   1.167 +struct SDL_SysWMinfo
   1.168 +{
   1.169 +    SDL_version version;
   1.170 +    HWND window;                /* The Win32 display window */
   1.171 +    HGLRC hglrc;                /* The OpenGL context, if any */
   1.172 +};
   1.173  
   1.174  #elif defined(SDL_VIDEO_DRIVER_RISCOS)
   1.175  
   1.176  /* RISC OS custom event structure */
   1.177 -struct SDL_SysWMmsg {
   1.178 -	SDL_version version;
   1.179 -	int eventCode;		/* The window for the message */
   1.180 -	int pollBlock[64];
   1.181 +struct SDL_SysWMmsg
   1.182 +{
   1.183 +    SDL_version version;
   1.184 +    int eventCode;              /* The window for the message */
   1.185 +    int pollBlock[64];
   1.186  };
   1.187  
   1.188  /* The RISC OS custom window manager information structure */
   1.189 -typedef struct SDL_SysWMinfo {
   1.190 -	SDL_version version;
   1.191 -	int wimpVersion;    /* Wimp version running under */
   1.192 -	int taskHandle;     /* The RISC OS task handle */
   1.193 -	int window;		/* The RISC OS display window */
   1.194 -} SDL_SysWMinfo;
   1.195 +struct SDL_SysWMinfo
   1.196 +{
   1.197 +    SDL_version version;
   1.198 +    int wimpVersion;            /* Wimp version running under */
   1.199 +    int taskHandle;             /* The RISC OS task handle */
   1.200 +    int window;                 /* The RISC OS display window */
   1.201 +};
   1.202  
   1.203  #elif defined(SDL_VIDEO_DRIVER_PHOTON)
   1.204  #include <sys/neutrino.h>
   1.205  #include <Ph.h>
   1.206  
   1.207  /* The QNX custom event structure */
   1.208 -struct SDL_SysWMmsg {
   1.209 -	SDL_version version;
   1.210 -	int data;
   1.211 +struct SDL_SysWMmsg
   1.212 +{
   1.213 +    SDL_version version;
   1.214 +    int data;
   1.215  };
   1.216  
   1.217  /* The QNX custom window manager information structure */
   1.218 -typedef struct SDL_SysWMinfo {
   1.219 -	SDL_version version;
   1.220 -	int data;
   1.221 -} SDL_SysWMinfo;
   1.222 +struct SDL_SysWMinfo
   1.223 +{
   1.224 +    SDL_version version;
   1.225 +    int data;
   1.226 +};
   1.227  
   1.228  #else
   1.229  
   1.230  /* The generic custom event structure */
   1.231 -struct SDL_SysWMmsg {
   1.232 -	SDL_version version;
   1.233 -	int data;
   1.234 +struct SDL_SysWMmsg
   1.235 +{
   1.236 +    SDL_version version;
   1.237 +    int data;
   1.238  };
   1.239  
   1.240  /* The generic custom window manager information structure */
   1.241 -typedef struct SDL_SysWMinfo {
   1.242 -	SDL_version version;
   1.243 -	int data;
   1.244 -} SDL_SysWMinfo;
   1.245 +struct SDL_SysWMinfo
   1.246 +{
   1.247 +    SDL_version version;
   1.248 +    int data;
   1.249 +};
   1.250  
   1.251  #endif /* video driver type */
   1.252  
   1.253  #endif /* SDL_PROTOTYPES_ONLY */
   1.254  
   1.255 +typedef struct SDL_SysWMinfo SDL_SysWMinfo;
   1.256 +
   1.257  /* Function prototypes */
   1.258 -/*
   1.259 - * This function gives you custom hooks into the window manager information.
   1.260 - * It fills the structure pointed to by 'info' with custom information and
   1.261 - * returns 1 if the function is implemented.  If it's not implemented, or
   1.262 - * the version member of the 'info' structure is invalid, it returns 0. 
   1.263 +/**
   1.264 + * \fn SDL_bool SDL_GetWindowWMInfo (SDL_WindowID windowID, SDL_SysWMinfo * info)
   1.265 + *
   1.266 + * \brief This function allows access to driver-dependent window information.
   1.267 + *
   1.268 + * \param windowID The window about which information is being requested
   1.269 + * \param info This structure must be initialized with the SDL version, and is then filled in with information about the given window.
   1.270 + *
   1.271 + * \return SDL_TRUE if the function is implemented and the version member of the 'info' struct is valid, SDL_FALSE otherwise.
   1.272   *
   1.273   * You typically use this function like this:
   1.274 + * \code
   1.275   * SDL_SysWMInfo info;
   1.276   * SDL_VERSION(&info.version);
   1.277 - * if ( SDL_GetWMInfo(&info) ) { ... }
   1.278 + * if ( SDL_GetWindowWMInfo(&info) ) { ... }
   1.279 + * \endcode
   1.280   */
   1.281 -extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
   1.282 +extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID,
   1.283 +                                                     SDL_SysWMinfo * info);
   1.284  
   1.285  
   1.286  /* Ends C function definitions when using C++ */
   1.287  #ifdef __cplusplus
   1.288 +/* *INDENT-OFF* */
   1.289  }
   1.290 +/* *INDENT-ON* */
   1.291  #endif
   1.292  #include "close_code.h"
   1.293  
   1.294  #endif /* _SDL_syswm_h */
   1.295 +
   1.296 +/* vi: set ts=4 sw=4 expandtab: */