include/SDL_syswm.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 10 Jul 2006 21:04:37 +0000
changeset 1895 c121d94672cb
parent 1760 a9be6a3a51d1
child 1956 ba0d62354872
permissions -rw-r--r--
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@1312
     3
    Copyright (C) 1997-2006 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@1895
    24
 * \file SDL_syswm.h
slouken@1895
    25
 *
slouken@1895
    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@0
    45
/* Your application has access to a special type of event 'SDL_SYSWMEVENT',
slouken@0
    46
   which contains window-manager specific information and arrives whenever
slouken@0
    47
   an unhandled window event occurs.  This event is ignored by default, but
slouken@0
    48
   you can enable it with SDL_EventState()
slouken@0
    49
*/
slouken@0
    50
#ifdef SDL_PROTOTYPES_ONLY
slouken@0
    51
struct SDL_SysWMinfo;
slouken@0
    52
#else
slouken@0
    53
slouken@1361
    54
/* This is the structure for custom window manager events */
slouken@1626
    55
#if defined(SDL_VIDEO_DRIVER_X11)
icculus@1133
    56
#if defined(__APPLE__) && defined(__MACH__)
slouken@1487
    57
/* conflicts with Quickdraw.h */
icculus@1133
    58
#define Cursor X11Cursor
icculus@1133
    59
#endif
icculus@1133
    60
slouken@0
    61
#include <X11/Xlib.h>
slouken@0
    62
#include <X11/Xatom.h>
slouken@0
    63
icculus@1133
    64
#if defined(__APPLE__) && defined(__MACH__)
slouken@1487
    65
/* matches the re-define above */
icculus@1133
    66
#undef Cursor
icculus@1133
    67
#endif
icculus@1133
    68
slouken@0
    69
/* These are the various supported subsystems under UNIX */
slouken@1895
    70
typedef enum
slouken@1895
    71
{
slouken@1895
    72
    SDL_SYSWM_X11
slouken@0
    73
} SDL_SYSWM_TYPE;
slouken@0
    74
slouken@0
    75
/* The UNIX custom event structure */
slouken@1895
    76
struct SDL_SysWMmsg
slouken@1895
    77
{
slouken@1895
    78
    SDL_version version;
slouken@1895
    79
    SDL_SYSWM_TYPE subsystem;
slouken@1895
    80
    union
slouken@1895
    81
    {
slouken@1895
    82
        XEvent xevent;
slouken@1895
    83
    } event;
slouken@0
    84
};
slouken@0
    85
slouken@0
    86
/* The UNIX custom window manager information structure.
slouken@0
    87
   When this structure is returned, it holds information about which
slouken@0
    88
   low level system it is using, and will be one of SDL_SYSWM_TYPE.
slouken@0
    89
 */
slouken@1895
    90
struct SDL_SysWMinfo
slouken@1895
    91
{
slouken@1895
    92
    SDL_version version;
slouken@1895
    93
    SDL_SYSWM_TYPE subsystem;
slouken@1895
    94
    union
slouken@1895
    95
    {
slouken@1895
    96
        struct
slouken@1895
    97
        {
slouken@1895
    98
            Display *display;   /* The X11 display */
slouken@1895
    99
            Window window;      /* The X11 display window */
slouken@1895
   100
            /* These locking functions should be called around
slouken@1895
   101
               any X11 functions using the display variable.
slouken@1895
   102
               They lock the event thread, so should not be
slouken@1895
   103
               called around event functions or from event filters.
slouken@1895
   104
             */
slouken@1895
   105
            void (*lock_func) (void);
slouken@1895
   106
            void (*unlock_func) (void);
slouken@0
   107
slouken@1895
   108
            /* Introduced in SDL 1.0.2 */
slouken@1895
   109
            Window fswindow;    /* The X11 fullscreen window */
slouken@1895
   110
            Window wmwindow;    /* The X11 managed input window */
slouken@1895
   111
        } x11;
slouken@1895
   112
    } info;
slouken@1895
   113
};
slouken@0
   114
slouken@1626
   115
#elif defined(SDL_VIDEO_DRIVER_NANOX)
slouken@30
   116
#include <microwin/nano-X.h>
slouken@30
   117
slouken@30
   118
/* The generic custom event structure */
slouken@1895
   119
struct SDL_SysWMmsg
slouken@1895
   120
{
slouken@1895
   121
    SDL_version version;
slouken@1895
   122
    int data;
slouken@30
   123
};
slouken@30
   124
slouken@30
   125
/* The windows custom window manager information structure */
slouken@1895
   126
struct SDL_SysWMinfo
slouken@1895
   127
{
slouken@1895
   128
    SDL_version version;
slouken@1895
   129
    GR_WINDOW_ID window;        /* The display window */
slouken@1895
   130
};
slouken@30
   131
slouken@1895
   132
#elif defined(SDL_VIDEO_DRIVER_WIN32)
slouken@1433
   133
#define WIN32_LEAN_AND_MEAN
slouken@1433
   134
#include <windows.h>
slouken@0
   135
slouken@0
   136
/* The windows custom event structure */
slouken@1895
   137
struct SDL_SysWMmsg
slouken@1895
   138
{
slouken@1895
   139
    SDL_version version;
slouken@1895
   140
    HWND hwnd;                  /* The window for the message */
slouken@1895
   141
    UINT msg;                   /* The type of message */
slouken@1895
   142
    WPARAM wParam;              /* WORD message parameter */
slouken@1895
   143
    LPARAM lParam;              /* LONG message parameter */
slouken@0
   144
};
slouken@0
   145
slouken@0
   146
/* The windows custom window manager information structure */
slouken@1895
   147
struct SDL_SysWMinfo
slouken@1895
   148
{
slouken@1895
   149
    SDL_version version;
slouken@1895
   150
    HWND window;                /* The Win32 display window */
slouken@1895
   151
    HGLRC hglrc;                /* The OpenGL context, if any */
slouken@1895
   152
};
slouken@0
   153
slouken@1626
   154
#elif defined(SDL_VIDEO_DRIVER_RISCOS)
slouken@630
   155
slouken@630
   156
/* RISC OS custom event structure */
slouken@1895
   157
struct SDL_SysWMmsg
slouken@1895
   158
{
slouken@1895
   159
    SDL_version version;
slouken@1895
   160
    int eventCode;              /* The window for the message */
slouken@1895
   161
    int pollBlock[64];
slouken@630
   162
};
slouken@630
   163
slouken@1035
   164
/* The RISC OS custom window manager information structure */
slouken@1895
   165
struct SDL_SysWMinfo
slouken@1895
   166
{
slouken@1895
   167
    SDL_version version;
slouken@1895
   168
    int wimpVersion;            /* Wimp version running under */
slouken@1895
   169
    int taskHandle;             /* The RISC OS task handle */
slouken@1895
   170
    int window;                 /* The RISC OS display window */
slouken@1895
   171
};
slouken@630
   172
slouken@1626
   173
#elif defined(SDL_VIDEO_DRIVER_PHOTON)
slouken@870
   174
#include <sys/neutrino.h>
slouken@870
   175
#include <Ph.h>
slouken@870
   176
slouken@870
   177
/* The QNX custom event structure */
slouken@1895
   178
struct SDL_SysWMmsg
slouken@1895
   179
{
slouken@1895
   180
    SDL_version version;
slouken@1895
   181
    int data;
slouken@870
   182
};
slouken@870
   183
slouken@870
   184
/* The QNX custom window manager information structure */
slouken@1895
   185
struct SDL_SysWMinfo
slouken@1895
   186
{
slouken@1895
   187
    SDL_version version;
slouken@1895
   188
    int data;
slouken@1895
   189
};
slouken@870
   190
slouken@0
   191
#else
slouken@0
   192
slouken@0
   193
/* The generic custom event structure */
slouken@1895
   194
struct SDL_SysWMmsg
slouken@1895
   195
{
slouken@1895
   196
    SDL_version version;
slouken@1895
   197
    int data;
slouken@0
   198
};
slouken@0
   199
slouken@0
   200
/* The generic custom window manager information structure */
slouken@1895
   201
struct SDL_SysWMinfo
slouken@1895
   202
{
slouken@1895
   203
    SDL_version version;
slouken@1895
   204
    int data;
slouken@1895
   205
};
slouken@0
   206
slouken@1361
   207
#endif /* video driver type */
slouken@0
   208
slouken@0
   209
#endif /* SDL_PROTOTYPES_ONLY */
slouken@0
   210
slouken@1895
   211
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
slouken@1895
   212
slouken@0
   213
/* Function prototypes */
slouken@1895
   214
/**
slouken@1895
   215
 * \fn SDL_bool SDL_GetWindowWMInfo (SDL_WindowID windowID, SDL_SysWMinfo * info)
slouken@1895
   216
 *
slouken@1895
   217
 * \brief This function allows access to driver-dependent window information.
slouken@1895
   218
 *
slouken@1895
   219
 * \param windowID The window about which information is being requested
slouken@1895
   220
 * \param info This structure must be initialized with the SDL version, and is then filled in with information about the given window.
slouken@1895
   221
 *
slouken@1895
   222
 * \return SDL_TRUE if the function is implemented and the version member of the 'info' struct is valid, SDL_FALSE otherwise.
slouken@999
   223
 *
slouken@999
   224
 * You typically use this function like this:
slouken@1895
   225
 * \code
slouken@999
   226
 * SDL_SysWMInfo info;
slouken@999
   227
 * SDL_VERSION(&info.version);
slouken@1895
   228
 * if ( SDL_GetWindowWMInfo(&info) ) { ... }
slouken@1895
   229
 * \endcode
slouken@0
   230
 */
slouken@1895
   231
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID,
slouken@1895
   232
                                                     SDL_SysWMinfo * info);
slouken@0
   233
slouken@0
   234
slouken@0
   235
/* Ends C function definitions when using C++ */
slouken@0
   236
#ifdef __cplusplus
slouken@1895
   237
/* *INDENT-OFF* */
slouken@0
   238
}
slouken@1895
   239
/* *INDENT-ON* */
slouken@0
   240
#endif
slouken@0
   241
#include "close_code.h"
slouken@0
   242
slouken@0
   243
#endif /* _SDL_syswm_h */
slouken@1895
   244
slouken@1895
   245
/* vi: set ts=4 sw=4 expandtab: */