include/SDL_syswm.h
author Sam Lantinga <slouken@libsdl.org>
Wed, 12 Jan 2011 15:42:26 -0800
changeset 4986 8431f59485d0
parent 4903 f50c7996d925
child 5056 8b7988f42fcb
permissions -rw-r--r--
Renderer didn't advertise texture format SDL_PIXELFORMAT_ABGR8888
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@4900
    57
#if defined(SDL_VIDEO_DRIVER_WIN32)
slouken@4900
    58
#define WIN32_LEAN_AND_MEAN
slouken@4900
    59
#include <windows.h>
slouken@4900
    60
#endif
slouken@4900
    61
slouken@1361
    62
/* This is the structure for custom window manager events */
slouken@1626
    63
#if defined(SDL_VIDEO_DRIVER_X11)
icculus@1133
    64
#if defined(__APPLE__) && defined(__MACH__)
slouken@1487
    65
/* conflicts with Quickdraw.h */
icculus@1133
    66
#define Cursor X11Cursor
icculus@1133
    67
#endif
icculus@1133
    68
slouken@0
    69
#include <X11/Xlib.h>
slouken@0
    70
#include <X11/Xatom.h>
slouken@0
    71
icculus@1133
    72
#if defined(__APPLE__) && defined(__MACH__)
slouken@1487
    73
/* matches the re-define above */
icculus@1133
    74
#undef Cursor
icculus@1133
    75
#endif
icculus@1133
    76
slouken@4899
    77
#endif /* defined(SDL_VIDEO_DRIVER_X11) */
slouken@4899
    78
slouken@4899
    79
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@4899
    80
#include <directfb/directfb.h>
slouken@4899
    81
#endif
slouken@4900
    82
slouken@4900
    83
#if defined(SDL_VIDEO_DRIVER_COCOA)
slouken@4900
    84
#ifdef __OBJC__
slouken@4900
    85
#include <Cocoa/Cocoa.h>
slouken@4900
    86
#else
slouken@4900
    87
typedef struct _NSWindow NSWindow;
slouken@4900
    88
#endif
slouken@4900
    89
#endif
slouken@4900
    90
slouken@3407
    91
/** 
slouken@4900
    92
 *  These are the various supported windowing subsystems
slouken@3407
    93
 */
slouken@1895
    94
typedef enum
slouken@1895
    95
{
slouken@4900
    96
    SDL_SYSWM_UNKNOWN,
slouken@4900
    97
    SDL_SYSWM_WINDOWS,
slouken@4899
    98
    SDL_SYSWM_X11,
slouken@4899
    99
    SDL_SYSWM_DIRECTFB,
slouken@4900
   100
    SDL_SYSWM_COCOA,
slouken@0
   101
} SDL_SYSWM_TYPE;
slouken@0
   102
slouken@3407
   103
/**
slouken@4900
   104
 *  The custom event structure.
slouken@3407
   105
 */
slouken@1895
   106
struct SDL_SysWMmsg
slouken@1895
   107
{
slouken@1895
   108
    SDL_version version;
slouken@1895
   109
    SDL_SYSWM_TYPE subsystem;
slouken@1895
   110
    union
slouken@1895
   111
    {
slouken@4900
   112
#if defined(SDL_VIDEO_DRIVER_WIN32)
slouken@4900
   113
        struct {
slouken@4900
   114
            HWND hwnd;                  /**< The window for the message */
slouken@4900
   115
            UINT msg;                   /**< The type of message */
slouken@4900
   116
            WPARAM wParam;              /**< WORD message parameter */
slouken@4900
   117
            LPARAM lParam;              /**< LONG message parameter */
slouken@4900
   118
        } win;
slouken@4900
   119
#endif
slouken@4899
   120
#if defined(SDL_VIDEO_DRIVER_X11)
slouken@4900
   121
        struct {
slouken@4900
   122
            XEvent event;
slouken@4900
   123
        } x11;
slouken@4899
   124
#endif
slouken@4899
   125
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@4900
   126
        struct {
slouken@4900
   127
            DFBEvent event;
slouken@4900
   128
        } dfb;
slouken@4899
   129
#endif
slouken@4900
   130
#if defined(SDL_VIDEO_DRIVER_COCOA)
slouken@4900
   131
        struct
slouken@4900
   132
        {
slouken@4900
   133
            /* No Cocoa window events yet */
slouken@4900
   134
        } cocoa;
slouken@4900
   135
#endif
slouken@4902
   136
    } /*msg*/;
slouken@0
   137
};
slouken@0
   138
slouken@3407
   139
/**
slouken@4900
   140
 *  The custom window manager information structure.
slouken@3407
   141
 *
slouken@3407
   142
 *  When this structure is returned, it holds information about which
slouken@3407
   143
 *  low level system it is using, and will be one of SDL_SYSWM_TYPE.
slouken@0
   144
 */
slouken@1895
   145
struct SDL_SysWMinfo
slouken@1895
   146
{
slouken@1895
   147
    SDL_version version;
slouken@1895
   148
    SDL_SYSWM_TYPE subsystem;
slouken@1895
   149
    union
slouken@1895
   150
    {
slouken@4900
   151
#if defined(SDL_VIDEO_DRIVER_WIN32)
slouken@4900
   152
        struct
slouken@4900
   153
        {
slouken@4903
   154
            HWND window;                /**< The window handle */
slouken@4900
   155
        } win;
slouken@4900
   156
#endif
slouken@4899
   157
#if defined(SDL_VIDEO_DRIVER_X11)
slouken@1895
   158
        struct
slouken@1895
   159
        {
slouken@4900
   160
            Display *display;           /**< The X11 display */
slouken@4903
   161
            Window window;              /**< The X11 window */
slouken@1895
   162
        } x11;
slouken@4899
   163
#endif
slouken@4899
   164
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@4899
   165
        struct
slouken@4899
   166
        {
slouken@4903
   167
            IDirectFB *dfb;             /**< The directfb main interface */
slouken@4903
   168
            IDirectFBWindow *window;    /**< The directfb window handle */
slouken@4903
   169
            IDirectFBSurface *surface;  /**< The directfb client surface */
slouken@4900
   170
        } dfb;
slouken@4900
   171
#endif
slouken@4900
   172
#if defined(SDL_VIDEO_DRIVER_COCOA)
slouken@4900
   173
        struct
slouken@4900
   174
        {
slouken@4903
   175
            NSWindow *window;           /* The Cocoa window */
slouken@4900
   176
        } cocoa;
slouken@4899
   177
#endif
slouken@4902
   178
    } /*info*/;
slouken@1895
   179
};
slouken@0
   180
slouken@0
   181
#endif /* SDL_PROTOTYPES_ONLY */
slouken@0
   182
slouken@1895
   183
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
slouken@1895
   184
slouken@0
   185
/* Function prototypes */
slouken@1895
   186
/**
slouken@3407
   187
 *  \brief This function allows access to driver-dependent window information.
slouken@3407
   188
 *  
slouken@4530
   189
 *  \param window The window about which information is being requested
slouken@3407
   190
 *  \param info This structure must be initialized with the SDL version, and is 
slouken@3407
   191
 *              then filled in with information about the given window.
slouken@3407
   192
 *  
slouken@3407
   193
 *  \return SDL_TRUE if the function is implemented and the version member of 
slouken@3407
   194
 *          the \c info struct is valid, SDL_FALSE otherwise.
slouken@3407
   195
 *  
slouken@3407
   196
 *  You typically use this function like this:
slouken@3407
   197
 *  \code
slouken@4895
   198
 *  SDL_SysWMinfo info;
slouken@3407
   199
 *  SDL_VERSION(&info.version);
slouken@3407
   200
 *  if ( SDL_GetWindowWMInfo(&info) ) { ... }
slouken@3407
   201
 *  \endcode
slouken@0
   202
 */
slouken@3685
   203
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
slouken@1895
   204
                                                     SDL_SysWMinfo * info);
slouken@0
   205
slouken@0
   206
slouken@0
   207
/* Ends C function definitions when using C++ */
slouken@0
   208
#ifdef __cplusplus
slouken@1895
   209
/* *INDENT-OFF* */
slouken@0
   210
}
slouken@1895
   211
/* *INDENT-ON* */
slouken@0
   212
#endif
slouken@0
   213
#include "close_code.h"
slouken@0
   214
slouken@0
   215
#endif /* _SDL_syswm_h */
slouken@1895
   216
slouken@1895
   217
/* vi: set ts=4 sw=4 expandtab: */