include/SDL_syswm.h
changeset 0 74212992fb08
child 30 57bf11a5efd7
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/include/SDL_syswm.h	Thu Apr 26 16:45:43 2001 +0000
     1.3 @@ -0,0 +1,150 @@
     1.4 +/*
     1.5 +    SDL - Simple DirectMedia Layer
     1.6 +    Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
     1.7 +
     1.8 +    This library is free software; you can redistribute it and/or
     1.9 +    modify it under the terms of the GNU Library General Public
    1.10 +    License as published by the Free Software Foundation; either
    1.11 +    version 2 of the License, or (at your option) any later version.
    1.12 +
    1.13 +    This library is distributed in the hope that it will be useful,
    1.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.16 +    Library General Public License for more details.
    1.17 +
    1.18 +    You should have received a copy of the GNU Library General Public
    1.19 +    License along with this library; if not, write to the Free
    1.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.21 +
    1.22 +    Sam Lantinga
    1.23 +    slouken@devolution.com
    1.24 +*/
    1.25 +
    1.26 +#ifdef SAVE_RCSID
    1.27 +static char rcsid =
    1.28 + "@(#) $Id$";
    1.29 +#endif
    1.30 +
    1.31 +/* Include file for SDL custom system window manager hooks */
    1.32 +
    1.33 +#ifndef _SDL_syswm_h
    1.34 +#define _SDL_syswm_h
    1.35 +
    1.36 +#include "SDL_version.h"
    1.37 +
    1.38 +#include "begin_code.h"
    1.39 +/* Set up for C function definitions, even when using C++ */
    1.40 +#ifdef __cplusplus
    1.41 +extern "C" {
    1.42 +#endif
    1.43 +
    1.44 +/* Your application has access to a special type of event 'SDL_SYSWMEVENT',
    1.45 +   which contains window-manager specific information and arrives whenever
    1.46 +   an unhandled window event occurs.  This event is ignored by default, but
    1.47 +   you can enable it with SDL_EventState()
    1.48 +*/
    1.49 +#ifdef SDL_PROTOTYPES_ONLY
    1.50 +struct SDL_SysWMinfo;
    1.51 +typedef struct SDL_SysWMinfo SDL_SysWMinfo;
    1.52 +#else
    1.53 +
    1.54 +/* This is the structure for custom window manager events */
    1.55 +#if (defined(unix) || defined(__unix__) || defined(_AIX)) && \
    1.56 +    (!defined(DISABLE_X11) && !defined(__CYGWIN32__))
    1.57 + /* AIX is unix, of course, but the native compiler CSet doesn't define unix */
    1.58 +#include <X11/Xlib.h>
    1.59 +#include <X11/Xatom.h>
    1.60 +
    1.61 +/* These are the various supported subsystems under UNIX */
    1.62 +typedef enum {
    1.63 +	SDL_SYSWM_X11
    1.64 +} SDL_SYSWM_TYPE;
    1.65 +
    1.66 +/* The UNIX custom event structure */
    1.67 +struct SDL_SysWMmsg {
    1.68 +	SDL_version version;
    1.69 +	SDL_SYSWM_TYPE subsystem;
    1.70 +	union {
    1.71 +	    XEvent xevent;
    1.72 +	} event;
    1.73 +};
    1.74 +
    1.75 +/* The UNIX custom window manager information structure.
    1.76 +   When this structure is returned, it holds information about which
    1.77 +   low level system it is using, and will be one of SDL_SYSWM_TYPE.
    1.78 + */
    1.79 +typedef struct {
    1.80 +	SDL_version version;
    1.81 +	SDL_SYSWM_TYPE subsystem;
    1.82 +	union {
    1.83 +	    struct {
    1.84 +	    	Display *display;	/* The X11 display */
    1.85 +	    	Window window;		/* The X11 display window */
    1.86 +		/* These locking functions should be called around
    1.87 +                   any X11 functions using the display variable.
    1.88 +                   They lock the event thread, so should not be
    1.89 +		   called around event functions or from event filters.
    1.90 +		 */
    1.91 +		void (*lock_func)(void);
    1.92 +		void (*unlock_func)(void);
    1.93 +
    1.94 +		/* Introduced in SDL 1.0.2 */
    1.95 +	    	Window fswindow;	/* The X11 fullscreen window */
    1.96 +	    	Window wmwindow;	/* The X11 managed input window */
    1.97 +	    } x11;
    1.98 +	} info;
    1.99 +} SDL_SysWMinfo;
   1.100 +
   1.101 +#elif defined(WIN32)
   1.102 +#include <windows.h>
   1.103 +
   1.104 +/* The windows custom event structure */
   1.105 +struct SDL_SysWMmsg {
   1.106 +	SDL_version version;
   1.107 +	HWND hwnd;			/* The window for the message */
   1.108 +	UINT msg;			/* The type of message */
   1.109 +	WPARAM wParam;			/* WORD message parameter */
   1.110 +	LPARAM lParam;			/* LONG message parameter */
   1.111 +};
   1.112 +
   1.113 +/* The windows custom window manager information structure */
   1.114 +typedef struct {
   1.115 +	SDL_version version;
   1.116 +	HWND window;			/* The Win32 display window */
   1.117 +} SDL_SysWMinfo;
   1.118 +
   1.119 +#else
   1.120 +
   1.121 +/* The generic custom event structure */
   1.122 +struct SDL_SysWMmsg {
   1.123 +	SDL_version version;
   1.124 +	int data;
   1.125 +};
   1.126 +
   1.127 +/* The generic custom window manager information structure */
   1.128 +typedef struct {
   1.129 +	SDL_version version;
   1.130 +	int data;
   1.131 +} SDL_SysWMinfo;
   1.132 +
   1.133 +#endif /* OS type */
   1.134 +
   1.135 +#endif /* SDL_PROTOTYPES_ONLY */
   1.136 +
   1.137 +/* Function prototypes */
   1.138 +/*
   1.139 + * This function gives you custom hooks into the window manager information.
   1.140 + * It fills the structure pointed to by 'info' with custom information and
   1.141 + * returns 1 if the function is implemented.  If it's not implemented, or
   1.142 + * the version member of the 'info' structure is invalid, it returns 0. 
   1.143 + */
   1.144 +extern DECLSPEC int SDL_GetWMInfo(SDL_SysWMinfo *info);
   1.145 +
   1.146 +
   1.147 +/* Ends C function definitions when using C++ */
   1.148 +#ifdef __cplusplus
   1.149 +}
   1.150 +#endif
   1.151 +#include "close_code.h"
   1.152 +
   1.153 +#endif /* _SDL_syswm_h */