include/SDL_syswm.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 19 Oct 2009 13:31:58 +0000
changeset 3407 d3baf5ac4e37
parent 3274 08574b033f37
child 3685 64ce267332c6
permissions -rw-r--r--
Partial fix for bug #859

Header file update from Ken for improved doxygen output
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@2859
     3
    Copyright (C) 1997-2009 Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1312
    13
    Lesser General Public License for more details.
slouken@0
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@251
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@0
    22
slouken@1895
    23
/**
slouken@3407
    24
 *  \file SDL_syswm.h
slouken@3407
    25
 *  
slouken@3407
    26
 *  Include file for SDL custom system window manager hooks.
slouken@1895
    27
 */
slouken@0
    28
slouken@0
    29
#ifndef _SDL_syswm_h
slouken@0
    30
#define _SDL_syswm_h
slouken@0
    31
slouken@1356
    32
#include "SDL_stdinc.h"
slouken@1358
    33
#include "SDL_error.h"
slouken@1895
    34
#include "SDL_video.h"
slouken@0
    35
#include "SDL_version.h"
slouken@0
    36
slouken@0
    37
#include "begin_code.h"
slouken@0
    38
/* Set up for C function definitions, even when using C++ */
slouken@0
    39
#ifdef __cplusplus
slouken@1895
    40
/* *INDENT-OFF* */
slouken@0
    41
extern "C" {
slouken@1895
    42
/* *INDENT-ON* */
slouken@0
    43
#endif
slouken@0
    44
slouken@3407
    45
/**
slouken@3407
    46
 *  \file SDL_syswm.h
slouken@3407
    47
 *  
slouken@3407
    48
 *  Your application has access to a special type of event ::SDL_SYSWMEVENT,
slouken@3407
    49
 *  which contains window-manager specific information and arrives whenever
slouken@3407
    50
 *  an unhandled window event occurs.  This event is ignored by default, but
slouken@3407
    51
 *  you can enable it with SDL_EventState().
slouken@3407
    52
 */
slouken@0
    53
#ifdef SDL_PROTOTYPES_ONLY
slouken@0
    54
struct SDL_SysWMinfo;
slouken@0
    55
#else
slouken@0
    56
slouken@1361
    57
/* This is the structure for custom window manager events */
slouken@1626
    58
#if defined(SDL_VIDEO_DRIVER_X11)
icculus@1133
    59
#if defined(__APPLE__) && defined(__MACH__)
slouken@1487
    60
/* conflicts with Quickdraw.h */
icculus@1133
    61
#define Cursor X11Cursor
icculus@1133
    62
#endif
icculus@1133
    63
slouken@0
    64
#include <X11/Xlib.h>
slouken@0
    65
#include <X11/Xatom.h>
slouken@0
    66
icculus@1133
    67
#if defined(__APPLE__) && defined(__MACH__)
slouken@1487
    68
/* matches the re-define above */
icculus@1133
    69
#undef Cursor
icculus@1133
    70
#endif
icculus@1133
    71
slouken@3407
    72
/** 
slouken@3407
    73
 *  These are the various supported subsystems under UNIX.
slouken@3407
    74
 */
slouken@1895
    75
typedef enum
slouken@1895
    76
{
slouken@1895
    77
    SDL_SYSWM_X11
slouken@0
    78
} SDL_SYSWM_TYPE;
slouken@0
    79
slouken@3407
    80
/**
slouken@3407
    81
 *  The UNIX custom event structure.
slouken@3407
    82
 */
slouken@1895
    83
struct SDL_SysWMmsg
slouken@1895
    84
{
slouken@1895
    85
    SDL_version version;
slouken@1895
    86
    SDL_SYSWM_TYPE subsystem;
slouken@1895
    87
    union
slouken@1895
    88
    {
slouken@1895
    89
        XEvent xevent;
slouken@1895
    90
    } event;
slouken@0
    91
};
slouken@0
    92
slouken@3407
    93
/**
slouken@3407
    94
 *  The UNIX custom window manager information structure.
slouken@3407
    95
 *
slouken@3407
    96
 *  When this structure is returned, it holds information about which
slouken@3407
    97
 *  low level system it is using, and will be one of SDL_SYSWM_TYPE.
slouken@0
    98
 */
slouken@1895
    99
struct SDL_SysWMinfo
slouken@1895
   100
{
slouken@1895
   101
    SDL_version version;
slouken@1895
   102
    SDL_SYSWM_TYPE subsystem;
slouken@1895
   103
    union
slouken@1895
   104
    {
slouken@1895
   105
        struct
slouken@1895
   106
        {
slouken@3407
   107
            Display *display;   /**< The X11 display */
slouken@3407
   108
            Window window;      /**< The X11 display window */
slouken@3407
   109
            /**
slouken@3407
   110
             *  These locking functions should be called around
slouken@3407
   111
             *  any X11 functions using the display variable.
slouken@3407
   112
             *  They lock the event thread, so should not be
slouken@3407
   113
             *  called around event functions or from event filters.
slouken@1895
   114
             */
slouken@3407
   115
            /*@{*/
slouken@1895
   116
            void (*lock_func) (void);
slouken@1895
   117
            void (*unlock_func) (void);
slouken@3407
   118
            /*@}*/
slouken@0
   119
slouken@3407
   120
            /**
slouken@3407
   121
             *  Introduced in SDL 1.0.2.
slouken@3407
   122
             */
slouken@3407
   123
            /*@{*/
slouken@3407
   124
            Window fswindow;    /**< The X11 fullscreen window */
slouken@3407
   125
            Window wmwindow;    /**< The X11 managed input window */
slouken@3407
   126
            /*@}*/
slouken@1895
   127
        } x11;
slouken@1895
   128
    } info;
slouken@1895
   129
};
slouken@0
   130
slouken@1895
   131
#elif defined(SDL_VIDEO_DRIVER_WIN32)
slouken@1433
   132
#define WIN32_LEAN_AND_MEAN
slouken@1433
   133
#include <windows.h>
slouken@0
   134
slouken@3407
   135
/**
slouken@3407
   136
 *  The windows custom event structure.
slouken@3407
   137
 */
slouken@1895
   138
struct SDL_SysWMmsg
slouken@1895
   139
{
slouken@1895
   140
    SDL_version version;
slouken@3407
   141
    HWND hwnd;                  /**< The window for the message */
slouken@3407
   142
    UINT msg;                   /**< The type of message */
slouken@3407
   143
    WPARAM wParam;              /**< WORD message parameter */
slouken@3407
   144
    LPARAM lParam;              /**< LONG message parameter */
slouken@0
   145
};
slouken@0
   146
slouken@3407
   147
/**
slouken@3407
   148
 *  The windows custom window manager information structure.
slouken@3407
   149
 */
slouken@1895
   150
struct SDL_SysWMinfo
slouken@1895
   151
{
slouken@1895
   152
    SDL_version version;
slouken@3407
   153
    HWND window;                /**< The Win32 display window */
slouken@1895
   154
};
slouken@0
   155
slouken@1626
   156
#elif defined(SDL_VIDEO_DRIVER_RISCOS)
slouken@630
   157
slouken@3407
   158
/**
slouken@3407
   159
 *  RISC OS custom event structure.
slouken@3407
   160
 */
slouken@1895
   161
struct SDL_SysWMmsg
slouken@1895
   162
{
slouken@1895
   163
    SDL_version version;
slouken@3407
   164
    int eventCode;              /**< The window for the message */
slouken@1895
   165
    int pollBlock[64];
slouken@630
   166
};
slouken@630
   167
slouken@3407
   168
/**
slouken@3407
   169
 *  The RISC OS custom window manager information structure.
slouken@3407
   170
 */
slouken@1895
   171
struct SDL_SysWMinfo
slouken@1895
   172
{
slouken@1895
   173
    SDL_version version;
slouken@3407
   174
    int wimpVersion;            /**< Wimp version running under */
slouken@3407
   175
    int taskHandle;             /**< The RISC OS task handle */
slouken@3407
   176
    int window;                 /**< The RISC OS display window */
slouken@1895
   177
};
slouken@630
   178
slouken@3087
   179
#elif defined(SDL_VIDEO_DRIVER_PHOTON) || defined(SDL_VIDEO_DRIVER_QNXGF)
slouken@870
   180
#include <sys/neutrino.h>
lestat@3114
   181
#if defined(SDL_VIDEO_OPENGL_ES)
lestat@3114
   182
#include <gf/gf.h>
lestat@3114
   183
#endif /* SDL_VIDEO_OPENGL_ES */
slouken@870
   184
#include <Ph.h>
slouken@870
   185
slouken@3407
   186
/**
slouken@3407
   187
 * The QNX custom event structure.
slouken@3407
   188
 */
slouken@1895
   189
struct SDL_SysWMmsg
slouken@1895
   190
{
slouken@1895
   191
    SDL_version version;
slouken@1895
   192
    int data;
slouken@870
   193
};
slouken@870
   194
slouken@3407
   195
/**
slouken@3407
   196
 *  The QNX Photon custom window manager information structure.
slouken@3407
   197
 */
slouken@1895
   198
struct SDL_SysWMinfo
slouken@1895
   199
{
slouken@1895
   200
    SDL_version version;
slouken@1895
   201
    int data;
slouken@1895
   202
};
slouken@870
   203
slouken@0
   204
#else
slouken@0
   205
slouken@3407
   206
/**
slouken@3407
   207
 *  The generic custom event structure.
slouken@3407
   208
 */
slouken@1895
   209
struct SDL_SysWMmsg
slouken@1895
   210
{
slouken@1895
   211
    SDL_version version;
slouken@1895
   212
    int data;
slouken@0
   213
};
slouken@0
   214
slouken@3407
   215
/**
slouken@3407
   216
 *  The generic custom window manager information structure.
slouken@3407
   217
 */
slouken@1895
   218
struct SDL_SysWMinfo
slouken@1895
   219
{
slouken@1895
   220
    SDL_version version;
slouken@1895
   221
    int data;
slouken@1895
   222
};
slouken@0
   223
slouken@1361
   224
#endif /* video driver type */
slouken@0
   225
slouken@0
   226
#endif /* SDL_PROTOTYPES_ONLY */
slouken@0
   227
slouken@1895
   228
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
slouken@1895
   229
slouken@0
   230
/* Function prototypes */
slouken@1895
   231
/**
slouken@3407
   232
 *  \brief This function allows access to driver-dependent window information.
slouken@3407
   233
 *  
slouken@3407
   234
 *  \param windowID The window about which information is being requested
slouken@3407
   235
 *  \param info This structure must be initialized with the SDL version, and is 
slouken@3407
   236
 *              then filled in with information about the given window.
slouken@3407
   237
 *  
slouken@3407
   238
 *  \return SDL_TRUE if the function is implemented and the version member of 
slouken@3407
   239
 *          the \c info struct is valid, SDL_FALSE otherwise.
slouken@3407
   240
 *  
slouken@3407
   241
 *  You typically use this function like this:
slouken@3407
   242
 *  \code
slouken@3407
   243
 *  SDL_SysWMInfo info;
slouken@3407
   244
 *  SDL_VERSION(&info.version);
slouken@3407
   245
 *  if ( SDL_GetWindowWMInfo(&info) ) { ... }
slouken@3407
   246
 *  \endcode
slouken@0
   247
 */
slouken@1895
   248
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID,
slouken@1895
   249
                                                     SDL_SysWMinfo * info);
slouken@0
   250
slouken@0
   251
slouken@0
   252
/* Ends C function definitions when using C++ */
slouken@0
   253
#ifdef __cplusplus
slouken@1895
   254
/* *INDENT-OFF* */
slouken@0
   255
}
slouken@1895
   256
/* *INDENT-ON* */
slouken@0
   257
#endif
slouken@0
   258
#include "close_code.h"
slouken@0
   259
slouken@0
   260
#endif /* _SDL_syswm_h */
slouken@1895
   261
slouken@1895
   262
/* vi: set ts=4 sw=4 expandtab: */