include/SDL_syswm.h
author Sam Lantinga <slouken@libsdl.org>
Thu, 04 Mar 2004 05:41:57 +0000
changeset 870 95f22f17e44a
parent 769 b8d311d90021
child 911 04a403e4ccf5
permissions -rw-r--r--
Date: Wed, 3 Mar 2004 12:44:21 +0200
From: "Mike Gorchak"
Subject: Misc fixes again

I've added custom WM info for the QNX (same as generic for now), which allows to compile all applications, which included SDL_syswm.h directly, otherwise DISABLE_X11 appearing to be not defined and X11 info was used instead, which is wrong.
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
slouken@0
    51
/* This is the structure for custom window manager events */
slouken@94
    52
#if (defined(unix) || defined(__unix__) || defined(_AIX) || defined(__OpenBSD__)) && \
slouken@870
    53
    (!defined(DISABLE_X11) && !defined(__CYGWIN32__) && !defined(ENABLE_NANOX) && \
slouken@870
    54
     !defined(__QNXNTO__))
slouken@0
    55
 /* AIX is unix, of course, but the native compiler CSet doesn't define unix */
slouken@0
    56
#include <X11/Xlib.h>
slouken@0
    57
#include <X11/Xatom.h>
slouken@0
    58
slouken@0
    59
/* These are the various supported subsystems under UNIX */
slouken@0
    60
typedef enum {
slouken@0
    61
	SDL_SYSWM_X11
slouken@0
    62
} SDL_SYSWM_TYPE;
slouken@0
    63
slouken@0
    64
/* The UNIX custom event structure */
slouken@0
    65
struct SDL_SysWMmsg {
slouken@0
    66
	SDL_version version;
slouken@0
    67
	SDL_SYSWM_TYPE subsystem;
slouken@0
    68
	union {
slouken@0
    69
	    XEvent xevent;
slouken@0
    70
	} event;
slouken@0
    71
};
slouken@0
    72
slouken@0
    73
/* The UNIX custom window manager information structure.
slouken@0
    74
   When this structure is returned, it holds information about which
slouken@0
    75
   low level system it is using, and will be one of SDL_SYSWM_TYPE.
slouken@0
    76
 */
slouken@0
    77
typedef struct {
slouken@0
    78
	SDL_version version;
slouken@0
    79
	SDL_SYSWM_TYPE subsystem;
slouken@0
    80
	union {
slouken@0
    81
	    struct {
slouken@0
    82
	    	Display *display;	/* The X11 display */
slouken@0
    83
	    	Window window;		/* The X11 display window */
slouken@0
    84
		/* These locking functions should be called around
slouken@0
    85
                   any X11 functions using the display variable.
slouken@0
    86
                   They lock the event thread, so should not be
slouken@0
    87
		   called around event functions or from event filters.
slouken@0
    88
		 */
slouken@0
    89
		void (*lock_func)(void);
slouken@0
    90
		void (*unlock_func)(void);
slouken@0
    91
slouken@0
    92
		/* Introduced in SDL 1.0.2 */
slouken@0
    93
	    	Window fswindow;	/* The X11 fullscreen window */
slouken@0
    94
	    	Window wmwindow;	/* The X11 managed input window */
slouken@0
    95
	    } x11;
slouken@0
    96
	} info;
slouken@0
    97
} SDL_SysWMinfo;
slouken@0
    98
slouken@30
    99
#elif defined(ENABLE_NANOX)
slouken@30
   100
#include <microwin/nano-X.h>
slouken@30
   101
slouken@30
   102
/* The generic custom event structure */
slouken@30
   103
struct SDL_SysWMmsg {
slouken@30
   104
	SDL_version version;
slouken@30
   105
	int data;
slouken@30
   106
};
slouken@30
   107
slouken@30
   108
/* The windows custom window manager information structure */
slouken@30
   109
typedef struct {
slouken@30
   110
	SDL_version version ;
slouken@30
   111
	GR_WINDOW_ID window ;	/* The display window */
slouken@30
   112
} SDL_SysWMinfo;
slouken@30
   113
slouken@0
   114
#elif defined(WIN32)
slouken@438
   115
#define WIN32_LEAN_AND_MEAN
slouken@0
   116
#include <windows.h>
slouken@0
   117
slouken@0
   118
/* The windows custom event structure */
slouken@0
   119
struct SDL_SysWMmsg {
slouken@0
   120
	SDL_version version;
slouken@0
   121
	HWND hwnd;			/* The window for the message */
slouken@0
   122
	UINT msg;			/* The type of message */
slouken@0
   123
	WPARAM wParam;			/* WORD message parameter */
slouken@0
   124
	LPARAM lParam;			/* LONG message parameter */
slouken@0
   125
};
slouken@0
   126
slouken@0
   127
/* The windows custom window manager information structure */
slouken@0
   128
typedef struct {
slouken@0
   129
	SDL_version version;
slouken@0
   130
	HWND window;			/* The Win32 display window */
slouken@438
   131
	HGLRC hglrc;			/* The OpenGL context, if any */
slouken@0
   132
} SDL_SysWMinfo;
slouken@0
   133
slouken@630
   134
#elif defined(__riscos__)
slouken@630
   135
slouken@630
   136
/* RISC OS custom event structure */
slouken@630
   137
struct SDL_SysWMmsg {
slouken@630
   138
	SDL_version version;
slouken@630
   139
	int eventCode;		/* The window for the message */
slouken@630
   140
	int pollBlock[64];
slouken@630
   141
};
slouken@630
   142
slouken@630
   143
/* The RISCOS custom window manager information structure */
slouken@630
   144
typedef struct {
slouken@630
   145
	SDL_version version;
slouken@630
   146
	int wimpVersion;    /* Wimp version running under */
slouken@630
   147
	int taskHandle;     /* The RISCOS task handle */
slouken@630
   148
	int window;			/* The RISCOS display window */
slouken@630
   149
} SDL_SysWMinfo;
slouken@630
   150
slouken@870
   151
#elif defined(__QNXNTO__)
slouken@870
   152
#include <sys/neutrino.h>
slouken@870
   153
#include <Ph.h>
slouken@870
   154
slouken@870
   155
/* The QNX custom event structure */
slouken@870
   156
struct SDL_SysWMmsg {
slouken@870
   157
	SDL_version version;
slouken@870
   158
	int data;
slouken@870
   159
};
slouken@870
   160
slouken@870
   161
/* The QNX custom window manager information structure */
slouken@870
   162
typedef struct {
slouken@870
   163
	SDL_version version;
slouken@870
   164
	int data;
slouken@870
   165
} SDL_SysWMinfo;
slouken@870
   166
slouken@0
   167
#else
slouken@0
   168
slouken@0
   169
/* The generic custom event structure */
slouken@0
   170
struct SDL_SysWMmsg {
slouken@0
   171
	SDL_version version;
slouken@0
   172
	int data;
slouken@0
   173
};
slouken@0
   174
slouken@0
   175
/* The generic custom window manager information structure */
slouken@0
   176
typedef struct {
slouken@0
   177
	SDL_version version;
slouken@0
   178
	int data;
slouken@0
   179
} SDL_SysWMinfo;
slouken@0
   180
slouken@0
   181
#endif /* OS type */
slouken@0
   182
slouken@0
   183
#endif /* SDL_PROTOTYPES_ONLY */
slouken@0
   184
slouken@0
   185
/* Function prototypes */
slouken@0
   186
/*
slouken@0
   187
 * This function gives you custom hooks into the window manager information.
slouken@0
   188
 * It fills the structure pointed to by 'info' with custom information and
slouken@0
   189
 * returns 1 if the function is implemented.  If it's not implemented, or
slouken@0
   190
 * the version member of the 'info' structure is invalid, it returns 0. 
slouken@0
   191
 */
slouken@337
   192
extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
slouken@0
   193
slouken@0
   194
slouken@0
   195
/* Ends C function definitions when using C++ */
slouken@0
   196
#ifdef __cplusplus
slouken@0
   197
}
slouken@0
   198
#endif
slouken@0
   199
#include "close_code.h"
slouken@0
   200
slouken@0
   201
#endif /* _SDL_syswm_h */