include/SDL_syswm.h
author Brandon Schaefer <brandon.schaefer@canonical.com>
Mon, 21 Apr 2014 12:42:25 -0700
changeset 8731 ede9d13dad21
parent 8603 fef61d2fd948
child 8744 8c0fafc6b438
permissions -rw-r--r--
Revert MIR_CFLAGS to SDL_CFLAGS. Use forward declaration for the real fix. (We shouldn't expose mir headers!)
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__
slouken@4900
    86
#include <Cocoa/Cocoa.h>
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@7191
   101
/**
slouken@4900
   102
 *  These are the various supported windowing subsystems
slouken@3407
   103
 */
slouken@1895
   104
typedef enum
slouken@1895
   105
{
slouken@4900
   106
    SDL_SYSWM_UNKNOWN,
slouken@4900
   107
    SDL_SYSWM_WINDOWS,
slouken@4899
   108
    SDL_SYSWM_X11,
slouken@4899
   109
    SDL_SYSWM_DIRECTFB,
slouken@4900
   110
    SDL_SYSWM_COCOA,
slouken@5056
   111
    SDL_SYSWM_UIKIT,
gabomdq@8134
   112
    SDL_SYSWM_WAYLAND,
icculus@8153
   113
    SDL_SYSWM_MIR,
slouken@8603
   114
    SDL_SYSWM_WINRT,
slouken@0
   115
} SDL_SYSWM_TYPE;
slouken@0
   116
slouken@3407
   117
/**
slouken@4900
   118
 *  The custom event structure.
slouken@3407
   119
 */
slouken@1895
   120
struct SDL_SysWMmsg
slouken@1895
   121
{
slouken@1895
   122
    SDL_version version;
slouken@1895
   123
    SDL_SYSWM_TYPE subsystem;
slouken@1895
   124
    union
slouken@1895
   125
    {
slouken@5062
   126
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
slouken@4900
   127
        struct {
slouken@4900
   128
            HWND hwnd;                  /**< The window for the message */
slouken@4900
   129
            UINT msg;                   /**< The type of message */
slouken@4900
   130
            WPARAM wParam;              /**< WORD message parameter */
slouken@4900
   131
            LPARAM lParam;              /**< LONG message parameter */
slouken@4900
   132
        } win;
slouken@5065
   133
#endif
slouken@5065
   134
#if defined(SDL_VIDEO_DRIVER_X11)
slouken@4900
   135
        struct {
slouken@4900
   136
            XEvent event;
slouken@4900
   137
        } x11;
slouken@5065
   138
#endif
slouken@5065
   139
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@4900
   140
        struct {
slouken@4900
   141
            DFBEvent event;
slouken@4900
   142
        } dfb;
slouken@5065
   143
#endif
slouken@5065
   144
#if defined(SDL_VIDEO_DRIVER_COCOA)
slouken@4900
   145
        struct
slouken@4900
   146
        {
slouken@4900
   147
            /* No Cocoa window events yet */
slouken@4900
   148
        } cocoa;
slouken@5065
   149
#endif
slouken@5065
   150
#if defined(SDL_VIDEO_DRIVER_UIKIT)
slouken@5056
   151
        struct
slouken@5056
   152
        {
slouken@5056
   153
            /* No UIKit window events yet */
slouken@5056
   154
        } uikit;
slouken@5065
   155
#endif
slouken@5063
   156
        /* Can't have an empty union */
slouken@5063
   157
        int dummy;
slouken@5056
   158
    } msg;
slouken@0
   159
};
slouken@0
   160
slouken@3407
   161
/**
slouken@4900
   162
 *  The custom window manager information structure.
slouken@3407
   163
 *
slouken@3407
   164
 *  When this structure is returned, it holds information about which
slouken@3407
   165
 *  low level system it is using, and will be one of SDL_SYSWM_TYPE.
slouken@0
   166
 */
slouken@1895
   167
struct SDL_SysWMinfo
slouken@1895
   168
{
slouken@1895
   169
    SDL_version version;
slouken@1895
   170
    SDL_SYSWM_TYPE subsystem;
slouken@1895
   171
    union
slouken@1895
   172
    {
slouken@5062
   173
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
slouken@4900
   174
        struct
slouken@4900
   175
        {
slouken@4903
   176
            HWND window;                /**< The window handle */
slouken@4900
   177
        } win;
slouken@5065
   178
#endif
dludwig@8411
   179
#if defined(SDL_VIDEO_DRIVER_WINRT)
dludwig@8411
   180
        struct
dludwig@8411
   181
        {
dludwig@8527
   182
            IInspectable * window;      /**< The WinRT CoreWindow */
dludwig@8411
   183
        } winrt;
dludwig@8411
   184
#endif
slouken@5065
   185
#if defined(SDL_VIDEO_DRIVER_X11)
slouken@1895
   186
        struct
slouken@1895
   187
        {
slouken@4900
   188
            Display *display;           /**< The X11 display */
slouken@4903
   189
            Window window;              /**< The X11 window */
slouken@1895
   190
        } x11;
slouken@5065
   191
#endif
slouken@5065
   192
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
slouken@4899
   193
        struct
slouken@4899
   194
        {
slouken@4903
   195
            IDirectFB *dfb;             /**< The directfb main interface */
slouken@4903
   196
            IDirectFBWindow *window;    /**< The directfb window handle */
slouken@4903
   197
            IDirectFBSurface *surface;  /**< The directfb client surface */
slouken@4900
   198
        } dfb;
slouken@5065
   199
#endif
slouken@5065
   200
#if defined(SDL_VIDEO_DRIVER_COCOA)
slouken@4900
   201
        struct
slouken@4900
   202
        {
slouken@4903
   203
            NSWindow *window;           /* The Cocoa window */
slouken@4900
   204
        } cocoa;
slouken@5065
   205
#endif
slouken@5065
   206
#if defined(SDL_VIDEO_DRIVER_UIKIT)
slouken@5056
   207
        struct
slouken@5056
   208
        {
slouken@5056
   209
            UIWindow *window;           /* The UIKit window */
slouken@5056
   210
        } uikit;
slouken@5065
   211
#endif
gabomdq@8134
   212
#if defined(SDL_VIDEO_DRIVER_WAYLAND)
gabomdq@8134
   213
        struct
gabomdq@8134
   214
        {
gabomdq@8134
   215
            struct wl_display *display;            /**< Wayland display */
gabomdq@8134
   216
            struct wl_surface *surface;            /**< Wayland surface */
gabomdq@8134
   217
            struct wl_shell_surface *shell_surface; /**< Wayland shell_surface (window manager handle) */
gabomdq@8134
   218
        } wl;
gabomdq@8134
   219
#endif
icculus@8155
   220
#if defined(SDL_VIDEO_DRIVER_MIR)
icculus@8155
   221
        struct
icculus@8155
   222
        {
brandon@8731
   223
            struct MirConnection *connection;  /**< Mir display server connection */
brandon@8731
   224
            struct MirSurface *surface;  /**< Mir surface */
icculus@8155
   225
        } mir;
icculus@8155
   226
#endif
icculus@8155
   227
slouken@5063
   228
        /* Can't have an empty union */
slouken@5063
   229
        int dummy;
slouken@5056
   230
    } info;
slouken@1895
   231
};
slouken@0
   232
slouken@0
   233
#endif /* SDL_PROTOTYPES_ONLY */
slouken@0
   234
slouken@1895
   235
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
slouken@1895
   236
slouken@0
   237
/* Function prototypes */
slouken@1895
   238
/**
slouken@3407
   239
 *  \brief This function allows access to driver-dependent window information.
slouken@7191
   240
 *
slouken@4530
   241
 *  \param window The window about which information is being requested
slouken@7191
   242
 *  \param info This structure must be initialized with the SDL version, and is
slouken@3407
   243
 *              then filled in with information about the given window.
slouken@7191
   244
 *
slouken@7191
   245
 *  \return SDL_TRUE if the function is implemented and the version member of
slouken@3407
   246
 *          the \c info struct is valid, SDL_FALSE otherwise.
slouken@7191
   247
 *
slouken@3407
   248
 *  You typically use this function like this:
slouken@3407
   249
 *  \code
slouken@4895
   250
 *  SDL_SysWMinfo info;
slouken@3407
   251
 *  SDL_VERSION(&info.version);
slouken@7455
   252
 *  if ( SDL_GetWindowWMInfo(window, &info) ) { ... }
slouken@3407
   253
 *  \endcode
slouken@0
   254
 */
slouken@3685
   255
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
slouken@1895
   256
                                                     SDL_SysWMinfo * info);
slouken@0
   257
slouken@0
   258
slouken@0
   259
/* Ends C function definitions when using C++ */
slouken@0
   260
#ifdef __cplusplus
slouken@0
   261
}
slouken@0
   262
#endif
slouken@0
   263
#include "close_code.h"
slouken@0
   264
slouken@0
   265
#endif /* _SDL_syswm_h */
slouken@1895
   266
slouken@1895
   267
/* vi: set ts=4 sw=4 expandtab: */