include/SDL_syswm.h
changeset 3407 d3baf5ac4e37
parent 3274 08574b033f37
child 3685 64ce267332c6
equal deleted inserted replaced
3406:8ae607392409 3407:d3baf5ac4e37
    19     Sam Lantinga
    19     Sam Lantinga
    20     slouken@libsdl.org
    20     slouken@libsdl.org
    21 */
    21 */
    22 
    22 
    23 /**
    23 /**
    24  * \file SDL_syswm.h
    24  *  \file SDL_syswm.h
    25  *
    25  *  
    26  * Include file for SDL custom system window manager hooks
    26  *  Include file for SDL custom system window manager hooks.
    27  */
    27  */
    28 
    28 
    29 #ifndef _SDL_syswm_h
    29 #ifndef _SDL_syswm_h
    30 #define _SDL_syswm_h
    30 #define _SDL_syswm_h
    31 
    31 
    40 /* *INDENT-OFF* */
    40 /* *INDENT-OFF* */
    41 extern "C" {
    41 extern "C" {
    42 /* *INDENT-ON* */
    42 /* *INDENT-ON* */
    43 #endif
    43 #endif
    44 
    44 
    45 /* Your application has access to a special type of event 'SDL_SYSWMEVENT',
    45 /**
    46    which contains window-manager specific information and arrives whenever
    46  *  \file SDL_syswm.h
    47    an unhandled window event occurs.  This event is ignored by default, but
    47  *  
    48    you can enable it with SDL_EventState()
    48  *  Your application has access to a special type of event ::SDL_SYSWMEVENT,
    49 */
    49  *  which contains window-manager specific information and arrives whenever
       
    50  *  an unhandled window event occurs.  This event is ignored by default, but
       
    51  *  you can enable it with SDL_EventState().
       
    52  */
    50 #ifdef SDL_PROTOTYPES_ONLY
    53 #ifdef SDL_PROTOTYPES_ONLY
    51 struct SDL_SysWMinfo;
    54 struct SDL_SysWMinfo;
    52 #else
    55 #else
    53 
    56 
    54 /* This is the structure for custom window manager events */
    57 /* This is the structure for custom window manager events */
    64 #if defined(__APPLE__) && defined(__MACH__)
    67 #if defined(__APPLE__) && defined(__MACH__)
    65 /* matches the re-define above */
    68 /* matches the re-define above */
    66 #undef Cursor
    69 #undef Cursor
    67 #endif
    70 #endif
    68 
    71 
    69 /* These are the various supported subsystems under UNIX */
    72 /** 
       
    73  *  These are the various supported subsystems under UNIX.
       
    74  */
    70 typedef enum
    75 typedef enum
    71 {
    76 {
    72     SDL_SYSWM_X11
    77     SDL_SYSWM_X11
    73 } SDL_SYSWM_TYPE;
    78 } SDL_SYSWM_TYPE;
    74 
    79 
    75 /* The UNIX custom event structure */
    80 /**
       
    81  *  The UNIX custom event structure.
       
    82  */
    76 struct SDL_SysWMmsg
    83 struct SDL_SysWMmsg
    77 {
    84 {
    78     SDL_version version;
    85     SDL_version version;
    79     SDL_SYSWM_TYPE subsystem;
    86     SDL_SYSWM_TYPE subsystem;
    80     union
    87     union
    81     {
    88     {
    82         XEvent xevent;
    89         XEvent xevent;
    83     } event;
    90     } event;
    84 };
    91 };
    85 
    92 
    86 /* The UNIX custom window manager information structure.
    93 /**
    87    When this structure is returned, it holds information about which
    94  *  The UNIX custom window manager information structure.
    88    low level system it is using, and will be one of SDL_SYSWM_TYPE.
    95  *
       
    96  *  When this structure is returned, it holds information about which
       
    97  *  low level system it is using, and will be one of SDL_SYSWM_TYPE.
    89  */
    98  */
    90 struct SDL_SysWMinfo
    99 struct SDL_SysWMinfo
    91 {
   100 {
    92     SDL_version version;
   101     SDL_version version;
    93     SDL_SYSWM_TYPE subsystem;
   102     SDL_SYSWM_TYPE subsystem;
    94     union
   103     union
    95     {
   104     {
    96         struct
   105         struct
    97         {
   106         {
    98             Display *display;   /* The X11 display */
   107             Display *display;   /**< The X11 display */
    99             Window window;      /* The X11 display window */
   108             Window window;      /**< The X11 display window */
   100             /* These locking functions should be called around
   109             /**
   101                any X11 functions using the display variable.
   110              *  These locking functions should be called around
   102                They lock the event thread, so should not be
   111              *  any X11 functions using the display variable.
   103                called around event functions or from event filters.
   112              *  They lock the event thread, so should not be
       
   113              *  called around event functions or from event filters.
   104              */
   114              */
       
   115             /*@{*/
   105             void (*lock_func) (void);
   116             void (*lock_func) (void);
   106             void (*unlock_func) (void);
   117             void (*unlock_func) (void);
   107 
   118             /*@}*/
   108             /* Introduced in SDL 1.0.2 */
   119 
   109             Window fswindow;    /* The X11 fullscreen window */
   120             /**
   110             Window wmwindow;    /* The X11 managed input window */
   121              *  Introduced in SDL 1.0.2.
       
   122              */
       
   123             /*@{*/
       
   124             Window fswindow;    /**< The X11 fullscreen window */
       
   125             Window wmwindow;    /**< The X11 managed input window */
       
   126             /*@}*/
   111         } x11;
   127         } x11;
   112     } info;
   128     } info;
   113 };
   129 };
   114 
   130 
   115 #elif defined(SDL_VIDEO_DRIVER_WIN32)
   131 #elif defined(SDL_VIDEO_DRIVER_WIN32)
   116 #define WIN32_LEAN_AND_MEAN
   132 #define WIN32_LEAN_AND_MEAN
   117 #include <windows.h>
   133 #include <windows.h>
   118 
   134 
   119 /* The windows custom event structure */
   135 /**
   120 struct SDL_SysWMmsg
   136  *  The windows custom event structure.
   121 {
   137  */
   122     SDL_version version;
   138 struct SDL_SysWMmsg
   123     HWND hwnd;                  /* The window for the message */
   139 {
   124     UINT msg;                   /* The type of message */
   140     SDL_version version;
   125     WPARAM wParam;              /* WORD message parameter */
   141     HWND hwnd;                  /**< The window for the message */
   126     LPARAM lParam;              /* LONG message parameter */
   142     UINT msg;                   /**< The type of message */
   127 };
   143     WPARAM wParam;              /**< WORD message parameter */
   128 
   144     LPARAM lParam;              /**< LONG message parameter */
   129 /* The windows custom window manager information structure */
   145 };
   130 struct SDL_SysWMinfo
   146 
   131 {
   147 /**
   132     SDL_version version;
   148  *  The windows custom window manager information structure.
   133     HWND window;                /* The Win32 display window */
   149  */
       
   150 struct SDL_SysWMinfo
       
   151 {
       
   152     SDL_version version;
       
   153     HWND window;                /**< The Win32 display window */
   134 };
   154 };
   135 
   155 
   136 #elif defined(SDL_VIDEO_DRIVER_RISCOS)
   156 #elif defined(SDL_VIDEO_DRIVER_RISCOS)
   137 
   157 
   138 /* RISC OS custom event structure */
   158 /**
   139 struct SDL_SysWMmsg
   159  *  RISC OS custom event structure.
   140 {
   160  */
   141     SDL_version version;
   161 struct SDL_SysWMmsg
   142     int eventCode;              /* The window for the message */
   162 {
       
   163     SDL_version version;
       
   164     int eventCode;              /**< The window for the message */
   143     int pollBlock[64];
   165     int pollBlock[64];
   144 };
   166 };
   145 
   167 
   146 /* The RISC OS custom window manager information structure */
   168 /**
   147 struct SDL_SysWMinfo
   169  *  The RISC OS custom window manager information structure.
   148 {
   170  */
   149     SDL_version version;
   171 struct SDL_SysWMinfo
   150     int wimpVersion;            /* Wimp version running under */
   172 {
   151     int taskHandle;             /* The RISC OS task handle */
   173     SDL_version version;
   152     int window;                 /* The RISC OS display window */
   174     int wimpVersion;            /**< Wimp version running under */
       
   175     int taskHandle;             /**< The RISC OS task handle */
       
   176     int window;                 /**< The RISC OS display window */
   153 };
   177 };
   154 
   178 
   155 #elif defined(SDL_VIDEO_DRIVER_PHOTON) || defined(SDL_VIDEO_DRIVER_QNXGF)
   179 #elif defined(SDL_VIDEO_DRIVER_PHOTON) || defined(SDL_VIDEO_DRIVER_QNXGF)
   156 #include <sys/neutrino.h>
   180 #include <sys/neutrino.h>
   157 #if defined(SDL_VIDEO_OPENGL_ES)
   181 #if defined(SDL_VIDEO_OPENGL_ES)
   158 #include <gf/gf.h>
   182 #include <gf/gf.h>
   159 #endif /* SDL_VIDEO_OPENGL_ES */
   183 #endif /* SDL_VIDEO_OPENGL_ES */
   160 #include <Ph.h>
   184 #include <Ph.h>
   161 
   185 
   162 /* The QNX custom event structure */
   186 /**
   163 struct SDL_SysWMmsg
   187  * The QNX custom event structure.
   164 {
   188  */
   165     SDL_version version;
   189 struct SDL_SysWMmsg
   166     int data;
   190 {
   167 };
   191     SDL_version version;
   168 
   192     int data;
   169 /* The QNX Photon custom window manager information structure */
   193 };
       
   194 
       
   195 /**
       
   196  *  The QNX Photon custom window manager information structure.
       
   197  */
   170 struct SDL_SysWMinfo
   198 struct SDL_SysWMinfo
   171 {
   199 {
   172     SDL_version version;
   200     SDL_version version;
   173     int data;
   201     int data;
   174 };
   202 };
   175 
   203 
   176 #else
   204 #else
   177 
   205 
   178 /* The generic custom event structure */
   206 /**
   179 struct SDL_SysWMmsg
   207  *  The generic custom event structure.
   180 {
   208  */
   181     SDL_version version;
   209 struct SDL_SysWMmsg
   182     int data;
   210 {
   183 };
   211     SDL_version version;
   184 
   212     int data;
   185 /* The generic custom window manager information structure */
   213 };
       
   214 
       
   215 /**
       
   216  *  The generic custom window manager information structure.
       
   217  */
   186 struct SDL_SysWMinfo
   218 struct SDL_SysWMinfo
   187 {
   219 {
   188     SDL_version version;
   220     SDL_version version;
   189     int data;
   221     int data;
   190 };
   222 };
   195 
   227 
   196 typedef struct SDL_SysWMinfo SDL_SysWMinfo;
   228 typedef struct SDL_SysWMinfo SDL_SysWMinfo;
   197 
   229 
   198 /* Function prototypes */
   230 /* Function prototypes */
   199 /**
   231 /**
   200  * \fn SDL_bool SDL_GetWindowWMInfo (SDL_WindowID windowID, SDL_SysWMinfo * info)
   232  *  \brief This function allows access to driver-dependent window information.
   201  *
   233  *  
   202  * \brief This function allows access to driver-dependent window information.
   234  *  \param windowID The window about which information is being requested
   203  *
   235  *  \param info This structure must be initialized with the SDL version, and is 
   204  * \param windowID The window about which information is being requested
   236  *              then filled in with information about the given window.
   205  * \param info This structure must be initialized with the SDL version, and is then filled in with information about the given window.
   237  *  
   206  *
   238  *  \return SDL_TRUE if the function is implemented and the version member of 
   207  * \return SDL_TRUE if the function is implemented and the version member of the 'info' struct is valid, SDL_FALSE otherwise.
   239  *          the \c info struct is valid, SDL_FALSE otherwise.
   208  *
   240  *  
   209  * You typically use this function like this:
   241  *  You typically use this function like this:
   210  * \code
   242  *  \code
   211  * SDL_SysWMInfo info;
   243  *  SDL_SysWMInfo info;
   212  * SDL_VERSION(&info.version);
   244  *  SDL_VERSION(&info.version);
   213  * if ( SDL_GetWindowWMInfo(&info) ) { ... }
   245  *  if ( SDL_GetWindowWMInfo(&info) ) { ... }
   214  * \endcode
   246  *  \endcode
   215  */
   247  */
   216 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID,
   248 extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID,
   217                                                      SDL_SysWMinfo * info);
   249                                                      SDL_SysWMinfo * info);
   218 
   250 
   219 
   251