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