Changed StartTextInput to take an SDL_Window parameter.
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_mouse.h"
28 #include "SDL_keysym.h"
30 /* The SDL video driver */
32 typedef struct SDL_Renderer SDL_Renderer;
33 typedef struct SDL_RenderDriver SDL_RenderDriver;
34 typedef struct SDL_VideoDisplay SDL_VideoDisplay;
35 typedef struct SDL_VideoDevice SDL_VideoDevice;
37 /* Define the SDL texture structure */
41 Uint32 format; /**< The pixel format of the texture */
42 int access; /**< SDL_TextureAccess */
43 int w; /**< The width of the texture */
44 int h; /**< The height of the texture */
45 int modMode; /**< The texture modulation mode */
46 int blendMode; /**< The texture blend mode */
47 int scaleMode; /**< The texture scale mode */
48 Uint8 r, g, b, a; /**< Texture modulation values */
50 SDL_Renderer *renderer;
52 void *driverdata; /**< Driver specific texture representation */
58 /* Define the SDL renderer structure */
61 int (*ActivateRenderer) (SDL_Renderer * renderer);
62 int (*DisplayModeChanged) (SDL_Renderer * renderer);
63 int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
64 int (*QueryTexturePixels) (SDL_Renderer * renderer, SDL_Texture * texture,
65 void **pixels, int *pitch);
66 int (*SetTexturePalette) (SDL_Renderer * renderer, SDL_Texture * texture,
67 const SDL_Color * colors, int firstcolor,
69 int (*GetTexturePalette) (SDL_Renderer * renderer, SDL_Texture * texture,
70 SDL_Color * colors, int firstcolor,
72 int (*SetTextureColorMod) (SDL_Renderer * renderer,
73 SDL_Texture * texture);
74 int (*SetTextureAlphaMod) (SDL_Renderer * renderer,
75 SDL_Texture * texture);
76 int (*SetTextureBlendMode) (SDL_Renderer * renderer,
77 SDL_Texture * texture);
78 int (*SetTextureScaleMode) (SDL_Renderer * renderer,
79 SDL_Texture * texture);
80 int (*UpdateTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
81 const SDL_Rect * rect, const void *pixels,
83 int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
84 const SDL_Rect * rect, int markDirty, void **pixels,
86 void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
87 void (*DirtyTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
88 int numrects, const SDL_Rect * rects);
89 int (*SetDrawColor) (SDL_Renderer * renderer);
90 int (*SetDrawBlendMode) (SDL_Renderer * renderer);
91 int (*RenderClear) (SDL_Renderer * renderer);
92 int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_Point * points,
94 int (*RenderDrawLines) (SDL_Renderer * renderer, const SDL_Point * points,
96 int (*RenderDrawRects) (SDL_Renderer * renderer, const SDL_Rect ** rects,
98 int (*RenderFillRects) (SDL_Renderer * renderer, const SDL_Rect ** rects,
100 int (*RenderDrawEllipse) (SDL_Renderer * renderer, int x, int y,
102 int (*RenderFillEllipse) (SDL_Renderer * renderer, int x, int y,
104 int (*RenderCopy) (SDL_Renderer * renderer, SDL_Texture * texture,
105 const SDL_Rect * srcrect, const SDL_Rect * dstrect);
106 int (*RenderReadPixels) (SDL_Renderer * renderer, const SDL_Rect * rect,
107 Uint32 format, void * pixels, int pitch);
108 int (*RenderWritePixels) (SDL_Renderer * renderer, const SDL_Rect * rect,
109 Uint32 format, const void * pixels, int pitch);
110 void (*RenderPresent) (SDL_Renderer * renderer);
111 void (*DestroyTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
113 void (*DestroyRenderer) (SDL_Renderer * renderer);
115 /* The current renderer info */
116 SDL_RendererInfo info;
118 /* The window associated with the renderer */
121 /* The list of textures */
122 SDL_Texture *textures;
124 Uint8 r, g, b, a; /**< Color for drawing operations values */
125 int blendMode; /**< The drawing blend mode */
130 /* Define the SDL render driver structure */
131 struct SDL_RenderDriver
133 SDL_Renderer *(*CreateRenderer) (SDL_Window * window, Uint32 flags);
135 /* Info about the renderer capabilities */
136 SDL_RendererInfo info;
139 /* Define the SDL window structure, corresponding to toplevel windows */
149 SDL_VideoDisplay *display;
150 SDL_Renderer *renderer;
152 SDL_DisplayMode fullscreen_mode;
160 #define FULLSCREEN_VISIBLE(W) \
161 (((W)->flags & SDL_WINDOW_FULLSCREEN) && \
162 ((W)->flags & SDL_WINDOW_SHOWN) && \
163 !((W)->flags & SDL_WINDOW_MINIMIZED))
166 * Define the SDL display structure This corresponds to physical monitors
167 * attached to the system.
169 struct SDL_VideoDisplay
171 int max_display_modes;
172 int num_display_modes;
173 SDL_DisplayMode *display_modes;
174 SDL_DisplayMode desktop_mode;
175 SDL_DisplayMode current_mode;
176 SDL_bool updating_fullscreen;
177 SDL_Palette *palette;
180 Uint16 *saved_gamma; /* (just offset into gamma) */
182 int num_render_drivers;
183 SDL_RenderDriver *render_drivers;
186 SDL_Window *fullscreen_window;
188 SDL_Renderer *current_renderer;
190 SDL_VideoDevice *device;
195 /* Define the SDL video driver structure */
196 #define _THIS SDL_VideoDevice *_this
198 struct SDL_VideoDevice
201 /* The name of this video driver */
205 /* Initialization/Query functions */
208 * Initialize the native video subsystem, filling in the list of
209 * displays for this driver, returning 0 or -1 if there's an error.
211 int (*VideoInit) (_THIS);
214 * Reverse the effects VideoInit() -- called if VideoInit() fails or
215 * if the application is shutting down the video subsystem.
217 void (*VideoQuit) (_THIS);
225 * Get the bounds of a display
227 int (*GetDisplayBounds) (_THIS, SDL_VideoDisplay * display, SDL_Rect * rect);
230 * Get a list of the available display modes. e.g.
231 * SDL_AddDisplayMode(_this->current_display, mode)
233 void (*GetDisplayModes) (_THIS, SDL_VideoDisplay * display);
236 * Setting the display mode is independent of creating windows, so
237 * when the display mode is changed, all existing windows should have
238 * their data updated accordingly, including the display surfaces
239 * associated with them.
241 int (*SetDisplayMode) (_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
243 /* Set the color entries of the display palette */
244 int (*SetDisplayPalette) (_THIS, SDL_VideoDisplay * display, SDL_Palette * palette);
246 /* Get the color entries of the display palette */
247 int (*GetDisplayPalette) (_THIS, SDL_VideoDisplay * display, SDL_Palette * palette);
249 /* Set the gamma ramp */
250 int (*SetDisplayGammaRamp) (_THIS, SDL_VideoDisplay * display, Uint16 * ramp);
252 /* Get the gamma ramp */
253 int (*GetDisplayGammaRamp) (_THIS, SDL_VideoDisplay * display, Uint16 * ramp);
259 int (*CreateWindow) (_THIS, SDL_Window * window);
260 int (*CreateWindowFrom) (_THIS, SDL_Window * window, const void *data);
261 void (*SetWindowTitle) (_THIS, SDL_Window * window);
262 void (*SetWindowIcon) (_THIS, SDL_Window * window, SDL_Surface * icon);
263 void (*SetWindowPosition) (_THIS, SDL_Window * window);
264 void (*SetWindowSize) (_THIS, SDL_Window * window);
265 void (*ShowWindow) (_THIS, SDL_Window * window);
266 void (*HideWindow) (_THIS, SDL_Window * window);
267 void (*RaiseWindow) (_THIS, SDL_Window * window);
268 void (*MaximizeWindow) (_THIS, SDL_Window * window);
269 void (*MinimizeWindow) (_THIS, SDL_Window * window);
270 void (*RestoreWindow) (_THIS, SDL_Window * window);
271 void (*SetWindowGrab) (_THIS, SDL_Window * window);
272 void (*DestroyWindow) (_THIS, SDL_Window * window);
274 /* Get some platform dependent window information */
275 SDL_bool(*GetWindowWMInfo) (_THIS, SDL_Window * window,
276 struct SDL_SysWMinfo * info);
282 int (*GL_LoadLibrary) (_THIS, const char *path);
283 void *(*GL_GetProcAddress) (_THIS, const char *proc);
284 void (*GL_UnloadLibrary) (_THIS);
285 SDL_GLContext(*GL_CreateContext) (_THIS, SDL_Window * window);
286 int (*GL_MakeCurrent) (_THIS, SDL_Window * window, SDL_GLContext context);
287 int (*GL_SetSwapInterval) (_THIS, int interval);
288 int (*GL_GetSwapInterval) (_THIS);
289 void (*GL_SwapWindow) (_THIS, SDL_Window * window);
290 void (*GL_DeleteContext) (_THIS, SDL_GLContext context);
294 * Event manager functions
296 void (*PumpEvents) (_THIS);
298 /* Suspend the screensaver */
299 void (*SuspendScreenSaver) (_THIS);
302 void (*StartTextInput) (_THIS, SDL_Window *window);
303 void (*StopTextInput) (_THIS);
304 void (*SetTextInputRect) (_THIS, SDL_Rect *rect);
307 /* Data common to all drivers */
308 SDL_bool suspend_screensaver;
310 SDL_VideoDisplay *displays;
314 Uint32 next_object_id;
317 /* Data used by the GL drivers */
329 int accum_green_size;
331 int accum_alpha_size;
333 int multisamplebuffers;
334 int multisamplesamples;
338 int retained_backing;
340 char driver_path[256];
345 /* Data private to this driver */
347 struct SDL_GLDriverData *gl_data;
349 #if SDL_VIDEO_DRIVER_PANDORA
350 struct SDL_PrivateGLESData *gles_data;
354 /* The function used to dispose of this structure */
355 void (*free) (_THIS);
358 typedef struct VideoBootStrap
362 int (*available) (void);
363 SDL_VideoDevice *(*create) (int devindex);
366 #if SDL_VIDEO_DRIVER_COCOA
367 extern VideoBootStrap COCOA_bootstrap;
369 #if SDL_VIDEO_DRIVER_X11
370 extern VideoBootStrap X11_bootstrap;
372 #if SDL_VIDEO_DRIVER_FBCON
373 extern VideoBootStrap FBCON_bootstrap;
375 #if SDL_VIDEO_DRIVER_DIRECTFB
376 extern VideoBootStrap DirectFB_bootstrap;
378 #if SDL_VIDEO_DRIVER_PS3
379 extern VideoBootStrap PS3_bootstrap;
381 #if SDL_VIDEO_DRIVER_SVGALIB
382 extern VideoBootStrap SVGALIB_bootstrap;
384 #if SDL_VIDEO_DRIVER_GAPI
385 extern VideoBootStrap GAPI_bootstrap;
387 #if SDL_VIDEO_DRIVER_WIN32
388 extern VideoBootStrap WIN32_bootstrap;
390 #if SDL_VIDEO_DRIVER_BWINDOW
391 extern VideoBootStrap BWINDOW_bootstrap;
393 #if SDL_VIDEO_DRIVER_PHOTON
394 extern VideoBootStrap photon_bootstrap;
396 #if SDL_VIDEO_DRIVER_QNXGF
397 extern VideoBootStrap qnxgf_bootstrap;
399 #if SDL_VIDEO_DRIVER_EPOC
400 extern VideoBootStrap EPOC_bootstrap;
402 #if SDL_VIDEO_DRIVER_RISCOS
403 extern VideoBootStrap RISCOS_bootstrap;
405 #if SDL_VIDEO_DRIVER_UIKIT
406 extern VideoBootStrap UIKIT_bootstrap;
408 #if SDL_VIDEO_DRIVER_DUMMY
409 extern VideoBootStrap DUMMY_bootstrap;
411 #if SDL_VIDEO_DRIVER_NDS
412 extern VideoBootStrap NDS_bootstrap;
414 #if SDL_VIDEO_DRIVER_PANDORA
415 extern VideoBootStrap PND_bootstrap;
418 #define SDL_CurrentDisplay (&_this->displays[_this->current_display])
419 #define SDL_CurrentRenderer (SDL_CurrentDisplay->current_renderer)
421 extern SDL_VideoDevice *SDL_GetVideoDevice(void);
422 extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
423 extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display);
424 extern SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode * mode);
425 extern int SDL_GetNumDisplayModesForDisplay(SDL_VideoDisplay * display);
426 extern int SDL_GetDisplayModeForDisplay(SDL_VideoDisplay * display, int index, SDL_DisplayMode * mode);
427 extern int SDL_GetDesktopDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode);
428 extern int SDL_GetCurrentDisplayModeForDisplay(SDL_VideoDisplay * display, SDL_DisplayMode * mode);
429 extern SDL_DisplayMode * SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);
430 extern int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay * display, const SDL_DisplayMode * mode);
431 extern int SDL_SetPaletteForDisplay(SDL_VideoDisplay * display, const SDL_Color * colors, int firstcolor, int ncolors);
432 extern int SDL_GetPaletteForDisplay(SDL_VideoDisplay * display, SDL_Color * colors, int firstcolor, int ncolors);
433 extern int SDL_SetGammaRampForDisplay(SDL_VideoDisplay * display, const Uint16 * red, const Uint16 * green, const Uint16 * blue);
434 extern int SDL_GetGammaRampForDisplay(SDL_VideoDisplay * display, Uint16 * red, Uint16 * green, Uint16 * blue);
435 extern void SDL_AddRenderDriver(SDL_VideoDisplay *display, const SDL_RenderDriver * driver);
437 extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
439 extern void SDL_OnWindowShown(SDL_Window * window);
440 extern void SDL_OnWindowHidden(SDL_Window * window);
441 extern void SDL_OnWindowResized(SDL_Window * window);
442 extern void SDL_OnWindowMinimized(SDL_Window * window);
443 extern void SDL_OnWindowRestored(SDL_Window * window);
444 extern void SDL_OnWindowFocusGained(SDL_Window * window);
445 extern void SDL_OnWindowFocusLost(SDL_Window * window);
446 extern SDL_Window * SDL_GetFocusWindow(void);
448 #endif /* _SDL_sysvideo_h */
450 /* vi: set ts=4 sw=4 expandtab: */