- /*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
- */
- module sdl.c.sdl_syswm;
-
- /* Include file for SDL custom system window manager hooks */
-
- public
- {
- import sdl.c.sdl_stdinc;
- import sdl.c.sdl_error;
- import sdl.c.sdl_version;
- }
-
- extern(C):
-
- /* Your application has access to a special type of event 'SDL_SYSWMEVENT',
- which contains window-manager specific information and arrives whenever
- an unhandled window event occurs. This event is ignored by default, but
- you can enable it with SDL_EventState()
- */
-
- version (Windows)
- {
- public import std.c.windows.windows;
-
- /* The windows custom event structure */
- struct SDL_SysWMmsg {
- SDL_version _version;
- HWND hwnd; /* The window for the message */
- UINT msg; /* The type of message */
- WPARAM wParam; /* WORD message parameter */
- LPARAM lParam; /* LONG message parameter */
- }
-
- /* The windows custom window manager information structure */
- struct SDL_SysWMinfo {
- SDL_version _version;
- HWND window; /* The Win32 display window */
- HGLRC hglrc; /* The OpenGL context, if any */
- }
-
- }
- else version(Linux)
- {
-
- /* These are the various supported subsystems under UNIX */
- enum SDL_SYSWM_TYPE {
- SDL_SYSWM_X11
- }
-
- /* The UNIX custom event structure */
- struct SDL_SysWMmsg {
- SDL_version _version;
- SDL_SYSWM_TYPE subsystem;
- union Event {
- XEvent xevent;
- }
- Event event;
- };
-
- /* The UNIX custom window manager information structure.
- When this structure is returned, it holds information about which
- low level system it is using, and will be one of SDL_SYSWM_TYPE.
- */
- struct SDL_SysWMinfo {
- SDL_version _version;
- SDL_SYSWM_TYPE subsystem;
- union Info {
- struct X11 {
- Display *display; /* The X11 display */
- Window window; /* The X11 display window */
- /* These locking functions should be called around
- any X11 functions using the display variable,
- but not the gfxdisplay variable.
- They lock the event thread, so should not be
- called around event functions or from event filters.
- */
- void function(void) lock_func;
- void function(void) unlock_func;
-
- /* Introduced in SDL 1.0.2 */
- Window fswindow; /* The X11 fullscreen window */
- Window wmwindow; /* The X11 managed input window */
-
- /* Introduced in SDL 1.2.12 */
- Display *gfxdisplay; /* The X11 display to which rendering is done */
- }
- X11 x11;
- }
- Info info;
- }
- }
- else
- {
- /* The generic custom event structure */
- struct SDL_SysWMmsg {
- SDL_version _version;
- int data;
- }
-
- /* The generic custom window manager information structure */
- struct SDL_SysWMinfo {
- SDL_version _version;
- int data;
- }
- }
-
-
- /* Function prototypes */
- /*
- * This function gives you custom hooks into the window manager information.
- * It fills the structure pointed to by 'info' with custom information and
- * returns 1 if the function is implemented. If it's not implemented, or
- * the version member of the 'info' structure is invalid, it returns 0.
- *
- * You typically use this function like this:
- * SDL_SysWMInfo info;
- * SDL_VERSION(&info.version);
- * if ( SDL_GetWMInfo(&info) ) { ... }
- */
- int SDL_GetWMInfo(SDL_SysWMinfo *info);
-