SDL 1.3 is now under the zlib license.
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
21 #include "SDL_config.h"
23 #ifndef _SDL_sysvideo_h
24 #define _SDL_sysvideo_h
26 #include "SDL_shape.h"
28 /* The SDL video driver */
30 typedef struct SDL_WindowShaper SDL_WindowShaper;
31 typedef struct SDL_ShapeDriver SDL_ShapeDriver;
32 typedef struct SDL_VideoDisplay SDL_VideoDisplay;
33 typedef struct SDL_VideoDevice SDL_VideoDevice;
35 /* Define the SDL window-shaper structure */
36 struct SDL_WindowShaper
38 /* The window associated with the shaper */
41 /* The user's specified coordinates for the window, for once we give it a shape. */
44 /* The parameters for shape calculation. */
45 SDL_WindowShapeMode mode;
47 /* Has this window been assigned a shape? */
53 /* Define the SDL shape driver structure */
54 struct SDL_ShapeDriver
56 SDL_WindowShaper *(*CreateShaper)(SDL_Window * window);
57 int (*SetWindowShape)(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode);
58 int (*ResizeWindowShape)(SDL_Window *window);
61 typedef struct SDL_WindowUserData
65 struct SDL_WindowUserData *next;
68 /* Define the SDL window structure, corresponding to toplevel windows */
78 /* Stored position and size for windowed mode */
81 SDL_DisplayMode fullscreen_mode;
85 Uint16 *saved_gamma; /* (just offset into gamma) */
88 SDL_bool surface_valid;
90 SDL_WindowShaper *shaper;
92 SDL_WindowUserData *data;
99 #define FULLSCREEN_VISIBLE(W) \
100 (((W)->flags & SDL_WINDOW_FULLSCREEN) && \
101 ((W)->flags & SDL_WINDOW_SHOWN) && \
102 !((W)->flags & SDL_WINDOW_MINIMIZED))
105 * Define the SDL display structure This corresponds to physical monitors
106 * attached to the system.
108 struct SDL_VideoDisplay
110 int max_display_modes;
111 int num_display_modes;
112 SDL_DisplayMode *display_modes;
113 SDL_DisplayMode desktop_mode;
114 SDL_DisplayMode current_mode;
116 SDL_Window *fullscreen_window;
118 SDL_VideoDevice *device;
123 /* Forward declaration */
124 struct SDL_SysWMinfo;
126 /* Define the SDL video driver structure */
127 #define _THIS SDL_VideoDevice *_this
129 struct SDL_VideoDevice
132 /* The name of this video driver */
136 /* Initialization/Query functions */
139 * Initialize the native video subsystem, filling in the list of
140 * displays for this driver, returning 0 or -1 if there's an error.
142 int (*VideoInit) (_THIS);
145 * Reverse the effects VideoInit() -- called if VideoInit() fails or
146 * if the application is shutting down the video subsystem.
148 void (*VideoQuit) (_THIS);
156 * Get the bounds of a display
158 int (*GetDisplayBounds) (_THIS, SDL_VideoDisplay * display, SDL_Rect * rect);
161 * Get a list of the available display modes for a display.
163 void (*GetDisplayModes) (_THIS, SDL_VideoDisplay * display);
166 * Setting the display mode is independent of creating windows, so
167 * when the display mode is changed, all existing windows should have
168 * their data updated accordingly, including the display surfaces
169 * associated with them.
171 int (*SetDisplayMode) (_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
177 int (*CreateWindow) (_THIS, SDL_Window * window);
178 int (*CreateWindowFrom) (_THIS, SDL_Window * window, const void *data);
179 void (*SetWindowTitle) (_THIS, SDL_Window * window);
180 void (*SetWindowIcon) (_THIS, SDL_Window * window, SDL_Surface * icon);
181 void (*SetWindowPosition) (_THIS, SDL_Window * window);
182 void (*SetWindowSize) (_THIS, SDL_Window * window);
183 void (*ShowWindow) (_THIS, SDL_Window * window);
184 void (*HideWindow) (_THIS, SDL_Window * window);
185 void (*RaiseWindow) (_THIS, SDL_Window * window);
186 void (*MaximizeWindow) (_THIS, SDL_Window * window);
187 void (*MinimizeWindow) (_THIS, SDL_Window * window);
188 void (*RestoreWindow) (_THIS, SDL_Window * window);
189 void (*SetWindowFullscreen) (_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
190 int (*SetWindowGammaRamp) (_THIS, SDL_Window * window, const Uint16 * ramp);
191 int (*GetWindowGammaRamp) (_THIS, SDL_Window * window, Uint16 * ramp);
192 void (*SetWindowGrab) (_THIS, SDL_Window * window);
193 void (*DestroyWindow) (_THIS, SDL_Window * window);
194 int (*CreateWindowFramebuffer) (_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch);
195 int (*UpdateWindowFramebuffer) (_THIS, SDL_Window * window, SDL_Rect * rects, int numrects);
196 void (*DestroyWindowFramebuffer) (_THIS, SDL_Window * window);
200 * Shaped-window functions
202 SDL_ShapeDriver shape_driver;
204 /* Get some platform dependent window information */
205 SDL_bool(*GetWindowWMInfo) (_THIS, SDL_Window * window,
206 struct SDL_SysWMinfo * info);
212 int (*GL_LoadLibrary) (_THIS, const char *path);
213 void *(*GL_GetProcAddress) (_THIS, const char *proc);
214 void (*GL_UnloadLibrary) (_THIS);
215 SDL_GLContext(*GL_CreateContext) (_THIS, SDL_Window * window);
216 int (*GL_MakeCurrent) (_THIS, SDL_Window * window, SDL_GLContext context);
217 int (*GL_SetSwapInterval) (_THIS, int interval);
218 int (*GL_GetSwapInterval) (_THIS);
219 void (*GL_SwapWindow) (_THIS, SDL_Window * window);
220 void (*GL_DeleteContext) (_THIS, SDL_GLContext context);
224 * Event manager functions
226 void (*PumpEvents) (_THIS);
228 /* Suspend the screensaver */
229 void (*SuspendScreenSaver) (_THIS);
232 void (*StartTextInput) (_THIS);
233 void (*StopTextInput) (_THIS);
234 void (*SetTextInputRect) (_THIS, SDL_Rect *rect);
237 int (*SetClipboardText) (_THIS, const char *text);
238 char * (*GetClipboardText) (_THIS);
239 SDL_bool (*HasClipboardText) (_THIS);
242 /* Data common to all drivers */
243 SDL_bool suspend_screensaver;
245 SDL_VideoDisplay *displays;
248 Uint32 next_object_id;
249 char * clipboard_text;
252 /* Data used by the GL drivers */
264 int accum_green_size;
266 int accum_alpha_size;
268 int multisamplebuffers;
269 int multisamplesamples;
273 int retained_backing;
275 char driver_path[256];
280 /* Data private to this driver */
282 struct SDL_GLDriverData *gl_data;
284 #if SDL_VIDEO_DRIVER_PANDORA
285 struct SDL_PrivateGLESData *gles_data;
289 /* The function used to dispose of this structure */
290 void (*free) (_THIS);
293 typedef struct VideoBootStrap
297 int (*available) (void);
298 SDL_VideoDevice *(*create) (int devindex);
301 #if SDL_VIDEO_DRIVER_COCOA
302 extern VideoBootStrap COCOA_bootstrap;
304 #if SDL_VIDEO_DRIVER_X11
305 extern VideoBootStrap X11_bootstrap;
307 #if SDL_VIDEO_DRIVER_DIRECTFB
308 extern VideoBootStrap DirectFB_bootstrap;
310 #if SDL_VIDEO_DRIVER_WINDOWS
311 extern VideoBootStrap WINDOWS_bootstrap;
313 #if SDL_VIDEO_DRIVER_BWINDOW
314 extern VideoBootStrap BWINDOW_bootstrap;
316 #if SDL_VIDEO_DRIVER_PANDORA
317 extern VideoBootStrap PND_bootstrap;
319 #if SDL_VIDEO_DRIVER_NDS
320 extern VideoBootStrap NDS_bootstrap;
322 #if SDL_VIDEO_DRIVER_UIKIT
323 extern VideoBootStrap UIKIT_bootstrap;
325 #if SDL_VIDEO_DRIVER_ANDROID
326 extern VideoBootStrap Android_bootstrap;
328 #if SDL_VIDEO_DRIVER_DUMMY
329 extern VideoBootStrap DUMMY_bootstrap;
332 extern SDL_VideoDevice *SDL_GetVideoDevice(void);
333 extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
334 extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display);
335 extern SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode * mode);
336 extern SDL_VideoDisplay *SDL_GetDisplayForWindow(SDL_Window *window);
338 extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
340 extern void SDL_OnWindowShown(SDL_Window * window);
341 extern void SDL_OnWindowHidden(SDL_Window * window);
342 extern void SDL_OnWindowResized(SDL_Window * window);
343 extern void SDL_OnWindowMinimized(SDL_Window * window);
344 extern void SDL_OnWindowRestored(SDL_Window * window);
345 extern void SDL_OnWindowFocusGained(SDL_Window * window);
346 extern void SDL_OnWindowFocusLost(SDL_Window * window);
347 extern SDL_Window * SDL_GetFocusWindow(void);
349 #endif /* _SDL_sysvideo_h */
351 /* vi: set ts=4 sw=4 expandtab: */