include/SDL_syswm.h
author Sam Lantinga <slouken@libsdl.org>
Sat, 25 Sep 2010 17:06:41 -0700
changeset 4895 fd27410a5db0
parent 4530 4069c65b01f2
child 4899 5d529386db73
permissions -rw-r--r--
Fixed documentation typo
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@3697
     3
    Copyright (C) 1997-2010 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@1895
   109
        } x11;
slouken@1895
   110
    } info;
slouken@1895
   111
};
slouken@0
   112
slouken@1895
   113
#elif defined(SDL_VIDEO_DRIVER_WIN32)
slouken@1433
   114
#define WIN32_LEAN_AND_MEAN
slouken@1433
   115
#include <windows.h>
slouken@0
   116
slouken@3407
   117
/**
slouken@3407
   118
 *  The windows custom event structure.
slouken@3407
   119
 */
slouken@1895
   120
struct SDL_SysWMmsg
slouken@1895
   121
{
slouken@1895
   122
    SDL_version version;
slouken@3407
   123
    HWND hwnd;                  /**< The window for the message */
slouken@3407
   124
    UINT msg;                   /**< The type of message */
slouken@3407
   125
    WPARAM wParam;              /**< WORD message parameter */
slouken@3407
   126
    LPARAM lParam;              /**< LONG message parameter */
slouken@0
   127
};
slouken@0
   128
slouken@3407
   129
/**
slouken@3407
   130
 *  The windows custom window manager information structure.
slouken@3407
   131
 */
slouken@1895
   132
struct SDL_SysWMinfo
slouken@1895
   133
{
slouken@1895
   134
    SDL_version version;
slouken@3407
   135
    HWND window;                /**< The Win32 display window */
slouken@1895
   136
};
slouken@0
   137
slouken@1626
   138
#elif defined(SDL_VIDEO_DRIVER_RISCOS)
slouken@630
   139
slouken@3407
   140
/**
slouken@3407
   141
 *  RISC OS custom event structure.
slouken@3407
   142
 */
slouken@1895
   143
struct SDL_SysWMmsg
slouken@1895
   144
{
slouken@1895
   145
    SDL_version version;
slouken@3407
   146
    int eventCode;              /**< The window for the message */
slouken@1895
   147
    int pollBlock[64];
slouken@630
   148
};
slouken@630
   149
slouken@3407
   150
/**
slouken@3407
   151
 *  The RISC OS custom window manager information structure.
slouken@3407
   152
 */
slouken@1895
   153
struct SDL_SysWMinfo
slouken@1895
   154
{
slouken@1895
   155
    SDL_version version;
slouken@3407
   156
    int wimpVersion;            /**< Wimp version running under */
slouken@3407
   157
    int taskHandle;             /**< The RISC OS task handle */
slouken@3407
   158
    int window;                 /**< The RISC OS display window */
slouken@1895
   159
};
slouken@630
   160
slouken@3087
   161
#elif defined(SDL_VIDEO_DRIVER_PHOTON) || defined(SDL_VIDEO_DRIVER_QNXGF)
slouken@870
   162
#include <sys/neutrino.h>
lestat@3114
   163
#if defined(SDL_VIDEO_OPENGL_ES)
lestat@3114
   164
#include <gf/gf.h>
lestat@3114
   165
#endif /* SDL_VIDEO_OPENGL_ES */
slouken@870
   166
#include <Ph.h>
slouken@870
   167
slouken@3407
   168
/**
slouken@3407
   169
 * The QNX custom event structure.
slouken@3407
   170
 */
slouken@1895
   171
struct SDL_SysWMmsg
slouken@1895
   172
{
slouken@1895
   173
    SDL_version version;
slouken@1895
   174
    int data;
slouken@870
   175
};
slouken@870
   176
slouken@3407
   177
/**
slouken@3407
   178
 *  The QNX Photon custom window manager information structure.
slouken@3407
   179
 */
slouken@1895
   180
struct SDL_SysWMinfo
slouken@1895
   181
{
slouken@1895
   182
    SDL_version version;
slouken@1895
   183
    int data;
slouken@1895
   184
};
slouken@870
   185
slouken@0
   186
#else
slouken@0
   187
slouken@3407
   188
/**
slouken@3407
   189
 *  The generic custom event structure.
slouken@3407
   190
 */
slouken@1895
   191
struct SDL_SysWMmsg
slouken@1895
   192
{
slouken@1895
   193
    SDL_version version;
slouken@1895
   194
    int data;
slouken@0
   195
};
slouken@0
   196
slouken@3407
   197
/**
slouken@3407
   198
 *  The generic custom window manager information structure.
slouken@3407
   199
 */
slouken@1895
   200
struct SDL_SysWMinfo
slouken@1895
   201
{
slouken@1895
   202
    SDL_version version;
slouken@1895
   203
    int data;
slouken@1895
   204
};
slouken@0
   205
slouken@1361
   206
#endif /* video driver type */
slouken@0
   207
slouken@0
   208
#endif /* SDL_PROTOTYPES_ONLY */
slouken@0
   209
slouken@1895
   210
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
slouken@1895
   211
slouken@0
   212
/* Function prototypes */
slouken@1895
   213
/**
slouken@3407
   214
 *  \brief This function allows access to driver-dependent window information.
slouken@3407
   215
 *  
slouken@4530
   216
 *  \param window The window about which information is being requested
slouken@3407
   217
 *  \param info This structure must be initialized with the SDL version, and is 
slouken@3407
   218
 *              then filled in with information about the given window.
slouken@3407
   219
 *  
slouken@3407
   220
 *  \return SDL_TRUE if the function is implemented and the version member of 
slouken@3407
   221
 *          the \c info struct is valid, SDL_FALSE otherwise.
slouken@3407
   222
 *  
slouken@3407
   223
 *  You typically use this function like this:
slouken@3407
   224
 *  \code
slouken@4895
   225
 *  SDL_SysWMinfo info;
slouken@3407
   226
 *  SDL_VERSION(&info.version);
slouken@3407
   227
 *  if ( SDL_GetWindowWMInfo(&info) ) { ... }
slouken@3407
   228
 *  \endcode
slouken@0
   229
 */
slouken@3685
   230
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
slouken@1895
   231
                                                     SDL_SysWMinfo * info);
slouken@0
   232
slouken@0
   233
slouken@0
   234
/* Ends C function definitions when using C++ */
slouken@0
   235
#ifdef __cplusplus
slouken@1895
   236
/* *INDENT-OFF* */
slouken@0
   237
}
slouken@1895
   238
/* *INDENT-ON* */
slouken@0
   239
#endif
slouken@0
   240
#include "close_code.h"
slouken@0
   241
slouken@0
   242
#endif /* _SDL_syswm_h */
slouken@1895
   243
slouken@1895
   244
/* vi: set ts=4 sw=4 expandtab: */