include/SDL_syswm.h
author Sam Lantinga <slouken@libsdl.org>
Wed, 04 Mar 2009 15:10:47 +0000
changeset 3087 0b6f51c29267
parent 2859 99210400e8b9
child 3114 979164e58723
permissions -rw-r--r--
Date: Wed, 4 Mar 2009 15:38:22 +0200
From: "Mike Gorchak"
Subject: Re: About QNX support in SDL 1.3

Here is another batch of patches.

1) Makefile.in - added SDL_opengles.h header as header to install.
2) configure.in - Added special define to detect Common Lite OpenGL ES
library in case if Common library is not installed. Added check for
clock_gettime in libc (in QNX it is in libc).
3) SDL_config.h.in - Added SDL_VIDEO_RENDER_OPENGL_ES and
SDL_VIDEO_OPENGL_ES declarations for configure script autodetection.
4) SDL_opengles.h - Added GL_API definition if it is not defined. Added
extension GL_OES_draw_texture because OpenGL ES Renderer uses it without
declaration. Added GL_OES_vertex_buffer_object extension, which is supported
under QNX OpenGL ES. Added GL_OES_single_precision extension.
5) To the test directory I've added building OpenGL ES test applications
through the autotools suite. Was support for iPhone IDE building only.
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@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
};
slouken@0
   152
slouken@1626
   153
#elif defined(SDL_VIDEO_DRIVER_RISCOS)
slouken@630
   154
slouken@630
   155
/* RISC OS custom event structure */
slouken@1895
   156
struct SDL_SysWMmsg
slouken@1895
   157
{
slouken@1895
   158
    SDL_version version;
slouken@1895
   159
    int eventCode;              /* The window for the message */
slouken@1895
   160
    int pollBlock[64];
slouken@630
   161
};
slouken@630
   162
slouken@1035
   163
/* The RISC OS custom window manager information structure */
slouken@1895
   164
struct SDL_SysWMinfo
slouken@1895
   165
{
slouken@1895
   166
    SDL_version version;
slouken@1895
   167
    int wimpVersion;            /* Wimp version running under */
slouken@1895
   168
    int taskHandle;             /* The RISC OS task handle */
slouken@1895
   169
    int window;                 /* The RISC OS display window */
slouken@1895
   170
};
slouken@630
   171
slouken@3087
   172
#elif defined(SDL_VIDEO_DRIVER_PHOTON) || defined(SDL_VIDEO_DRIVER_QNXGF)
slouken@870
   173
#include <sys/neutrino.h>
slouken@870
   174
#include <Ph.h>
slouken@870
   175
slouken@870
   176
/* The QNX custom event structure */
slouken@1895
   177
struct SDL_SysWMmsg
slouken@1895
   178
{
slouken@1895
   179
    SDL_version version;
slouken@1895
   180
    int data;
slouken@870
   181
};
slouken@870
   182
slouken@3087
   183
/* The QNX Photon custom window manager information structure */
slouken@1895
   184
struct SDL_SysWMinfo
slouken@1895
   185
{
slouken@1895
   186
    SDL_version version;
slouken@1895
   187
    int data;
slouken@1895
   188
};
slouken@870
   189
slouken@0
   190
#else
slouken@0
   191
slouken@0
   192
/* The generic custom event structure */
slouken@1895
   193
struct SDL_SysWMmsg
slouken@1895
   194
{
slouken@1895
   195
    SDL_version version;
slouken@1895
   196
    int data;
slouken@0
   197
};
slouken@0
   198
slouken@0
   199
/* The generic custom window manager information structure */
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@1895
   214
 * \fn SDL_bool SDL_GetWindowWMInfo (SDL_WindowID windowID, SDL_SysWMinfo * info)
slouken@1895
   215
 *
slouken@1895
   216
 * \brief This function allows access to driver-dependent window information.
slouken@1895
   217
 *
slouken@1895
   218
 * \param windowID The window about which information is being requested
slouken@1895
   219
 * \param info This structure must be initialized with the SDL version, and is then filled in with information about the given window.
slouken@1895
   220
 *
slouken@1895
   221
 * \return SDL_TRUE if the function is implemented and the version member of the 'info' struct is valid, SDL_FALSE otherwise.
slouken@999
   222
 *
slouken@999
   223
 * You typically use this function like this:
slouken@1895
   224
 * \code
slouken@999
   225
 * SDL_SysWMInfo info;
slouken@999
   226
 * SDL_VERSION(&info.version);
slouken@1895
   227
 * if ( SDL_GetWindowWMInfo(&info) ) { ... }
slouken@1895
   228
 * \endcode
slouken@0
   229
 */
slouken@1895
   230
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_WindowID windowID,
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: */