include/SDL_syswm.h
author Ryan C. Gordon <icculus@icculus.org>
Thu, 19 Jan 2006 08:43:00 +0000
changeset 1251 86d0d01290ea
parent 1133 609c060fd2a2
child 1312 c9b51268668f
permissions -rw-r--r--
Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode,
updated project files, VS2005 support, VGA mode, more device support, etc,
etc, etc.

Fixes Bugzilla #47 and #28.

--ryan.
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@769
     3
    Copyright (C) 1997-2004 Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@0
     6
    modify it under the terms of the GNU Library General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@0
     8
    version 2 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@0
    13
    Library General Public License for more details.
slouken@0
    14
slouken@0
    15
    You should have received a copy of the GNU Library General Public
slouken@0
    16
    License along with this library; if not, write to the Free
slouken@0
    17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@251
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@0
    22
slouken@0
    23
#ifdef SAVE_RCSID
slouken@0
    24
static char rcsid =
slouken@0
    25
 "@(#) $Id$";
slouken@0
    26
#endif
slouken@0
    27
slouken@0
    28
/* Include file for SDL custom system window manager hooks */
slouken@0
    29
slouken@0
    30
#ifndef _SDL_syswm_h
slouken@0
    31
#define _SDL_syswm_h
slouken@0
    32
slouken@0
    33
#include "SDL_version.h"
slouken@0
    34
slouken@0
    35
#include "begin_code.h"
slouken@0
    36
/* Set up for C function definitions, even when using C++ */
slouken@0
    37
#ifdef __cplusplus
slouken@0
    38
extern "C" {
slouken@0
    39
#endif
slouken@0
    40
slouken@0
    41
/* Your application has access to a special type of event 'SDL_SYSWMEVENT',
slouken@0
    42
   which contains window-manager specific information and arrives whenever
slouken@0
    43
   an unhandled window event occurs.  This event is ignored by default, but
slouken@0
    44
   you can enable it with SDL_EventState()
slouken@0
    45
*/
slouken@0
    46
#ifdef SDL_PROTOTYPES_ONLY
slouken@0
    47
struct SDL_SysWMinfo;
slouken@0
    48
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
slouken@0
    49
#else
slouken@0
    50
icculus@1133
    51
#if defined(__APPLE__) && defined(__MACH__)
icculus@1133
    52
// conflicts with Quickdraw.h
icculus@1133
    53
#define Cursor X11Cursor
icculus@1133
    54
#endif
icculus@1133
    55
slouken@0
    56
/* This is the structure for custom window manager events */
icculus@1133
    57
#if (defined(unix) || defined(__unix__) || defined(_AIX) || \
icculus@1133
    58
         defined(__OpenBSD__) || defined(__NetBSD__) || \
icculus@1133
    59
         (defined(__APPLE__) && defined(__MACH__))) && \
slouken@870
    60
    (!defined(DISABLE_X11) && !defined(__CYGWIN32__) && !defined(ENABLE_NANOX) && \
icculus@1133
    61
         !defined(__QNXNTO__))
slouken@0
    62
 /* AIX is unix, of course, but the native compiler CSet doesn't define unix */
slouken@0
    63
#include <X11/Xlib.h>
slouken@0
    64
#include <X11/Xatom.h>
slouken@0
    65
icculus@1133
    66
#if defined(__APPLE__) && defined(__MACH__)
icculus@1133
    67
// matches the re-define above
icculus@1133
    68
#undef Cursor
icculus@1133
    69
#endif
icculus@1133
    70
slouken@0
    71
/* These are the various supported subsystems under UNIX */
slouken@0
    72
typedef enum {
slouken@0
    73
	SDL_SYSWM_X11
slouken@0
    74
} SDL_SYSWM_TYPE;
slouken@0
    75
slouken@0
    76
/* The UNIX custom event structure */
slouken@0
    77
struct SDL_SysWMmsg {
slouken@0
    78
	SDL_version version;
slouken@0
    79
	SDL_SYSWM_TYPE subsystem;
slouken@0
    80
	union {
slouken@0
    81
	    XEvent xevent;
slouken@0
    82
	} event;
slouken@0
    83
};
slouken@0
    84
slouken@0
    85
/* The UNIX custom window manager information structure.
slouken@0
    86
   When this structure is returned, it holds information about which
slouken@0
    87
   low level system it is using, and will be one of SDL_SYSWM_TYPE.
slouken@0
    88
 */
slouken@911
    89
typedef struct SDL_SysWMinfo {
slouken@0
    90
	SDL_version version;
slouken@0
    91
	SDL_SYSWM_TYPE subsystem;
slouken@0
    92
	union {
slouken@0
    93
	    struct {
slouken@0
    94
	    	Display *display;	/* The X11 display */
slouken@0
    95
	    	Window window;		/* The X11 display window */
slouken@0
    96
		/* These locking functions should be called around
slouken@0
    97
                   any X11 functions using the display variable.
slouken@0
    98
                   They lock the event thread, so should not be
slouken@0
    99
		   called around event functions or from event filters.
slouken@0
   100
		 */
slouken@0
   101
		void (*lock_func)(void);
slouken@0
   102
		void (*unlock_func)(void);
slouken@0
   103
slouken@0
   104
		/* Introduced in SDL 1.0.2 */
slouken@0
   105
	    	Window fswindow;	/* The X11 fullscreen window */
slouken@0
   106
	    	Window wmwindow;	/* The X11 managed input window */
slouken@0
   107
	    } x11;
slouken@0
   108
	} info;
slouken@0
   109
} SDL_SysWMinfo;
slouken@0
   110
slouken@30
   111
#elif defined(ENABLE_NANOX)
slouken@30
   112
#include <microwin/nano-X.h>
slouken@30
   113
slouken@30
   114
/* The generic custom event structure */
slouken@30
   115
struct SDL_SysWMmsg {
slouken@30
   116
	SDL_version version;
slouken@30
   117
	int data;
slouken@30
   118
};
slouken@30
   119
slouken@30
   120
/* The windows custom window manager information structure */
slouken@911
   121
typedef struct SDL_SysWMinfo {
slouken@30
   122
	SDL_version version ;
slouken@30
   123
	GR_WINDOW_ID window ;	/* The display window */
slouken@30
   124
} SDL_SysWMinfo;
slouken@30
   125
slouken@0
   126
#elif defined(WIN32)
slouken@438
   127
#define WIN32_LEAN_AND_MEAN
slouken@0
   128
#include <windows.h>
slouken@0
   129
slouken@0
   130
/* The windows custom event structure */
slouken@0
   131
struct SDL_SysWMmsg {
slouken@0
   132
	SDL_version version;
slouken@0
   133
	HWND hwnd;			/* The window for the message */
slouken@0
   134
	UINT msg;			/* The type of message */
slouken@0
   135
	WPARAM wParam;			/* WORD message parameter */
slouken@0
   136
	LPARAM lParam;			/* LONG message parameter */
slouken@0
   137
};
slouken@0
   138
slouken@0
   139
/* The windows custom window manager information structure */
slouken@911
   140
typedef struct SDL_SysWMinfo {
slouken@0
   141
	SDL_version version;
slouken@0
   142
	HWND window;			/* The Win32 display window */
slouken@438
   143
	HGLRC hglrc;			/* The OpenGL context, if any */
slouken@0
   144
} SDL_SysWMinfo;
slouken@0
   145
slouken@630
   146
#elif defined(__riscos__)
slouken@630
   147
slouken@630
   148
/* RISC OS custom event structure */
slouken@630
   149
struct SDL_SysWMmsg {
slouken@630
   150
	SDL_version version;
slouken@630
   151
	int eventCode;		/* The window for the message */
slouken@630
   152
	int pollBlock[64];
slouken@630
   153
};
slouken@630
   154
slouken@1035
   155
/* The RISC OS custom window manager information structure */
slouken@911
   156
typedef struct SDL_SysWMinfo {
slouken@630
   157
	SDL_version version;
slouken@630
   158
	int wimpVersion;    /* Wimp version running under */
slouken@1035
   159
	int taskHandle;     /* The RISC OS task handle */
slouken@1035
   160
	int window;		/* The RISC OS display window */
slouken@630
   161
} SDL_SysWMinfo;
slouken@630
   162
slouken@870
   163
#elif defined(__QNXNTO__)
slouken@870
   164
#include <sys/neutrino.h>
slouken@870
   165
#include <Ph.h>
slouken@870
   166
slouken@870
   167
/* The QNX custom event structure */
slouken@870
   168
struct SDL_SysWMmsg {
slouken@870
   169
	SDL_version version;
slouken@870
   170
	int data;
slouken@870
   171
};
slouken@870
   172
slouken@870
   173
/* The QNX custom window manager information structure */
slouken@911
   174
typedef struct SDL_SysWMinfo {
slouken@870
   175
	SDL_version version;
slouken@870
   176
	int data;
slouken@870
   177
} SDL_SysWMinfo;
slouken@870
   178
slouken@0
   179
#else
slouken@0
   180
slouken@0
   181
/* The generic custom event structure */
slouken@0
   182
struct SDL_SysWMmsg {
slouken@0
   183
	SDL_version version;
slouken@0
   184
	int data;
slouken@0
   185
};
slouken@0
   186
slouken@0
   187
/* The generic custom window manager information structure */
slouken@911
   188
typedef struct SDL_SysWMinfo {
slouken@0
   189
	SDL_version version;
slouken@0
   190
	int data;
slouken@0
   191
} SDL_SysWMinfo;
slouken@0
   192
slouken@0
   193
#endif /* OS type */
slouken@0
   194
slouken@0
   195
#endif /* SDL_PROTOTYPES_ONLY */
slouken@0
   196
slouken@0
   197
/* Function prototypes */
slouken@0
   198
/*
slouken@0
   199
 * This function gives you custom hooks into the window manager information.
slouken@0
   200
 * It fills the structure pointed to by 'info' with custom information and
slouken@0
   201
 * returns 1 if the function is implemented.  If it's not implemented, or
slouken@0
   202
 * the version member of the 'info' structure is invalid, it returns 0. 
slouken@999
   203
 *
slouken@999
   204
 * You typically use this function like this:
slouken@999
   205
 * SDL_SysWMInfo info;
slouken@999
   206
 * SDL_VERSION(&info.version);
slouken@999
   207
 * if ( SDL_GetWMInfo(&info) ) { ... }
slouken@0
   208
 */
slouken@337
   209
extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
slouken@0
   210
slouken@0
   211
slouken@0
   212
/* Ends C function definitions when using C++ */
slouken@0
   213
#ifdef __cplusplus
slouken@0
   214
}
slouken@0
   215
#endif
slouken@0
   216
#include "close_code.h"
slouken@0
   217
slouken@0
   218
#endif /* _SDL_syswm_h */