Mercurial > sdl-ios-xcode
annotate src/video/SDL_sysvideo.h @ 19:8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
From: "Mike Gorchak" <mike@malva.com.ua>
Subject: Patches for QNX RtP
Here my patch for QNX RtP/Photon for SDL-1.2.
Detailed description of my changes:
SDL/configure.in:
If Photon detected declare define ENABLE_PHOTON.
SDL/src/video/SDL_sysvideo.h:
Added extern to ph_bootstrap.
SDL/src/video/SDL_video.c:
Added ph_bootstrap to bootstrap array.
SDL/src/video/photon/SDL_ph_events.c:
Declare DISABLE_X11 if compiled for Photon.
SDL/src/video/photon/SDL_ph_image.c:
Fixed segment violation on exit. Please update BUGS file.
SDL/src/video/photon/SDL_ph_video.c:
1. Enabling window manager.
2. Added to device capabilities Photon Window Manager functions:
SetCaption and IconifyWindow.
3. Renamed X11_bootstrap to ph_bootstrap.
4. Removed SEGFAULT termination of programs if Photon not available.
SDL/src/video/photon/SDL_ph_wm.c:
1. Declare DISABLE_X11 if compiled for Photon.
2. Added ph_SetCaption and ph_IconifyWindow code. (Thanks to
'phearbear' for iconify window source).
3. Some stubers for other wm functions.
Thanks !
----------------------------
Mike Gorchak
CJSC Malva
System Programmer
author | Sam Lantinga <slouken@lokigames.com> |
---|---|
date | Thu, 10 May 2001 18:42:17 +0000 |
parents | cf2af46e9e2a |
children | 57bf11a5efd7 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
3 Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga | |
4 | |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Library General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2 of the License, or (at your option) any later version. | |
9 | |
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 Library General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Library General Public | |
16 License along with this library; if not, write to the Free | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 Sam Lantinga | |
20 slouken@devolution.com | |
21 */ | |
22 | |
23 #ifdef SAVE_RCSID | |
24 static char rcsid = | |
25 "@(#) $Id$"; | |
26 #endif | |
27 | |
28 #ifndef _SDL_sysvideo_h | |
29 #define _SDL_sysvideo_h | |
30 | |
31 #include "SDL_mouse.h" | |
32 #define SDL_PROTOTYPES_ONLY | |
33 #include "SDL_syswm.h" | |
34 #undef SDL_PROTOTYPES_ONLY | |
35 | |
36 /* This file prototypes the video driver implementation. | |
37 This is designed to be easily converted to C++ in the future. | |
38 */ | |
39 | |
40 /* OpenGL is pretty much available on all Windows systems */ | |
41 #ifdef WIN32 | |
42 #ifndef _WIN32_WCE | |
43 #define HAVE_OPENGL | |
44 #endif | |
45 #include <windows.h> | |
46 #endif | |
47 | |
48 #ifdef HAVE_OPENGL | |
49 #ifdef MACOSX | |
50 #include <OpenGL/gl.h> /* OpenGL.framework */ | |
51 #else | |
52 #include <GL/gl.h> | |
53 #endif /* MACOSX */ | |
54 #endif /* HAVE_OPENGL */ | |
55 | |
56 /* The SDL video driver */ | |
57 typedef struct SDL_VideoDevice SDL_VideoDevice; | |
58 | |
59 /* Define the SDL video driver structure */ | |
60 #define _THIS SDL_VideoDevice *_this | |
61 #ifndef _STATUS | |
62 #define _STATUS SDL_status *status | |
63 #endif | |
64 struct SDL_VideoDevice { | |
65 /* * * */ | |
66 /* The name of this audio driver */ | |
67 const char *name; | |
68 | |
69 /* * * */ | |
70 /* Initialization/Query functions */ | |
71 | |
72 /* Initialize the native video subsystem, filling 'vformat' with the | |
73 "best" display pixel format, returning 0 or -1 if there's an error. | |
74 */ | |
75 int (*VideoInit)(_THIS, SDL_PixelFormat *vformat); | |
76 | |
77 /* List the available video modes for the given pixel format, sorted | |
78 from largest to smallest. | |
79 */ | |
80 SDL_Rect **(*ListModes)(_THIS, SDL_PixelFormat *format, Uint32 flags); | |
81 | |
82 /* Set the requested video mode, returning a surface which will be | |
83 set to the SDL_VideoSurface. The width and height will already | |
84 be verified by ListModes(), and the video subsystem is free to | |
85 set the mode to a supported bit depth different from the one | |
86 specified -- the desired bpp will be emulated with a shadow | |
87 surface if necessary. If a new mode is returned, this function | |
88 should take care of cleaning up the current mode. | |
89 */ | |
90 SDL_Surface *(*SetVideoMode)(_THIS, SDL_Surface *current, | |
91 int width, int height, int bpp, Uint32 flags); | |
92 | |
93 /* Toggle the fullscreen mode */ | |
94 int (*ToggleFullScreen)(_THIS, int on); | |
95 | |
96 /* This is called after the video mode has been set, to get the | |
97 initial mouse state. It should queue events as necessary to | |
98 properly represent the current mouse focus and position. | |
99 */ | |
100 void (*UpdateMouse)(_THIS); | |
101 | |
102 /* Create a YUV video surface (possibly overlay) of the given | |
103 format. The hardware should be able to perform at least 2x | |
104 scaling on display. | |
105 */ | |
106 SDL_Overlay *(*CreateYUVOverlay)(_THIS, int width, int height, | |
107 Uint32 format, SDL_Surface *display); | |
108 | |
109 /* Sets the color entries { firstcolor .. (firstcolor+ncolors-1) } | |
110 of the physical palette to those in 'colors'. If the device is | |
111 using a software palette (SDL_HWPALETTE not set), then the | |
112 changes are reflected in the logical palette of the screen | |
113 as well. | |
114 The return value is 1 if all entries could be set properly | |
115 or 0 otherwise. | |
116 */ | |
117 int (*SetColors)(_THIS, int firstcolor, int ncolors, | |
118 SDL_Color *colors); | |
119 | |
120 /* This pointer should exist in the native video subsystem and should | |
121 point to an appropriate update function for the current video mode | |
122 */ | |
123 void (*UpdateRects)(_THIS, int numrects, SDL_Rect *rects); | |
124 | |
125 /* Reverse the effects VideoInit() -- called if VideoInit() fails | |
126 or if the application is shutting down the video subsystem. | |
127 */ | |
128 void (*VideoQuit)(_THIS); | |
129 | |
130 /* * * */ | |
131 /* Hardware acceleration functions */ | |
132 | |
133 /* Information about the video hardware */ | |
134 SDL_VideoInfo info; | |
135 | |
136 /* Allocates a surface in video memory */ | |
137 int (*AllocHWSurface)(_THIS, SDL_Surface *surface); | |
138 | |
139 /* Sets the hardware accelerated blit function, if any, based | |
140 on the current flags of the surface (colorkey, alpha, etc.) | |
141 */ | |
142 int (*CheckHWBlit)(_THIS, SDL_Surface *src, SDL_Surface *dst); | |
143 | |
144 /* Fills a surface rectangle with the given color */ | |
145 int (*FillHWRect)(_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color); | |
146 | |
147 /* Sets video mem colorkey and accelerated blit function */ | |
148 int (*SetHWColorKey)(_THIS, SDL_Surface *surface, Uint32 key); | |
149 | |
150 /* Sets per surface hardware alpha value */ | |
151 int (*SetHWAlpha)(_THIS, SDL_Surface *surface, Uint8 value); | |
152 | |
153 /* Returns a readable/writable surface */ | |
154 int (*LockHWSurface)(_THIS, SDL_Surface *surface); | |
155 void (*UnlockHWSurface)(_THIS, SDL_Surface *surface); | |
156 | |
157 /* Performs hardware flipping */ | |
158 int (*FlipHWSurface)(_THIS, SDL_Surface *surface); | |
159 | |
160 /* Frees a previously allocated video surface */ | |
161 void (*FreeHWSurface)(_THIS, SDL_Surface *surface); | |
162 | |
163 /* * * */ | |
164 /* Gamma support */ | |
165 | |
166 Uint16 *gamma; | |
167 | |
168 /* Set the gamma correction directly (emulated with gamma ramps) */ | |
169 int (*SetGamma)(_THIS, float red, float green, float blue); | |
170 | |
171 /* Get the gamma correction directly (emulated with gamma ramps) */ | |
172 int (*GetGamma)(_THIS, float *red, float *green, float *blue); | |
173 | |
174 /* Set the gamma ramp */ | |
175 int (*SetGammaRamp)(_THIS, Uint16 *ramp); | |
176 | |
177 /* Get the gamma ramp */ | |
178 int (*GetGammaRamp)(_THIS, Uint16 *ramp); | |
179 | |
180 /* * * */ | |
181 /* OpenGL support */ | |
182 | |
183 /* Sets the dll to use for OpenGL and loads it */ | |
184 int (*GL_LoadLibrary)(_THIS, const char *path); | |
185 | |
186 /* Retrieves the address of a function in the gl library */ | |
187 void* (*GL_GetProcAddress)(_THIS, const char *proc); | |
188 | |
189 /* Get attribute information from the windowing system. */ | |
190 int (*GL_GetAttribute)(_THIS, SDL_GLattr attrib, int* value); | |
191 | |
192 /* Make the context associated with this driver current */ | |
193 int (*GL_MakeCurrent)(_THIS); | |
194 | |
195 /* Swap the current buffers in double buffer mode. */ | |
196 void (*GL_SwapBuffers)(_THIS); | |
197 | |
198 /* OpenGL functions for SDL_OPENGLBLIT */ | |
199 #ifdef HAVE_OPENGL | |
200 #ifndef WIN32 | |
201 #define WINAPI | |
202 #endif | |
203 #define SDL_PROC(ret,func,params) ret (WINAPI *func) params; | |
204 #include "SDL_glfuncs.h" | |
205 #undef SDL_PROC | |
206 | |
207 /* Texture id */ | |
208 GLuint texture; | |
209 #endif | |
210 int is_32bit; | |
211 | |
212 /* * * */ | |
213 /* Window manager functions */ | |
214 | |
215 /* Set the title and icon text */ | |
216 void (*SetCaption)(_THIS, const char *title, const char *icon); | |
217 | |
218 /* Set the window icon image */ | |
219 void (*SetIcon)(_THIS, SDL_Surface *icon, Uint8 *mask); | |
220 | |
221 /* Iconify the window. | |
222 This function returns 1 if there is a window manager and the | |
223 window was actually iconified, it returns 0 otherwise. | |
224 */ | |
225 int (*IconifyWindow)(_THIS); | |
226 | |
227 /* Grab or ungrab keyboard and mouse input */ | |
228 SDL_GrabMode (*GrabInput)(_THIS, SDL_GrabMode mode); | |
229 | |
230 /* Get some platform dependent window information */ | |
231 int (*GetWMInfo)(_THIS, SDL_SysWMinfo *info); | |
232 | |
233 /* * * */ | |
234 /* Cursor manager functions */ | |
235 | |
236 /* Free a window manager cursor | |
237 This function can be NULL if CreateWMCursor is also NULL. | |
238 */ | |
239 void (*FreeWMCursor)(_THIS, WMcursor *cursor); | |
240 | |
241 /* If not NULL, create a black/white window manager cursor */ | |
242 WMcursor *(*CreateWMCursor)(_THIS, | |
243 Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y); | |
244 | |
245 /* Show the specified cursor, or hide if cursor is NULL */ | |
246 int (*ShowWMCursor)(_THIS, WMcursor *cursor); | |
247 | |
248 /* Warp the window manager cursor to (x,y) | |
249 If NULL, a mouse motion event is posted internally. | |
250 */ | |
251 void (*WarpWMCursor)(_THIS, Uint16 x, Uint16 y); | |
252 | |
253 /* If not NULL, this is called when a mouse motion event occurs */ | |
254 void (*MoveWMCursor)(_THIS, int x, int y); | |
255 | |
256 /* Determine whether the mouse should be in relative mode or not. | |
257 This function is called when the input grab state or cursor | |
258 visibility state changes. | |
259 If the cursor is not visible, and the input is grabbed, the | |
260 driver can place the mouse in relative mode, which may result | |
261 in higher accuracy sampling of the pointer motion. | |
262 */ | |
263 void (*CheckMouseMode)(_THIS); | |
264 | |
265 /* * * */ | |
266 /* Event manager functions */ | |
267 | |
268 /* Initialize keyboard mapping for this driver */ | |
269 void (*InitOSKeymap)(_THIS); | |
270 | |
271 /* Handle any queued OS events */ | |
272 void (*PumpEvents)(_THIS); | |
273 | |
274 /* * * */ | |
275 /* Data common to all drivers */ | |
276 SDL_Surface *screen; | |
277 SDL_Surface *shadow; | |
278 SDL_Surface *visible; | |
279 SDL_Palette *physpal; /* physical palette, if != logical palette */ | |
280 SDL_Color *gammacols; /* gamma-corrected colours, or NULL */ | |
281 char *wm_title; | |
282 char *wm_icon; | |
283 int offset_x; | |
284 int offset_y; | |
285 SDL_GrabMode input_grab; | |
286 | |
287 /* Driver information flags */ | |
288 int handles_any_size; /* Driver handles any size video mode */ | |
289 | |
290 /* * * */ | |
291 /* Data used by the GL drivers */ | |
292 struct { | |
293 int red_size; | |
294 int green_size; | |
295 int blue_size; | |
296 int alpha_size; | |
297 int depth_size; | |
298 int buffer_size; | |
299 int stencil_size; | |
300 int double_buffer; | |
301 int accum_red_size; | |
302 int accum_green_size; | |
303 int accum_blue_size; | |
304 int accum_alpha_size; | |
305 int driver_loaded; | |
306 char driver_path[256]; | |
307 void* dll_handle; | |
308 } gl_config; | |
309 | |
310 /* * * */ | |
311 /* Data private to this driver */ | |
312 struct SDL_PrivateVideoData *hidden; | |
313 struct SDL_PrivateGLData *gl_data; | |
314 | |
315 /* * * */ | |
316 /* The function used to dispose of this structure */ | |
317 void (*free)(_THIS); | |
318 }; | |
319 #undef _THIS | |
320 | |
321 typedef struct VideoBootStrap { | |
322 const char *name; | |
323 const char *desc; | |
324 int (*available)(void); | |
325 SDL_VideoDevice *(*create)(int devindex); | |
326 } VideoBootStrap; | |
327 | |
328 #ifdef ENABLE_X11 | |
329 extern VideoBootStrap X11_bootstrap; | |
330 #endif | |
331 #ifdef ENABLE_DGA | |
332 extern VideoBootStrap DGA_bootstrap; | |
333 #endif | |
334 #ifdef ENABLE_FBCON | |
335 extern VideoBootStrap FBCON_bootstrap; | |
336 #endif | |
337 #ifdef ENABLE_PS2GS | |
338 extern VideoBootStrap PS2GS_bootstrap; | |
339 #endif | |
340 #ifdef ENABLE_GGI | |
341 extern VideoBootStrap GGI_bootstrap; | |
342 #endif | |
343 #ifdef ENABLE_SVGALIB | |
344 extern VideoBootStrap SVGALIB_bootstrap; | |
345 #endif | |
346 #ifdef ENABLE_AALIB | |
347 extern VideoBootStrap AALIB_bootstrap; | |
348 #endif | |
349 #ifdef ENABLE_WINDIB | |
350 extern VideoBootStrap WINDIB_bootstrap; | |
351 #endif | |
352 #ifdef ENABLE_DIRECTX | |
353 extern VideoBootStrap DIRECTX_bootstrap; | |
354 #endif | |
355 #ifdef ENABLE_BWINDOW | |
356 extern VideoBootStrap BWINDOW_bootstrap; | |
357 #endif | |
1
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
358 #ifdef ENABLE_DUMMYVIDEO |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
359 extern VideoBootStrap DUMMY_bootstrap; |
cf2af46e9e2a
Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
360 #endif |
19
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
1
diff
changeset
|
361 #ifdef ENABLE_PHOTON |
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
1
diff
changeset
|
362 extern VideoBootStrap ph_bootstrap; |
8cc4dbfab9ab
Date: Thu, 19 Apr 2001 08:36:54 +0300
Sam Lantinga <slouken@lokigames.com>
parents:
1
diff
changeset
|
363 #endif |
0 | 364 /* MacOS X gets the proper defines from configure */ |
365 #if defined(macintosh) && !defined(MACOSX) | |
366 #define ENABLE_TOOLBOX | |
367 #if !TARGET_API_MAC_CARBON | |
368 #define ENABLE_DRAWSPROCKET | |
369 #endif | |
370 #endif | |
371 #ifdef ENABLE_TOOLBOX | |
372 extern VideoBootStrap TOOLBOX_bootstrap; | |
373 #endif | |
374 #ifdef ENABLE_DRAWSPROCKET | |
375 extern VideoBootStrap DSp_bootstrap; | |
376 #endif | |
377 #ifdef ENABLE_CYBERGRAPHICS | |
378 extern VideoBootStrap CGX_bootstrap; | |
379 #endif | |
380 | |
381 /* This is the current video device */ | |
382 extern SDL_VideoDevice *current_video; | |
383 | |
384 #define SDL_VideoSurface (current_video->screen) | |
385 #define SDL_ShadowSurface (current_video->shadow) | |
386 #define SDL_PublicSurface (current_video->visible) | |
387 | |
388 #endif /* _SDL_sysvideo_h */ |