include/SDL_syswm.h
author Jørgen P. Tjernø <jorgen@uberent.com>
Wed, 04 Jun 2014 10:33:23 -0700
changeset 8812 b0f96c169c97
parent 8799 e2fd743d84ea
child 8968 47decd0106f8
permissions -rw-r--r--
SDL_opengl: Fix Mac build for SDK 10.9 too.
slouken@0
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@8149
     3
  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
slouken@0
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@0
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@0
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@0
    20
*/
slouken@0
    21
slouken@1895
    22
/**
slouken@3407
    23
 *  \file SDL_syswm.h
slouken@7191
    24
 *
slouken@3407
    25
 *  Include file for SDL custom system window manager hooks.
slouken@1895
    26
 */
slouken@0
    27
slouken@0
    28
#ifndef _SDL_syswm_h
slouken@0
    29
#define _SDL_syswm_h
slouken@0
    30
slouken@1356
    31
#include "SDL_stdinc.h"
slouken@1358
    32
#include "SDL_error.h"
slouken@1895
    33
#include "SDL_video.h"
slouken@0
    34
#include "SDL_version.h"
slouken@0
    35
slouken@0
    36
#include "begin_code.h"
slouken@0
    37
/* Set up for C function definitions, even when using C++ */
slouken@0
    38
#ifdef __cplusplus
slouken@0
    39
extern "C" {
slouken@0
    40
#endif
slouken@0
    41
slouken@3407
    42
/**
slouken@3407
    43
 *  \file SDL_syswm.h
slouken@7191
    44
 *
slouken@3407
    45
 *  Your application has access to a special type of event ::SDL_SYSWMEVENT,
slouken@3407
    46
 *  which contains window-manager specific information and arrives whenever
slouken@3407
    47
 *  an unhandled window event occurs.  This event is ignored by default, but
slouken@3407
    48
 *  you can enable it with SDL_EventState().
slouken@3407
    49
 */
slouken@0
    50
#ifdef SDL_PROTOTYPES_ONLY
slouken@0
    51
struct SDL_SysWMinfo;
slouken@0
    52
#else
slouken@0
    53
slouken@5062
    54
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
slouken@4900
    55
#define WIN32_LEAN_AND_MEAN
slouken@4900
    56
#include <windows.h>
slouken@4900
    57
#endif
slouken@4900
    58
dludwig@8463
    59
#if defined(SDL_VIDEO_DRIVER_WINRT)
dludwig@8527
    60
#include <Inspectable.h>
dludwig@8463
    61
#endif
dludwig@8463
    62
slouken@1361
    63
/* This is the structure for custom window manager events */
slouken@1626
    64
#if defined(SDL_VIDEO_DRIVER_X11)
icculus@1133
    65
#if defined(__APPLE__) && defined(__MACH__)
slouken@1487
    66
/* conflicts with Quickdraw.h */
icculus@1133
    67
#define Cursor X11Cursor
icculus@1133
    68
#endif
icculus@1133
    69
slouken@0
    70
#include <X11/Xlib.h>
slouken@0
    71
#include <X11/Xatom.h>
slouken@0
    72
icculus@1133
    73
#if defined(__APPLE__) && defined(__MACH__)
slouken@1487
    74
/* matches the re-define above */
icculus@1133
    75
#undef Cursor
icculus@1133
    76
#endif
icculus@1133
    77
slouken@4899
    78
#endif /* defined(SDL_VIDEO_DRIVER_X11) */
slouken@4899
    79
slouken@4899
    80
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@5199
    81
#include <directfb.h>
slouken@4899
    82
#endif
slouken@4900
    83
slouken@4900
    84
#if defined(SDL_VIDEO_DRIVER_COCOA)
slouken@4900
    85
#ifdef __OBJC__
jorgen@8812
    86
@class NSWindow;
slouken@4900
    87
#else
slouken@4900
    88
typedef struct _NSWindow NSWindow;
slouken@4900
    89
#endif
slouken@4900
    90
#endif
slouken@4900
    91
slouken@5056
    92
#if defined(SDL_VIDEO_DRIVER_UIKIT)
slouken@5056
    93
#ifdef __OBJC__
slouken@5056
    94
#include <UIKit/UIKit.h>
slouken@5056
    95
#else
slouken@5056
    96
typedef struct _UIWindow UIWindow;
dludwig@8305
    97
typedef struct _UIViewController UIViewController;
slouken@5056
    98
#endif
slouken@5056
    99
#endif
slouken@5056
   100
slouken@8799
   101
#if defined(SDL_VIDEO_DRIVER_ANDROID)
slouken@8799
   102
typedef struct ANativeWindow ANativeWindow;
slouken@8799
   103
typedef void *EGLSurface;
slouken@8799
   104
#endif
slouken@8799
   105
slouken@7191
   106
/**
slouken@4900
   107
 *  These are the various supported windowing subsystems
slouken@3407
   108
 */
slouken@1895
   109
typedef enum
slouken@1895
   110
{
slouken@4900
   111
    SDL_SYSWM_UNKNOWN,
slouken@4900
   112
    SDL_SYSWM_WINDOWS,
slouken@4899
   113
    SDL_SYSWM_X11,
slouken@4899
   114
    SDL_SYSWM_DIRECTFB,
slouken@4900
   115
    SDL_SYSWM_COCOA,
slouken@5056
   116
    SDL_SYSWM_UIKIT,
gabomdq@8134
   117
    SDL_SYSWM_WAYLAND,
icculus@8153
   118
    SDL_SYSWM_MIR,
slouken@8799
   119
    SDL_SYSWM_WINRT,
slouken@8799
   120
    SDL_SYSWM_ANDROID
slouken@0
   121
} SDL_SYSWM_TYPE;
slouken@0
   122
slouken@3407
   123
/**
slouken@4900
   124
 *  The custom event structure.
slouken@3407
   125
 */
slouken@1895
   126
struct SDL_SysWMmsg
slouken@1895
   127
{
slouken@1895
   128
    SDL_version version;
slouken@1895
   129
    SDL_SYSWM_TYPE subsystem;
slouken@1895
   130
    union
slouken@1895
   131
    {
slouken@5062
   132
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
slouken@4900
   133
        struct {
slouken@4900
   134
            HWND hwnd;                  /**< The window for the message */
slouken@4900
   135
            UINT msg;                   /**< The type of message */
slouken@4900
   136
            WPARAM wParam;              /**< WORD message parameter */
slouken@4900
   137
            LPARAM lParam;              /**< LONG message parameter */
slouken@4900
   138
        } win;
slouken@5065
   139
#endif
slouken@5065
   140
#if defined(SDL_VIDEO_DRIVER_X11)
slouken@4900
   141
        struct {
slouken@4900
   142
            XEvent event;
slouken@4900
   143
        } x11;
slouken@5065
   144
#endif
slouken@5065
   145
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@4900
   146
        struct {
slouken@4900
   147
            DFBEvent event;
slouken@4900
   148
        } dfb;
slouken@5065
   149
#endif
slouken@5065
   150
#if defined(SDL_VIDEO_DRIVER_COCOA)
slouken@4900
   151
        struct
slouken@4900
   152
        {
slouken@4900
   153
            /* No Cocoa window events yet */
slouken@4900
   154
        } cocoa;
slouken@5065
   155
#endif
slouken@5065
   156
#if defined(SDL_VIDEO_DRIVER_UIKIT)
slouken@5056
   157
        struct
slouken@5056
   158
        {
slouken@5056
   159
            /* No UIKit window events yet */
slouken@5056
   160
        } uikit;
slouken@5065
   161
#endif
slouken@5063
   162
        /* Can't have an empty union */
slouken@5063
   163
        int dummy;
slouken@5056
   164
    } msg;
slouken@0
   165
};
slouken@0
   166
slouken@3407
   167
/**
slouken@4900
   168
 *  The custom window manager information structure.
slouken@3407
   169
 *
slouken@3407
   170
 *  When this structure is returned, it holds information about which
slouken@3407
   171
 *  low level system it is using, and will be one of SDL_SYSWM_TYPE.
slouken@0
   172
 */
slouken@1895
   173
struct SDL_SysWMinfo
slouken@1895
   174
{
slouken@1895
   175
    SDL_version version;
slouken@1895
   176
    SDL_SYSWM_TYPE subsystem;
slouken@1895
   177
    union
slouken@1895
   178
    {
slouken@5062
   179
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
slouken@4900
   180
        struct
slouken@4900
   181
        {
slouken@4903
   182
            HWND window;                /**< The window handle */
slouken@4900
   183
        } win;
slouken@5065
   184
#endif
dludwig@8411
   185
#if defined(SDL_VIDEO_DRIVER_WINRT)
dludwig@8411
   186
        struct
dludwig@8411
   187
        {
dludwig@8527
   188
            IInspectable * window;      /**< The WinRT CoreWindow */
dludwig@8411
   189
        } winrt;
dludwig@8411
   190
#endif
slouken@5065
   191
#if defined(SDL_VIDEO_DRIVER_X11)
slouken@1895
   192
        struct
slouken@1895
   193
        {
slouken@4900
   194
            Display *display;           /**< The X11 display */
slouken@4903
   195
            Window window;              /**< The X11 window */
slouken@1895
   196
        } x11;
slouken@5065
   197
#endif
slouken@5065
   198
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@4899
   199
        struct
slouken@4899
   200
        {
slouken@4903
   201
            IDirectFB *dfb;             /**< The directfb main interface */
slouken@4903
   202
            IDirectFBWindow *window;    /**< The directfb window handle */
slouken@4903
   203
            IDirectFBSurface *surface;  /**< The directfb client surface */
slouken@4900
   204
        } dfb;
slouken@5065
   205
#endif
slouken@5065
   206
#if defined(SDL_VIDEO_DRIVER_COCOA)
slouken@4900
   207
        struct
slouken@4900
   208
        {
slouken@4903
   209
            NSWindow *window;           /* The Cocoa window */
slouken@4900
   210
        } cocoa;
slouken@5065
   211
#endif
slouken@5065
   212
#if defined(SDL_VIDEO_DRIVER_UIKIT)
slouken@5056
   213
        struct
slouken@5056
   214
        {
slouken@5056
   215
            UIWindow *window;           /* The UIKit window */
slouken@5056
   216
        } uikit;
slouken@5065
   217
#endif
gabomdq@8134
   218
#if defined(SDL_VIDEO_DRIVER_WAYLAND)
gabomdq@8134
   219
        struct
gabomdq@8134
   220
        {
gabomdq@8134
   221
            struct wl_display *display;            /**< Wayland display */
gabomdq@8134
   222
            struct wl_surface *surface;            /**< Wayland surface */
gabomdq@8134
   223
            struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
gabomdq@8134
   224
        } wl;
gabomdq@8134
   225
#endif
icculus@8155
   226
#if defined(SDL_VIDEO_DRIVER_MIR)
icculus@8155
   227
        struct
icculus@8155
   228
        {
brandon@8731
   229
            struct MirConnection *connection;  /**< Mir display server connection */
brandon@8731
   230
            struct MirSurface *surface;  /**< Mir surface */
icculus@8155
   231
        } mir;
icculus@8155
   232
#endif
icculus@8155
   233
slouken@8799
   234
#if defined(SDL_VIDEO_DRIVER_ANDROID)
slouken@8799
   235
        struct
slouken@8799
   236
        {
slouken@8799
   237
            ANativeWindow *window;
slouken@8799
   238
            EGLSurface surface;
slouken@8799
   239
        } android;
slouken@8799
   240
#endif
slouken@8799
   241
slouken@5063
   242
        /* Can't have an empty union */
slouken@5063
   243
        int dummy;
slouken@5056
   244
    } info;
slouken@1895
   245
};
slouken@0
   246
slouken@0
   247
#endif /* SDL_PROTOTYPES_ONLY */
slouken@0
   248
slouken@1895
   249
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
slouken@1895
   250
slouken@0
   251
/* Function prototypes */
slouken@1895
   252
/**
slouken@3407
   253
 *  \brief This function allows access to driver-dependent window information.
slouken@7191
   254
 *
slouken@4530
   255
 *  \param window The window about which information is being requested
slouken@7191
   256
 *  \param info This structure must be initialized with the SDL version, and is
slouken@3407
   257
 *              then filled in with information about the given window.
slouken@7191
   258
 *
slouken@7191
   259
 *  \return SDL_TRUE if the function is implemented and the version member of
slouken@3407
   260
 *          the \c info struct is valid, SDL_FALSE otherwise.
slouken@7191
   261
 *
slouken@3407
   262
 *  You typically use this function like this:
slouken@3407
   263
 *  \code
slouken@4895
   264
 *  SDL_SysWMinfo info;
slouken@3407
   265
 *  SDL_VERSION(&info.version);
slouken@7455
   266
 *  if ( SDL_GetWindowWMInfo(window, &info) ) { ... }
slouken@3407
   267
 *  \endcode
slouken@0
   268
 */
slouken@3685
   269
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
slouken@1895
   270
                                                     SDL_SysWMinfo * info);
slouken@0
   271
slouken@0
   272
slouken@0
   273
/* Ends C function definitions when using C++ */
slouken@0
   274
#ifdef __cplusplus
slouken@0
   275
}
slouken@0
   276
#endif
slouken@0
   277
#include "close_code.h"
slouken@0
   278
slouken@0
   279
#endif /* _SDL_syswm_h */
slouken@1895
   280
slouken@1895
   281
/* vi: set ts=4 sw=4 expandtab: */