Nobody is currently maintaining the QNX code, so removing it for now.
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2010 Sam Lantinga
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "SDL_config.h"
24 #ifndef _SDL_sysvideo_h
25 #define _SDL_sysvideo_h
27 #include "SDL_events.h"
28 #include "SDL_mouse.h"
29 #include "SDL_keysym.h"
30 #include "SDL_render.h"
31 #include "SDL_shape.h"
33 /* The SDL video driver */
35 typedef struct SDL_RenderDriver SDL_RenderDriver;
36 typedef struct SDL_WindowShaper SDL_WindowShaper;
37 typedef struct SDL_ShapeDriver SDL_ShapeDriver;
38 typedef struct SDL_VideoDisplay SDL_VideoDisplay;
39 typedef struct SDL_VideoDevice SDL_VideoDevice;
41 /* Define the SDL texture structure */
45 Uint32 format; /**< The pixel format of the texture */
46 int access; /**< SDL_TextureAccess */
47 int w; /**< The width of the texture */
48 int h; /**< The height of the texture */
49 int modMode; /**< The texture modulation mode */
50 SDL_BlendMode blendMode; /**< The texture blend mode */
51 Uint8 r, g, b, a; /**< Texture modulation values */
53 SDL_Renderer *renderer;
55 void *driverdata; /**< Driver specific texture representation */
61 /* Define the SDL renderer structure */
66 void (*WindowEvent) (SDL_Renderer * renderer, const SDL_WindowEvent *event);
67 int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
68 int (*QueryTexturePixels) (SDL_Renderer * renderer, SDL_Texture * texture,
69 void **pixels, int *pitch);
70 int (*SetTextureColorMod) (SDL_Renderer * renderer,
71 SDL_Texture * texture);
72 int (*SetTextureAlphaMod) (SDL_Renderer * renderer,
73 SDL_Texture * texture);
74 int (*SetTextureBlendMode) (SDL_Renderer * renderer,
75 SDL_Texture * texture);
76 int (*UpdateTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
77 const SDL_Rect * rect, const void *pixels,
79 int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
80 const SDL_Rect * rect, int markDirty, void **pixels,
82 void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
83 void (*DirtyTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
84 int numrects, const SDL_Rect * rects);
85 int (*RenderClear) (SDL_Renderer * renderer);
86 int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_Point * points,
88 int (*RenderDrawLines) (SDL_Renderer * renderer, const SDL_Point * points,
90 int (*RenderFillRects) (SDL_Renderer * renderer, const SDL_Rect ** rects,
92 int (*RenderCopy) (SDL_Renderer * renderer, SDL_Texture * texture,
93 const SDL_Rect * srcrect, const SDL_Rect * dstrect);
94 int (*RenderReadPixels) (SDL_Renderer * renderer, const SDL_Rect * rect,
95 Uint32 format, void * pixels, int pitch);
96 int (*RenderWritePixels) (SDL_Renderer * renderer, const SDL_Rect * rect,
97 Uint32 format, const void * pixels, int pitch);
98 void (*RenderPresent) (SDL_Renderer * renderer);
99 void (*DestroyTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
101 void (*DestroyRenderer) (SDL_Renderer * renderer);
103 /* The current renderer info */
104 SDL_RendererInfo info;
106 /* The window associated with the renderer */
109 /* The list of textures */
110 SDL_Texture *textures;
112 Uint8 r, g, b, a; /**< Color for drawing operations values */
113 SDL_BlendMode blendMode; /**< The drawing blend mode */
118 /* Define the SDL render driver structure */
119 struct SDL_RenderDriver
121 SDL_Renderer *(*CreateRenderer) (SDL_Window * window, Uint32 flags);
123 /* Info about the renderer capabilities */
124 SDL_RendererInfo info;
127 /* Define the SDL window-shaper structure */
128 struct SDL_WindowShaper
130 /* The window associated with the shaper */
133 /* The user's specified coordinates for the window, for once we give it a shape. */
136 /* The parameters for shape calculation. */
137 SDL_WindowShapeMode mode;
139 /* Has this window been assigned a shape? */
145 /* Define the SDL shape driver structure */
146 struct SDL_ShapeDriver
148 SDL_WindowShaper *(*CreateShaper)(SDL_Window * window);
149 int (*SetWindowShape)(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode);
150 int (*ResizeWindowShape)(SDL_Window *window);
153 /* Define the SDL window structure, corresponding to toplevel windows */
163 SDL_VideoDisplay *display;
165 SDL_DisplayMode fullscreen_mode;
167 SDL_WindowShaper *shaper;
175 #define FULLSCREEN_VISIBLE(W) \
176 (((W)->flags & SDL_WINDOW_FULLSCREEN) && \
177 ((W)->flags & SDL_WINDOW_SHOWN) && \
178 !((W)->flags & SDL_WINDOW_MINIMIZED))
181 * Define the SDL display structure This corresponds to physical monitors
182 * attached to the system.
184 struct SDL_VideoDisplay
186 int max_display_modes;
187 int num_display_modes;
188 SDL_DisplayMode *display_modes;
189 SDL_DisplayMode desktop_mode;
190 SDL_DisplayMode current_mode;
191 SDL_bool updating_fullscreen;
194 Uint16 *saved_gamma; /* (just offset into gamma) */
196 int num_render_drivers;
197 SDL_RenderDriver *render_drivers;
200 SDL_Window *fullscreen_window;
202 SDL_VideoDevice *device;
207 /* Define the SDL video driver structure */
208 #define _THIS SDL_VideoDevice *_this
210 struct SDL_VideoDevice
213 /* The name of this video driver */
217 /* Initialization/Query functions */
220 * Initialize the native video subsystem, filling in the list of
221 * displays for this driver, returning 0 or -1 if there's an error.
223 int (*VideoInit) (_THIS);
226 * Reverse the effects VideoInit() -- called if VideoInit() fails or
227 * if the application is shutting down the video subsystem.
229 void (*VideoQuit) (_THIS);
237 * Get the bounds of a display
239 int (*GetDisplayBounds) (_THIS, SDL_VideoDisplay * display, SDL_Rect * rect);
242 * Get a list of the available display modes. e.g.
243 * SDL_AddDisplayMode(_this->current_display, mode)
245 void (*GetDisplayModes) (_THIS, SDL_VideoDisplay * display);
248 * Setting the display mode is independent of creating windows, so
249 * when the display mode is changed, all existing windows should have
250 * their data updated accordingly, including the display surfaces
251 * associated with them.
253 int (*SetDisplayMode) (_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
255 /* Set the gamma ramp */
256 int (*SetDisplayGammaRamp) (_THIS, SDL_VideoDisplay * display, Uint16 * ramp);
258 /* Get the gamma ramp */
259 int (*GetDisplayGammaRamp) (_THIS, SDL_VideoDisplay * display, Uint16 * ramp);
265 int (*CreateWindow) (_THIS, SDL_Window * window);
266 int (*CreateWindowFrom) (_THIS, SDL_Window * window, const void *data);
267 void (*SetWindowTitle) (_THIS, SDL_Window * window);
268 void (*SetWindowIcon) (_THIS, SDL_Window * window, SDL_Surface * icon);
269 void (*SetWindowPosition) (_THIS, SDL_Window * window);
270 void (*SetWindowSize) (_THIS, SDL_Window * window);
271 void (*ShowWindow) (_THIS, SDL_Window * window);
272 void (*HideWindow) (_THIS, SDL_Window * window);
273 void (*RaiseWindow) (_THIS, SDL_Window * window);
274 void (*MaximizeWindow) (_THIS, SDL_Window * window);
275 void (*MinimizeWindow) (_THIS, SDL_Window * window);
276 void (*RestoreWindow) (_THIS, SDL_Window * window);
277 void (*SetWindowGrab) (_THIS, SDL_Window * window);
278 void (*DestroyWindow) (_THIS, SDL_Window * window);
282 * Shaped-window functions
284 SDL_ShapeDriver shape_driver;
286 /* Get some platform dependent window information */
287 SDL_bool(*GetWindowWMInfo) (_THIS, SDL_Window * window,
288 struct SDL_SysWMinfo * info);
294 int (*GL_LoadLibrary) (_THIS, const char *path);
295 void *(*GL_GetProcAddress) (_THIS, const char *proc);
296 void (*GL_UnloadLibrary) (_THIS);
297 SDL_GLContext(*GL_CreateContext) (_THIS, SDL_Window * window);
298 int (*GL_MakeCurrent) (_THIS, SDL_Window * window, SDL_GLContext context);
299 int (*GL_SetSwapInterval) (_THIS, int interval);
300 int (*GL_GetSwapInterval) (_THIS);
301 void (*GL_SwapWindow) (_THIS, SDL_Window * window);
302 void (*GL_DeleteContext) (_THIS, SDL_GLContext context);
306 * Event manager functions
308 void (*PumpEvents) (_THIS);
310 /* Suspend the screensaver */
311 void (*SuspendScreenSaver) (_THIS);
314 void (*StartTextInput) (_THIS);
315 void (*StopTextInput) (_THIS);
316 void (*SetTextInputRect) (_THIS, SDL_Rect *rect);
319 int (*SetClipboardText) (_THIS, const char *text);
320 char * (*GetClipboardText) (_THIS);
321 SDL_bool (*HasClipboardText) (_THIS);
324 /* Data common to all drivers */
325 SDL_bool suspend_screensaver;
327 SDL_VideoDisplay *displays;
330 Uint8 renderer_magic;
332 Uint32 next_object_id;
333 char * clipboard_text;
336 /* Data used by the GL drivers */
348 int accum_green_size;
350 int accum_alpha_size;
352 int multisamplebuffers;
353 int multisamplesamples;
357 int retained_backing;
359 char driver_path[256];
364 /* Data private to this driver */
366 struct SDL_GLDriverData *gl_data;
368 #if SDL_VIDEO_DRIVER_PANDORA
369 struct SDL_PrivateGLESData *gles_data;
373 /* The function used to dispose of this structure */
374 void (*free) (_THIS);
377 typedef struct VideoBootStrap
381 int (*available) (void);
382 SDL_VideoDevice *(*create) (int devindex);
385 #if SDL_VIDEO_DRIVER_COCOA
386 extern VideoBootStrap COCOA_bootstrap;
388 #if SDL_VIDEO_DRIVER_X11
389 extern VideoBootStrap X11_bootstrap;
391 #if SDL_VIDEO_DRIVER_DIRECTFB
392 extern VideoBootStrap DirectFB_bootstrap;
394 #if SDL_VIDEO_DRIVER_WINDOWS
395 extern VideoBootStrap WINDOWS_bootstrap;
397 #if SDL_VIDEO_DRIVER_BWINDOW
398 extern VideoBootStrap BWINDOW_bootstrap;
400 #if SDL_VIDEO_DRIVER_PANDORA
401 extern VideoBootStrap PND_bootstrap;
403 #if SDL_VIDEO_DRIVER_NDS
404 extern VideoBootStrap NDS_bootstrap;
406 #if SDL_VIDEO_DRIVER_UIKIT
407 extern VideoBootStrap UIKIT_bootstrap;
409 #if SDL_VIDEO_DRIVER_ANDROID
410 extern VideoBootStrap Android_bootstrap;
412 #if SDL_VIDEO_DRIVER_DUMMY
413 extern VideoBootStrap DUMMY_bootstrap;
416 #define SDL_CurrentDisplay (&_this->displays[_this->current_display])
418 extern SDL_VideoDevice *SDL_GetVideoDevice(void);
419 extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
420 extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display);
421 extern SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode * mode);
422 extern int SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay * display);
423 extern int SDL_GetDisplayModeForDisplay(SDL_VideoDisplay * display, int index, SDL_DisplayMode * mode);
424 extern int SDL_GetDesktopDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode);
425 extern int SDL_GetCurrentDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode);
426 extern SDL_DisplayMode * SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
427 extern int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode);
428 extern int SDL_SetGammaRampForDisplay(SDL_VideoDisplay * display, const Uint16 * red, const Uint16 * green, const Uint16 * blue);
429 extern int SDL_GetGammaRampForDisplay(SDL_VideoDisplay * display, Uint16 * red, Uint16 * green, Uint16 * blue);
430 extern void SDL_AddRenderDriver(SDL_VideoDisplay *display, const SDL_RenderDriver * driver);
432 extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
434 extern void SDL_OnWindowShown(SDL_Window * window);
435 extern void SDL_OnWindowHidden(SDL_Window * window);
436 extern void SDL_OnWindowMinimized(SDL_Window * window);
437 extern void SDL_OnWindowRestored(SDL_Window * window);
438 extern void SDL_OnWindowFocusGained(SDL_Window * window);
439 extern void SDL_OnWindowFocusLost(SDL_Window * window);
440 extern SDL_Window * SDL_GetFocusWindow(void);
442 #endif /* _SDL_sysvideo_h */
444 /* vi: set ts=4 sw=4 expandtab: */