include/SDL_syswm.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 27 Sep 2010 00:50:46 -0700
changeset 4899 5d529386db73
parent 4895 fd27410a5db0
child 4900 69d9db65f248
permissions -rw-r--r--
attached is a patch to support DirectFB in include/SDL_syswm.h. It
defines SDL_SYSWM_DIRECTFB as a subsystem.
This allows developers to e.g. access DirectFB's video and picture
providers.

Kind regards,

André
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@4899
    58
#if defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@1626
    59
#if defined(SDL_VIDEO_DRIVER_X11)
icculus@1133
    60
#if defined(__APPLE__) && defined(__MACH__)
slouken@1487
    61
/* conflicts with Quickdraw.h */
icculus@1133
    62
#define Cursor X11Cursor
icculus@1133
    63
#endif
icculus@1133
    64
slouken@0
    65
#include <X11/Xlib.h>
slouken@0
    66
#include <X11/Xatom.h>
slouken@0
    67
icculus@1133
    68
#if defined(__APPLE__) && defined(__MACH__)
slouken@1487
    69
/* matches the re-define above */
icculus@1133
    70
#undef Cursor
icculus@1133
    71
#endif
icculus@1133
    72
slouken@4899
    73
#endif /* defined(SDL_VIDEO_DRIVER_X11) */
slouken@4899
    74
slouken@4899
    75
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@4899
    76
#include <directfb/directfb.h>
slouken@4899
    77
#endif
slouken@3407
    78
/** 
slouken@3407
    79
 *  These are the various supported subsystems under UNIX.
slouken@3407
    80
 */
slouken@1895
    81
typedef enum
slouken@1895
    82
{
slouken@4899
    83
#if defined(SDL_VIDEO_DRIVER_X11)
slouken@4899
    84
    SDL_SYSWM_X11,
slouken@4899
    85
#endif
slouken@4899
    86
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@4899
    87
    SDL_SYSWM_DIRECTFB,
slouken@4899
    88
#endif
slouken@0
    89
} SDL_SYSWM_TYPE;
slouken@0
    90
slouken@3407
    91
/**
slouken@3407
    92
 *  The UNIX custom event structure.
slouken@3407
    93
 */
slouken@1895
    94
struct SDL_SysWMmsg
slouken@1895
    95
{
slouken@1895
    96
    SDL_version version;
slouken@1895
    97
    SDL_SYSWM_TYPE subsystem;
slouken@1895
    98
    union
slouken@1895
    99
    {
slouken@4899
   100
#if defined(SDL_VIDEO_DRIVER_X11)
slouken@1895
   101
        XEvent xevent;
slouken@4899
   102
#endif
slouken@4899
   103
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@4899
   104
        DFBEvent dfb_event;
slouken@4899
   105
#endif
slouken@1895
   106
    } event;
slouken@0
   107
};
slouken@0
   108
slouken@3407
   109
/**
slouken@3407
   110
 *  The UNIX custom window manager information structure.
slouken@3407
   111
 *
slouken@3407
   112
 *  When this structure is returned, it holds information about which
slouken@3407
   113
 *  low level system it is using, and will be one of SDL_SYSWM_TYPE.
slouken@0
   114
 */
slouken@1895
   115
struct SDL_SysWMinfo
slouken@1895
   116
{
slouken@1895
   117
    SDL_version version;
slouken@1895
   118
    SDL_SYSWM_TYPE subsystem;
slouken@1895
   119
    union
slouken@1895
   120
    {
slouken@4899
   121
#if defined(SDL_VIDEO_DRIVER_X11)
slouken@1895
   122
        struct
slouken@1895
   123
        {
slouken@3407
   124
            Display *display;   /**< The X11 display */
slouken@3407
   125
            Window window;      /**< The X11 display window */
slouken@1895
   126
        } x11;
slouken@4899
   127
#endif
slouken@4899
   128
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@4899
   129
        struct
slouken@4899
   130
        {
slouken@4899
   131
        	IDirectFB *dfb;   			/**< The directfb main interface */
slouken@4899
   132
        	IDirectFBWindow *window;    /**< The directfb window handle */
slouken@4899
   133
        	IDirectFBSurface *surface;  /**< The directfb client surface */
slouken@4899
   134
        } directfb;
slouken@4899
   135
#endif
slouken@1895
   136
    } info;
slouken@1895
   137
};
slouken@0
   138
slouken@1895
   139
#elif defined(SDL_VIDEO_DRIVER_WIN32)
slouken@1433
   140
#define WIN32_LEAN_AND_MEAN
slouken@1433
   141
#include <windows.h>
slouken@0
   142
slouken@3407
   143
/**
slouken@3407
   144
 *  The windows custom event structure.
slouken@3407
   145
 */
slouken@1895
   146
struct SDL_SysWMmsg
slouken@1895
   147
{
slouken@1895
   148
    SDL_version version;
slouken@3407
   149
    HWND hwnd;                  /**< The window for the message */
slouken@3407
   150
    UINT msg;                   /**< The type of message */
slouken@3407
   151
    WPARAM wParam;              /**< WORD message parameter */
slouken@3407
   152
    LPARAM lParam;              /**< LONG message parameter */
slouken@0
   153
};
slouken@0
   154
slouken@3407
   155
/**
slouken@3407
   156
 *  The windows custom window manager information structure.
slouken@3407
   157
 */
slouken@1895
   158
struct SDL_SysWMinfo
slouken@1895
   159
{
slouken@1895
   160
    SDL_version version;
slouken@3407
   161
    HWND window;                /**< The Win32 display window */
slouken@1895
   162
};
slouken@0
   163
slouken@1626
   164
#elif defined(SDL_VIDEO_DRIVER_RISCOS)
slouken@630
   165
slouken@3407
   166
/**
slouken@3407
   167
 *  RISC OS custom event structure.
slouken@3407
   168
 */
slouken@1895
   169
struct SDL_SysWMmsg
slouken@1895
   170
{
slouken@1895
   171
    SDL_version version;
slouken@3407
   172
    int eventCode;              /**< The window for the message */
slouken@1895
   173
    int pollBlock[64];
slouken@630
   174
};
slouken@630
   175
slouken@3407
   176
/**
slouken@3407
   177
 *  The RISC OS custom window manager information structure.
slouken@3407
   178
 */
slouken@1895
   179
struct SDL_SysWMinfo
slouken@1895
   180
{
slouken@1895
   181
    SDL_version version;
slouken@3407
   182
    int wimpVersion;            /**< Wimp version running under */
slouken@3407
   183
    int taskHandle;             /**< The RISC OS task handle */
slouken@3407
   184
    int window;                 /**< The RISC OS display window */
slouken@1895
   185
};
slouken@630
   186
slouken@3087
   187
#elif defined(SDL_VIDEO_DRIVER_PHOTON) || defined(SDL_VIDEO_DRIVER_QNXGF)
slouken@870
   188
#include <sys/neutrino.h>
lestat@3114
   189
#if defined(SDL_VIDEO_OPENGL_ES)
lestat@3114
   190
#include <gf/gf.h>
lestat@3114
   191
#endif /* SDL_VIDEO_OPENGL_ES */
slouken@870
   192
#include <Ph.h>
slouken@870
   193
slouken@3407
   194
/**
slouken@3407
   195
 * The QNX custom event structure.
slouken@3407
   196
 */
slouken@1895
   197
struct SDL_SysWMmsg
slouken@1895
   198
{
slouken@1895
   199
    SDL_version version;
slouken@1895
   200
    int data;
slouken@870
   201
};
slouken@870
   202
slouken@3407
   203
/**
slouken@3407
   204
 *  The QNX Photon custom window manager information structure.
slouken@3407
   205
 */
slouken@1895
   206
struct SDL_SysWMinfo
slouken@1895
   207
{
slouken@1895
   208
    SDL_version version;
slouken@1895
   209
    int data;
slouken@1895
   210
};
slouken@870
   211
slouken@0
   212
#else
slouken@0
   213
slouken@3407
   214
/**
slouken@3407
   215
 *  The generic custom event structure.
slouken@3407
   216
 */
slouken@1895
   217
struct SDL_SysWMmsg
slouken@1895
   218
{
slouken@1895
   219
    SDL_version version;
slouken@1895
   220
    int data;
slouken@0
   221
};
slouken@0
   222
slouken@3407
   223
/**
slouken@3407
   224
 *  The generic custom window manager information structure.
slouken@3407
   225
 */
slouken@1895
   226
struct SDL_SysWMinfo
slouken@1895
   227
{
slouken@1895
   228
    SDL_version version;
slouken@1895
   229
    int data;
slouken@1895
   230
};
slouken@0
   231
slouken@1361
   232
#endif /* video driver type */
slouken@0
   233
slouken@0
   234
#endif /* SDL_PROTOTYPES_ONLY */
slouken@0
   235
slouken@1895
   236
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
slouken@1895
   237
slouken@0
   238
/* Function prototypes */
slouken@1895
   239
/**
slouken@3407
   240
 *  \brief This function allows access to driver-dependent window information.
slouken@3407
   241
 *  
slouken@4530
   242
 *  \param window The window about which information is being requested
slouken@3407
   243
 *  \param info This structure must be initialized with the SDL version, and is 
slouken@3407
   244
 *              then filled in with information about the given window.
slouken@3407
   245
 *  
slouken@3407
   246
 *  \return SDL_TRUE if the function is implemented and the version member of 
slouken@3407
   247
 *          the \c info struct is valid, SDL_FALSE otherwise.
slouken@3407
   248
 *  
slouken@3407
   249
 *  You typically use this function like this:
slouken@3407
   250
 *  \code
slouken@4895
   251
 *  SDL_SysWMinfo info;
slouken@3407
   252
 *  SDL_VERSION(&info.version);
slouken@3407
   253
 *  if ( SDL_GetWindowWMInfo(&info) ) { ... }
slouken@3407
   254
 *  \endcode
slouken@0
   255
 */
slouken@3685
   256
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
slouken@1895
   257
                                                     SDL_SysWMinfo * info);
slouken@0
   258
slouken@0
   259
slouken@0
   260
/* Ends C function definitions when using C++ */
slouken@0
   261
#ifdef __cplusplus
slouken@1895
   262
/* *INDENT-OFF* */
slouken@0
   263
}
slouken@1895
   264
/* *INDENT-ON* */
slouken@0
   265
#endif
slouken@0
   266
#include "close_code.h"
slouken@0
   267
slouken@0
   268
#endif /* _SDL_syswm_h */
slouken@1895
   269
slouken@1895
   270
/* vi: set ts=4 sw=4 expandtab: */