comparison src/video/bwindow/SDL_sysvideo.cc @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children
comparison
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
42 #include "../blank_cursor.h" 42 #include "../blank_cursor.h"
43 43
44 #define BEOS_HIDDEN_SIZE 32 /* starting hidden window size */ 44 #define BEOS_HIDDEN_SIZE 32 /* starting hidden window size */
45 45
46 /* Initialization/Query functions */ 46 /* Initialization/Query functions */
47 static int BE_VideoInit (_THIS, SDL_PixelFormat * vformat); 47 static int BE_VideoInit(_THIS, SDL_PixelFormat * vformat);
48 static SDL_Rect **BE_ListModes (_THIS, SDL_PixelFormat * format, 48 static SDL_Rect **BE_ListModes(_THIS, SDL_PixelFormat * format,
49 Uint32 flags); 49 Uint32 flags);
50 static SDL_Surface *BE_SetVideoMode (_THIS, SDL_Surface * current, 50 static SDL_Surface *BE_SetVideoMode(_THIS, SDL_Surface * current,
51 int width, int height, int bpp, 51 int width, int height, int bpp,
52 Uint32 flags); 52 Uint32 flags);
53 static void BE_UpdateMouse (_THIS); 53 static void BE_UpdateMouse(_THIS);
54 static int BE_SetColors (_THIS, int firstcolor, int ncolors, 54 static int BE_SetColors(_THIS, int firstcolor, int ncolors,
55 SDL_Color * colors); 55 SDL_Color * colors);
56 static void BE_VideoQuit (_THIS); 56 static void BE_VideoQuit(_THIS);
57 57
58 /* Hardware surface functions */ 58 /* Hardware surface functions */
59 static int BE_AllocHWSurface (_THIS, SDL_Surface * surface); 59 static int BE_AllocHWSurface(_THIS, SDL_Surface * surface);
60 static int BE_LockHWSurface (_THIS, SDL_Surface * surface); 60 static int BE_LockHWSurface(_THIS, SDL_Surface * surface);
61 static void BE_UnlockHWSurface (_THIS, SDL_Surface * surface); 61 static void BE_UnlockHWSurface(_THIS, SDL_Surface * surface);
62 static void BE_FreeHWSurface (_THIS, SDL_Surface * surface); 62 static void BE_FreeHWSurface(_THIS, SDL_Surface * surface);
63 63
64 static int BE_ToggleFullScreen (_THIS, int fullscreen); 64 static int BE_ToggleFullScreen(_THIS, int fullscreen);
65 static SDL_Overlay *BE_CreateYUVOverlay (_THIS, int width, int height, 65 static SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height,
66 Uint32 format, 66 Uint32 format,
67 SDL_Surface * display); 67 SDL_Surface * display);
68 68
69 /* OpenGL functions */ 69 /* OpenGL functions */
70 #if SDL_VIDEO_OPENGL 70 #if SDL_VIDEO_OPENGL
71 static int BE_GL_LoadLibrary (_THIS, const char *path); 71 static int BE_GL_LoadLibrary(_THIS, const char *path);
72 static void *BE_GL_GetProcAddress (_THIS, const char *proc); 72 static void *BE_GL_GetProcAddress(_THIS, const char *proc);
73 static int BE_GL_GetAttribute (_THIS, SDL_GLattr attrib, int *value); 73 static int BE_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
74 static int BE_GL_MakeCurrent (_THIS); 74 static int BE_GL_MakeCurrent(_THIS);
75 static void BE_GL_SwapBuffers (_THIS); 75 static void BE_GL_SwapBuffers(_THIS);
76 #endif 76 #endif
77 77
78 /* FB driver bootstrap functions */ 78 /* FB driver bootstrap functions */
79 79
80 static int BE_Available (void) 80 static int BE_Available(void)
81 { 81 {
82 return (1); 82 return (1);
83 } 83 }
84 84
85 static void BE_DeleteDevice (SDL_VideoDevice * device) 85 static void BE_DeleteDevice(SDL_VideoDevice * device)
86 { 86 {
87 SDL_free (device->hidden); 87 SDL_free(device->hidden);
88 SDL_free (device); 88 SDL_free(device);
89 } 89 }
90 90
91 static SDL_VideoDevice *BE_CreateDevice (int devindex) 91 static SDL_VideoDevice *BE_CreateDevice(int devindex)
92 { 92 {
93 SDL_VideoDevice *device; 93 SDL_VideoDevice *device;
94 94
95 /* Initialize all variables that we clean on shutdown */ 95 /* Initialize all variables that we clean on shutdown */
96 device = (SDL_VideoDevice *) SDL_malloc (sizeof (SDL_VideoDevice)); 96 device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
97 if (device) { 97 if (device) {
98 SDL_memset (device, 0, (sizeof *device)); 98 SDL_memset(device, 0, (sizeof *device));
99 device->hidden = (struct SDL_PrivateVideoData *) 99 device->hidden = (struct SDL_PrivateVideoData *)
100 SDL_malloc ((sizeof *device->hidden)); 100 SDL_malloc((sizeof *device->hidden));
101 } 101 }
102 if ((device == NULL) || (device->hidden == NULL)) { 102 if ((device == NULL) || (device->hidden == NULL)) {
103 SDL_OutOfMemory (); 103 SDL_OutOfMemory();
104 if (device) { 104 if (device) {
105 SDL_free (device); 105 SDL_free(device);
106 } 106 }
107 return (0); 107 return (0);
108 } 108 }
109 SDL_memset (device->hidden, 0, (sizeof *device->hidden)); 109 SDL_memset(device->hidden, 0, (sizeof *device->hidden));
110 110
111 /* Set the function pointers */ 111 /* Set the function pointers */
112 /* Initialization/Query functions */ 112 /* Initialization/Query functions */
113 device->VideoInit = BE_VideoInit; 113 device->VideoInit = BE_VideoInit;
114 device->ListModes = BE_ListModes; 114 device->ListModes = BE_ListModes;
166 VideoBootStrap BWINDOW_bootstrap = { 166 VideoBootStrap BWINDOW_bootstrap = {
167 "bwindow", "BDirectWindow graphics", 167 "bwindow", "BDirectWindow graphics",
168 BE_Available, BE_CreateDevice 168 BE_Available, BE_CreateDevice
169 }; 169 };
170 170
171 static inline int ColorSpaceToBitsPerPixel (uint32 colorspace) 171 static inline int ColorSpaceToBitsPerPixel(uint32 colorspace)
172 { 172 {
173 int bitsperpixel; 173 int bitsperpixel;
174 174
175 bitsperpixel = 0; 175 bitsperpixel = 0;
176 switch (colorspace) { 176 switch (colorspace) {
198 } 198 }
199 return (bitsperpixel); 199 return (bitsperpixel);
200 } 200 }
201 201
202 /* Function to sort the display_list in bscreen */ 202 /* Function to sort the display_list in bscreen */
203 static int CompareModes (const void *A, const void *B) 203 static int CompareModes(const void *A, const void *B)
204 { 204 {
205 const display_mode *a = (display_mode *) A; 205 const display_mode *a = (display_mode *) A;
206 const display_mode *b = (display_mode *) B; 206 const display_mode *b = (display_mode *) B;
207 207
208 if (a->space == b->space) { 208 if (a->space == b->space) {
209 return ((b->virtual_width * b->virtual_height) - 209 return ((b->virtual_width * b->virtual_height) -
210 (a->virtual_width * a->virtual_height)); 210 (a->virtual_width * a->virtual_height));
211 } else { 211 } else {
212 return (ColorSpaceToBitsPerPixel (b->space) - 212 return (ColorSpaceToBitsPerPixel(b->space) -
213 ColorSpaceToBitsPerPixel (a->space)); 213 ColorSpaceToBitsPerPixel(a->space));
214 } 214 }
215 } 215 }
216 216
217 /* Yes, this isn't the fastest it could be, but it works nicely */ 217 /* Yes, this isn't the fastest it could be, but it works nicely */
218 static int BE_AddMode (_THIS, int index, unsigned int w, unsigned int h) 218 static int BE_AddMode(_THIS, int index, unsigned int w, unsigned int h)
219 { 219 {
220 SDL_Rect *mode; 220 SDL_Rect *mode;
221 int i; 221 int i;
222 int next_mode; 222 int next_mode;
223 223
225 if (SDL_nummodes[index] > 0) { 225 if (SDL_nummodes[index] > 0) {
226 for (i = SDL_nummodes[index] - 1; i >= 0; --i) { 226 for (i = SDL_nummodes[index] - 1; i >= 0; --i) {
227 mode = SDL_modelist[index][i]; 227 mode = SDL_modelist[index][i];
228 if ((mode->w == w) && (mode->h == h)) { 228 if ((mode->w == w) && (mode->h == h)) {
229 #ifdef BWINDOW_DEBUG 229 #ifdef BWINDOW_DEBUG
230 fprintf (stderr, 230 fprintf(stderr,
231 "We already have mode %dx%d at %d bytes per pixel\n", 231 "We already have mode %dx%d at %d bytes per pixel\n",
232 w, h, index + 1); 232 w, h, index + 1);
233 #endif 233 #endif
234 return (0); 234 return (0);
235 } 235 }
236 } 236 }
237 } 237 }
238 238
239 /* Set up the new video mode rectangle */ 239 /* Set up the new video mode rectangle */
240 mode = (SDL_Rect *) SDL_malloc (sizeof *mode); 240 mode = (SDL_Rect *) SDL_malloc(sizeof *mode);
241 if (mode == NULL) { 241 if (mode == NULL) {
242 SDL_OutOfMemory (); 242 SDL_OutOfMemory();
243 return (-1); 243 return (-1);
244 } 244 }
245 mode->x = 0; 245 mode->x = 0;
246 mode->y = 0; 246 mode->y = 0;
247 mode->w = w; 247 mode->w = w;
248 mode->h = h; 248 mode->h = h;
249 #ifdef BWINDOW_DEBUG 249 #ifdef BWINDOW_DEBUG
250 fprintf (stderr, "Adding mode %dx%d at %d bytes per pixel\n", w, h, 250 fprintf(stderr, "Adding mode %dx%d at %d bytes per pixel\n", w, h,
251 index + 1); 251 index + 1);
252 #endif 252 #endif
253 253
254 /* Allocate the new list of modes, and fill in the new mode */ 254 /* Allocate the new list of modes, and fill in the new mode */
255 next_mode = SDL_nummodes[index]; 255 next_mode = SDL_nummodes[index];
256 SDL_modelist[index] = (SDL_Rect **) 256 SDL_modelist[index] = (SDL_Rect **)
257 SDL_realloc (SDL_modelist[index], 257 SDL_realloc(SDL_modelist[index],
258 (1 + next_mode + 1) * sizeof (SDL_Rect *)); 258 (1 + next_mode + 1) * sizeof(SDL_Rect *));
259 if (SDL_modelist[index] == NULL) { 259 if (SDL_modelist[index] == NULL) {
260 SDL_OutOfMemory (); 260 SDL_OutOfMemory();
261 SDL_nummodes[index] = 0; 261 SDL_nummodes[index] = 0;
262 SDL_free (mode); 262 SDL_free(mode);
263 return (-1); 263 return (-1);
264 } 264 }
265 SDL_modelist[index][next_mode] = mode; 265 SDL_modelist[index][next_mode] = mode;
266 SDL_modelist[index][next_mode + 1] = NULL; 266 SDL_modelist[index][next_mode + 1] = NULL;
267 SDL_nummodes[index]++; 267 SDL_nummodes[index]++;
268 268
269 return (0); 269 return (0);
270 } 270 }
271 271
272 int BE_VideoInit (_THIS, SDL_PixelFormat * vformat) 272 int BE_VideoInit(_THIS, SDL_PixelFormat * vformat)
273 { 273 {
274 display_mode *modes; 274 display_mode *modes;
275 uint32 i, nmodes; 275 uint32 i, nmodes;
276 int bpp; 276 int bpp;
277 BRect bounds; 277 BRect bounds;
278 278
279 /* Initialize the Be Application for appserver interaction */ 279 /* Initialize the Be Application for appserver interaction */
280 if (SDL_InitBeApp () < 0) { 280 if (SDL_InitBeApp() < 0) {
281 return (-1); 281 return (-1);
282 } 282 }
283 283
284 /* It is important that this be created after SDL_InitBeApp() */ 284 /* It is important that this be created after SDL_InitBeApp() */
285 BScreen bscreen; 285 BScreen bscreen;
286 286
287 /* Save the current display mode */ 287 /* Save the current display mode */
288 bscreen.GetMode (&saved_mode); 288 bscreen.GetMode(&saved_mode);
289 _this->info.current_w = saved_mode.virtual_width; 289 _this->info.current_w = saved_mode.virtual_width;
290 _this->info.current_h = saved_mode.virtual_height; 290 _this->info.current_h = saved_mode.virtual_height;
291 291
292 /* Determine the screen depth */ 292 /* Determine the screen depth */
293 vformat->BitsPerPixel = 293 vformat->BitsPerPixel =
294 ColorSpaceToBitsPerPixel (bscreen.ColorSpace ()); 294 ColorSpaceToBitsPerPixel(bscreen.ColorSpace());
295 if (vformat->BitsPerPixel == 0) { 295 if (vformat->BitsPerPixel == 0) {
296 SDL_SetError ("Unknown BScreen colorspace: 0x%x", 296 SDL_SetError("Unknown BScreen colorspace: 0x%x",
297 bscreen.ColorSpace ()); 297 bscreen.ColorSpace());
298 return (-1); 298 return (-1);
299 } 299 }
300 300
301 /* Get the video modes we can switch to in fullscreen mode */ 301 /* Get the video modes we can switch to in fullscreen mode */
302 bscreen.GetModeList (&modes, &nmodes); 302 bscreen.GetModeList(&modes, &nmodes);
303 SDL_qsort (modes, nmodes, sizeof *modes, CompareModes); 303 SDL_qsort(modes, nmodes, sizeof *modes, CompareModes);
304 for (i = 0; i < nmodes; ++i) { 304 for (i = 0; i < nmodes; ++i) {
305 bpp = ColorSpaceToBitsPerPixel (modes[i].space); 305 bpp = ColorSpaceToBitsPerPixel(modes[i].space);
306 //if ( bpp != 0 ) { // There are bugs in changing colorspace 306 //if ( bpp != 0 ) { // There are bugs in changing colorspace
307 if (modes[i].space == saved_mode.space) { 307 if (modes[i].space == saved_mode.space) {
308 BE_AddMode (_this, ((bpp + 7) / 8) - 1, 308 BE_AddMode(_this, ((bpp + 7) / 8) - 1,
309 modes[i].virtual_width, modes[i].virtual_height); 309 modes[i].virtual_width, modes[i].virtual_height);
310 } 310 }
311 } 311 }
312 312
313 /* Create the window and view */ 313 /* Create the window and view */
314 bounds.top = 0; 314 bounds.top = 0;
315 bounds.left = 0; 315 bounds.left = 0;
316 bounds.right = BEOS_HIDDEN_SIZE; 316 bounds.right = BEOS_HIDDEN_SIZE;
317 bounds.bottom = BEOS_HIDDEN_SIZE; 317 bounds.bottom = BEOS_HIDDEN_SIZE;
318 SDL_Win = new SDL_BWin (bounds); 318 SDL_Win = new SDL_BWin(bounds);
319 319
320 #if SDL_VIDEO_OPENGL 320 #if SDL_VIDEO_OPENGL
321 /* testgl application doesn't load library, just tries to load symbols */ 321 /* testgl application doesn't load library, just tries to load symbols */
322 /* is it correct? if so we have to load library here */ 322 /* is it correct? if so we have to load library here */
323 BE_GL_LoadLibrary (_this, NULL); 323 BE_GL_LoadLibrary(_this, NULL);
324 #endif 324 #endif
325 325
326 /* Create the clear cursor */ 326 /* Create the clear cursor */
327 SDL_BlankCursor = BE_CreateWMCursor (_this, blank_cdata, blank_cmask, 327 SDL_BlankCursor = BE_CreateWMCursor(_this, blank_cdata, blank_cmask,
328 BLANK_CWIDTH, BLANK_CHEIGHT, 328 BLANK_CWIDTH, BLANK_CHEIGHT,
329 BLANK_CHOTX, BLANK_CHOTY); 329 BLANK_CHOTX, BLANK_CHOTY);
330 330
331 /* Fill in some window manager capabilities */ 331 /* Fill in some window manager capabilities */
332 _this->info.wm_available = 1; 332 _this->info.wm_available = 1;
333 333
334 /* We're done! */ 334 /* We're done! */
335 return (0); 335 return (0);
336 } 336 }
337 337
338 /* We support any dimension at our bit-depth */ 338 /* We support any dimension at our bit-depth */
339 SDL_Rect **BE_ListModes (_THIS, SDL_PixelFormat * format, Uint32 flags) 339 SDL_Rect **BE_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
340 { 340 {
341 SDL_Rect **modes; 341 SDL_Rect **modes;
342 342
343 modes = ((SDL_Rect **) 0); 343 modes = ((SDL_Rect **) 0);
344 if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) { 344 if ((flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) {
350 } 350 }
351 return (modes); 351 return (modes);
352 } 352 }
353 353
354 /* Various screen update functions available */ 354 /* Various screen update functions available */
355 static void BE_NormalUpdate (_THIS, int numrects, SDL_Rect * rects); 355 static void BE_NormalUpdate(_THIS, int numrects, SDL_Rect * rects);
356 356
357 357
358 /* Find the closest display mode for fullscreen */ 358 /* Find the closest display mode for fullscreen */
359 static bool BE_FindClosestFSMode (_THIS, int width, int height, int bpp, 359 static bool BE_FindClosestFSMode(_THIS, int width, int height, int bpp,
360 display_mode * mode) 360 display_mode * mode)
361 { 361 {
362 BScreen bscreen; 362 BScreen bscreen;
363 uint32 i, nmodes; 363 uint32 i, nmodes;
364 SDL_Rect **modes; 364 SDL_Rect **modes;
365 display_mode *dmodes; 365 display_mode *dmodes;
366 display_mode current; 366 display_mode current;
367 float current_refresh; 367 float current_refresh;
368 bscreen.GetMode (&current); 368 bscreen.GetMode(&current);
369 current_refresh = (1000 * current.timing.pixel_clock) / 369 current_refresh = (1000 * current.timing.pixel_clock) /
370 (current.timing.h_total * current.timing.v_total); 370 (current.timing.h_total * current.timing.v_total);
371 371
372 modes = SDL_modelist[((bpp + 7) / 8) - 1]; 372 modes = SDL_modelist[((bpp + 7) / 8) - 1];
373 for (i = 0; modes[i] && (modes[i]->w > width) && 373 for (i = 0; modes[i] && (modes[i]->w > width) &&
377 if (!modes[i] || (modes[i]->w < width) || (modes[i]->h < width)) { 377 if (!modes[i] || (modes[i]->w < width) || (modes[i]->h < width)) {
378 --i; /* We went too far */ 378 --i; /* We went too far */
379 } 379 }
380 width = modes[i]->w; 380 width = modes[i]->w;
381 height = modes[i]->h; 381 height = modes[i]->h;
382 bscreen.GetModeList (&dmodes, &nmodes); 382 bscreen.GetModeList(&dmodes, &nmodes);
383 for (i = 0; i < nmodes; ++i) { 383 for (i = 0; i < nmodes; ++i) {
384 if ((bpp == ColorSpaceToBitsPerPixel (dmodes[i].space)) && 384 if ((bpp == ColorSpaceToBitsPerPixel(dmodes[i].space)) &&
385 (width == dmodes[i].virtual_width) && 385 (width == dmodes[i].virtual_width) &&
386 (height == dmodes[i].virtual_height)) { 386 (height == dmodes[i].virtual_height)) {
387 break; 387 break;
388 } 388 }
389 } 389 }
404 } else { 404 } else {
405 return false; 405 return false;
406 } 406 }
407 } 407 }
408 408
409 static int BE_SetFullScreen (_THIS, SDL_Surface * screen, int fullscreen) 409 static int BE_SetFullScreen(_THIS, SDL_Surface * screen, int fullscreen)
410 { 410 {
411 int was_fullscreen; 411 int was_fullscreen;
412 bool needs_unlock; 412 bool needs_unlock;
413 BScreen bscreen; 413 BScreen bscreen;
414 BRect bounds; 414 BRect bounds;
415 display_mode mode; 415 display_mode mode;
416 int width, height, bpp; 416 int width, height, bpp;
417 417
418 /* Set the fullscreen mode */ 418 /* Set the fullscreen mode */
419 was_fullscreen = SDL_Win->IsFullScreen (); 419 was_fullscreen = SDL_Win->IsFullScreen();
420 SDL_Win->SetFullScreen (fullscreen); 420 SDL_Win->SetFullScreen(fullscreen);
421 fullscreen = SDL_Win->IsFullScreen (); 421 fullscreen = SDL_Win->IsFullScreen();
422 422
423 width = screen->w; 423 width = screen->w;
424 height = screen->h; 424 height = screen->h;
425 425
426 /* Set the appropriate video mode */ 426 /* Set the appropriate video mode */
427 if (fullscreen) { 427 if (fullscreen) {
428 bpp = screen->format->BitsPerPixel; 428 bpp = screen->format->BitsPerPixel;
429 bscreen.GetMode (&mode); 429 bscreen.GetMode(&mode);
430 if ((bpp != ColorSpaceToBitsPerPixel (mode.space)) || 430 if ((bpp != ColorSpaceToBitsPerPixel(mode.space)) ||
431 (width != mode.virtual_width) || 431 (width != mode.virtual_width) ||
432 (height != mode.virtual_height)) { 432 (height != mode.virtual_height)) {
433 if (BE_FindClosestFSMode (_this, width, height, bpp, &mode)) { 433 if (BE_FindClosestFSMode(_this, width, height, bpp, &mode)) {
434 bscreen.SetMode (&mode); 434 bscreen.SetMode(&mode);
435 /* This simply stops the next resize event from being 435 /* This simply stops the next resize event from being
436 * sent to the SDL handler. 436 * sent to the SDL handler.
437 */ 437 */
438 SDL_Win->InhibitResize (); 438 SDL_Win->InhibitResize();
439 } else { 439 } else {
440 fullscreen = 0; 440 fullscreen = 0;
441 SDL_Win->SetFullScreen (fullscreen); 441 SDL_Win->SetFullScreen(fullscreen);
442 } 442 }
443 } 443 }
444 } 444 }
445 if (was_fullscreen && !fullscreen) { 445 if (was_fullscreen && !fullscreen) {
446 bscreen.SetMode (&saved_mode); 446 bscreen.SetMode(&saved_mode);
447 } 447 }
448 448
449 if (SDL_Win->Lock ()) { 449 if (SDL_Win->Lock()) {
450 int xoff, yoff; 450 int xoff, yoff;
451 if (SDL_Win->Shown ()) { 451 if (SDL_Win->Shown()) {
452 needs_unlock = 1; 452 needs_unlock = 1;
453 SDL_Win->Hide (); 453 SDL_Win->Hide();
454 } else { 454 } else {
455 needs_unlock = 0; 455 needs_unlock = 0;
456 } 456 }
457 /* This resizes the window and view area, but inhibits resizing 457 /* This resizes the window and view area, but inhibits resizing
458 * of the BBitmap due to the InhibitResize call above. Thus the 458 * of the BBitmap due to the InhibitResize call above. Thus the
459 * bitmap (pixel data) never changes. 459 * bitmap (pixel data) never changes.
460 */ 460 */
461 SDL_Win->ResizeTo (width, height); 461 SDL_Win->ResizeTo(width, height);
462 bounds = bscreen.Frame (); 462 bounds = bscreen.Frame();
463 /* Calculate offsets - used either to center window 463 /* Calculate offsets - used either to center window
464 * (windowed mode) or to set drawing offsets (fullscreen mode) 464 * (windowed mode) or to set drawing offsets (fullscreen mode)
465 */ 465 */
466 xoff = (bounds.IntegerWidth () - width) / 2; 466 xoff = (bounds.IntegerWidth() - width) / 2;
467 yoff = (bounds.IntegerHeight () - height) / 2; 467 yoff = (bounds.IntegerHeight() - height) / 2;
468 if (fullscreen) { 468 if (fullscreen) {
469 /* Set offset for drawing */ 469 /* Set offset for drawing */
470 SDL_Win->SetXYOffset (xoff, yoff); 470 SDL_Win->SetXYOffset(xoff, yoff);
471 } else { 471 } else {
472 /* Center window and reset the drawing offset */ 472 /* Center window and reset the drawing offset */
473 SDL_Win->SetXYOffset (0, 0); 473 SDL_Win->SetXYOffset(0, 0);
474 } 474 }
475 if (!needs_unlock || was_fullscreen) { 475 if (!needs_unlock || was_fullscreen) {
476 /* Center the window the first time */ 476 /* Center the window the first time */
477 SDL_Win->MoveTo (xoff > 0 ? (float) xoff : 0.0f, 477 SDL_Win->MoveTo(xoff > 0 ? (float) xoff : 0.0f,
478 yoff > 0 ? (float) yoff : 0.0f); 478 yoff > 0 ? (float) yoff : 0.0f);
479 } 479 }
480 SDL_Win->Show (); 480 SDL_Win->Show();
481 481
482 /* Unlock the window manually after the first Show() */ 482 /* Unlock the window manually after the first Show() */
483 if (needs_unlock) { 483 if (needs_unlock) {
484 SDL_Win->Unlock (); 484 SDL_Win->Unlock();
485 } 485 }
486 } 486 }
487 487
488 /* Set the fullscreen flag in the screen surface */ 488 /* Set the fullscreen flag in the screen surface */
489 if (fullscreen) { 489 if (fullscreen) {
492 screen->flags &= ~SDL_FULLSCREEN; 492 screen->flags &= ~SDL_FULLSCREEN;
493 } 493 }
494 return (1); 494 return (1);
495 } 495 }
496 496
497 static int BE_ToggleFullScreen (_THIS, int fullscreen) 497 static int BE_ToggleFullScreen(_THIS, int fullscreen)
498 { 498 {
499 return BE_SetFullScreen (_this, _this->screen, fullscreen); 499 return BE_SetFullScreen(_this, _this->screen, fullscreen);
500 } 500 }
501 501
502 /* FIXME: check return values and cleanup here */ 502 /* FIXME: check return values and cleanup here */
503 SDL_Surface *BE_SetVideoMode (_THIS, SDL_Surface * current, 503 SDL_Surface *BE_SetVideoMode(_THIS, SDL_Surface * current,
504 int width, int height, int bpp, 504 int width, int height, int bpp, Uint32 flags)
505 Uint32 flags)
506 { 505 {
507 BScreen bscreen; 506 BScreen bscreen;
508 BBitmap *bbitmap; 507 BBitmap *bbitmap;
509 BRect bounds; 508 BRect bounds;
510 Uint32 gl_flags = 0; 509 Uint32 gl_flags = 0;
526 || _this->gl_config.accum_blue_size > 0 525 || _this->gl_config.accum_blue_size > 0
527 || _this->gl_config.accum_alpha_size > 0) 526 || _this->gl_config.accum_alpha_size > 0)
528 gl_flags |= BGL_ACCUM; 527 gl_flags |= BGL_ACCUM;
529 528
530 /* Create the view for this window, using found flags */ 529 /* Create the view for this window, using found flags */
531 if (SDL_Win->CreateView (flags, gl_flags) < 0) { 530 if (SDL_Win->CreateView(flags, gl_flags) < 0) {
532 return (NULL); 531 return (NULL);
533 } 532 }
534 533
535 current->flags = 0; /* Clear flags */ 534 current->flags = 0; /* Clear flags */
536 current->w = width; 535 current->w = width;
537 current->h = height; 536 current->h = height;
538 SDL_Win->SetType (B_TITLED_WINDOW); 537 SDL_Win->SetType(B_TITLED_WINDOW);
539 if (flags & SDL_NOFRAME) { 538 if (flags & SDL_NOFRAME) {
540 current->flags |= SDL_NOFRAME; 539 current->flags |= SDL_NOFRAME;
541 SDL_Win->SetLook (B_NO_BORDER_WINDOW_LOOK); 540 SDL_Win->SetLook(B_NO_BORDER_WINDOW_LOOK);
542 } else { 541 } else {
543 if ((flags & SDL_RESIZABLE) && !(flags & SDL_INTERNALOPENGL)) { 542 if ((flags & SDL_RESIZABLE) && !(flags & SDL_INTERNALOPENGL)) {
544 current->flags |= SDL_RESIZABLE; 543 current->flags |= SDL_RESIZABLE;
545 /* We don't want opaque resizing (TM). :-) */ 544 /* We don't want opaque resizing (TM). :-) */
546 SDL_Win->SetFlags (B_OUTLINE_RESIZE); 545 SDL_Win->SetFlags(B_OUTLINE_RESIZE);
547 } else { 546 } else {
548 SDL_Win->SetFlags (B_NOT_RESIZABLE | B_NOT_ZOOMABLE); 547 SDL_Win->SetFlags(B_NOT_RESIZABLE | B_NOT_ZOOMABLE);
549 } 548 }
550 } 549 }
551 550
552 if (flags & SDL_INTERNALOPENGL) { 551 if (flags & SDL_INTERNALOPENGL) {
553 current->flags |= SDL_INTERNALOPENGL; 552 current->flags |= SDL_INTERNALOPENGL;
558 /* Create the BBitmap framebuffer */ 557 /* Create the BBitmap framebuffer */
559 bounds.top = 0; 558 bounds.top = 0;
560 bounds.left = 0; 559 bounds.left = 0;
561 bounds.right = width - 1; 560 bounds.right = width - 1;
562 bounds.bottom = height - 1; 561 bounds.bottom = height - 1;
563 bbitmap = new BBitmap (bounds, bscreen.ColorSpace ()); 562 bbitmap = new BBitmap(bounds, bscreen.ColorSpace());
564 if (!bbitmap->IsValid ()) { 563 if (!bbitmap->IsValid()) {
565 SDL_SetError ("Couldn't create screen bitmap"); 564 SDL_SetError("Couldn't create screen bitmap");
566 delete bbitmap; 565 delete bbitmap;
567 return (NULL); 566 return (NULL);
568 } 567 }
569 current->pitch = bbitmap->BytesPerRow (); 568 current->pitch = bbitmap->BytesPerRow();
570 current->pixels = (void *) bbitmap->Bits (); 569 current->pixels = (void *) bbitmap->Bits();
571 SDL_Win->SetBitmap (bbitmap); 570 SDL_Win->SetBitmap(bbitmap);
572 _this->UpdateRects = BE_NormalUpdate; 571 _this->UpdateRects = BE_NormalUpdate;
573 } 572 }
574 573
575 /* Set the correct fullscreen mode */ 574 /* Set the correct fullscreen mode */
576 BE_SetFullScreen (_this, current, flags & SDL_FULLSCREEN ? 1 : 0); 575 BE_SetFullScreen(_this, current, flags & SDL_FULLSCREEN ? 1 : 0);
577 576
578 /* We're done */ 577 /* We're done */
579 return (current); 578 return (current);
580 } 579 }
581 580
582 /* Update the current mouse state and position */ 581 /* Update the current mouse state and position */
583 void BE_UpdateMouse (_THIS) 582 void BE_UpdateMouse(_THIS)
584 { 583 {
585 BPoint point; 584 BPoint point;
586 uint32 buttons; 585 uint32 buttons;
587 586
588 if (SDL_Win->Lock ()) { 587 if (SDL_Win->Lock()) {
589 /* Get new input state, if still active */ 588 /* Get new input state, if still active */
590 if (SDL_Win->IsActive ()) { 589 if (SDL_Win->IsActive()) {
591 (SDL_Win->View ())->GetMouse (&point, &buttons, true); 590 (SDL_Win->View())->GetMouse(&point, &buttons, true);
592 } else { 591 } else {
593 point.x = -1; 592 point.x = -1;
594 point.y = -1; 593 point.y = -1;
595 } 594 }
596 SDL_Win->Unlock (); 595 SDL_Win->Unlock();
597 596
598 if ((point.x >= 0) && (point.x < SDL_VideoSurface->w) && 597 if ((point.x >= 0) && (point.x < SDL_VideoSurface->w) &&
599 (point.y >= 0) && (point.y < SDL_VideoSurface->h)) { 598 (point.y >= 0) && (point.y < SDL_VideoSurface->h)) {
600 SDL_PrivateAppActive (1, SDL_APPMOUSEFOCUS); 599 SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
601 SDL_PrivateMouseMotion (0, 0, 600 SDL_PrivateMouseMotion(0, 0,
602 (Sint16) point.x, (Sint16) point.y); 601 (Sint16) point.x, (Sint16) point.y);
603 } else { 602 } else {
604 SDL_PrivateAppActive (0, SDL_APPMOUSEFOCUS); 603 SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
605 } 604 }
606 } 605 }
607 } 606 }
608 607
609 /* We don't actually allow hardware surfaces other than the main one */ 608 /* We don't actually allow hardware surfaces other than the main one */
610 static int BE_AllocHWSurface (_THIS, SDL_Surface * surface) 609 static int BE_AllocHWSurface(_THIS, SDL_Surface * surface)
611 { 610 {
612 return (-1); 611 return (-1);
613 } 612 }
614 static void BE_FreeHWSurface (_THIS, SDL_Surface * surface) 613 static void BE_FreeHWSurface(_THIS, SDL_Surface * surface)
615 { 614 {
616 return; 615 return;
617 } 616 }
618 static int BE_LockHWSurface (_THIS, SDL_Surface * surface) 617 static int BE_LockHWSurface(_THIS, SDL_Surface * surface)
619 { 618 {
620 return (0); 619 return (0);
621 } 620 }
622 static void BE_UnlockHWSurface (_THIS, SDL_Surface * surface) 621 static void BE_UnlockHWSurface(_THIS, SDL_Surface * surface)
623 { 622 {
624 return; 623 return;
625 } 624 }
626 625
627 static void BE_NormalUpdate (_THIS, int numrects, SDL_Rect * rects) 626 static void BE_NormalUpdate(_THIS, int numrects, SDL_Rect * rects)
628 { 627 {
629 if (SDL_Win->BeginDraw ()) { 628 if (SDL_Win->BeginDraw()) {
630 int i; 629 int i;
631 630
632 for (i = 0; i < numrects; ++i) { 631 for (i = 0; i < numrects; ++i) {
633 BRect rect; 632 BRect rect;
634 633
635 rect.top = rects[i].y; 634 rect.top = rects[i].y;
636 rect.left = rects[i].x; 635 rect.left = rects[i].x;
637 rect.bottom = rect.top + rects[i].h - 1; 636 rect.bottom = rect.top + rects[i].h - 1;
638 rect.right = rect.left + rects[i].w - 1; 637 rect.right = rect.left + rects[i].w - 1;
639 SDL_Win->DrawAsync (rect); 638 SDL_Win->DrawAsync(rect);
640 } 639 }
641 SDL_Win->EndDraw (); 640 SDL_Win->EndDraw();
642 } 641 }
643 } 642 }
644 643
645 #if SDL_VIDEO_OPENGL 644 #if SDL_VIDEO_OPENGL
646 /* Passing a NULL path means load pointers from the application */ 645 /* Passing a NULL path means load pointers from the application */
647 int BE_GL_LoadLibrary (_THIS, const char *path) 646 int BE_GL_LoadLibrary(_THIS, const char *path)
648 { 647 {
649 if (path == NULL) { 648 if (path == NULL) {
650 if (_this->gl_config.dll_handle == NULL) { 649 if (_this->gl_config.dll_handle == NULL) {
651 image_info info; 650 image_info info;
652 int32 cookie = 0; 651 int32 cookie = 0;
653 while (get_next_image_info (0, &cookie, &info) == B_OK) { 652 while (get_next_image_info(0, &cookie, &info) == B_OK) {
654 void *location = NULL; 653 void *location = NULL;
655 if (get_image_symbol 654 if (get_image_symbol
656 ((image_id) cookie, "glBegin", 655 ((image_id) cookie, "glBegin",
657 B_SYMBOL_TYPE_ANY, &location) == B_OK) { 656 B_SYMBOL_TYPE_ANY, &location) == B_OK) {
658 _this->gl_config.dll_handle = (void *) cookie; 657 _this->gl_config.dll_handle = (void *) cookie;
659 _this->gl_config.driver_loaded = 1; 658 _this->gl_config.driver_loaded = 1;
660 SDL_strlcpy (_this->gl_config.driver_path, 659 SDL_strlcpy(_this->gl_config.driver_path,
661 "libGL.so", 660 "libGL.so",
662 SDL_arraysize (_this->gl_config. 661 SDL_arraysize(_this->gl_config.
663 driver_path)); 662 driver_path));
664 } 663 }
665 } 664 }
666 } 665 }
667 } else { 666 } else {
668 /* 667 /*
669 FIXME None of BeOS libGL.so implementations have exported functions 668 FIXME None of BeOS libGL.so implementations have exported functions
670 to load BGLView, which should be reloaded from new lib. 669 to load BGLView, which should be reloaded from new lib.
671 So for now just "load" linked libGL.so :( 670 So for now just "load" linked libGL.so :(
672 */ 671 */
673 if (_this->gl_config.dll_handle == NULL) { 672 if (_this->gl_config.dll_handle == NULL) {
674 return BE_GL_LoadLibrary (_this, NULL); 673 return BE_GL_LoadLibrary(_this, NULL);
675 } 674 }
676 675
677 /* Unload old first */ 676 /* Unload old first */
678 /*if (_this->gl_config.dll_handle != NULL) { */ 677 /*if (_this->gl_config.dll_handle != NULL) { */
679 /* Do not try to unload application itself (if LoadLibrary was called before with NULL ;) */ 678 /* Do not try to unload application itself (if LoadLibrary was called before with NULL ;) */
700 *_this->gl_config.driver_path = '\0'; 699 *_this->gl_config.driver_path = '\0';
701 return -1; 700 return -1;
702 } 701 }
703 } 702 }
704 703
705 void *BE_GL_GetProcAddress (_THIS, const char *proc) 704 void *BE_GL_GetProcAddress(_THIS, const char *proc)
706 { 705 {
707 if (_this->gl_config.dll_handle != NULL) { 706 if (_this->gl_config.dll_handle != NULL) {
708 void *location = NULL; 707 void *location = NULL;
709 status_t err; 708 status_t err;
710 if ((err = 709 if ((err =
711 get_image_symbol ((image_id) _this->gl_config.dll_handle, 710 get_image_symbol((image_id) _this->gl_config.dll_handle,
712 proc, B_SYMBOL_TYPE_ANY, 711 proc, B_SYMBOL_TYPE_ANY,
713 &location)) == B_OK) { 712 &location)) == B_OK) {
714 return location; 713 return location;
715 } else { 714 } else {
716 SDL_SetError ("Couldn't find OpenGL symbol"); 715 SDL_SetError("Couldn't find OpenGL symbol");
717 return NULL; 716 return NULL;
718 } 717 }
719 } else { 718 } else {
720 SDL_SetError ("OpenGL library not loaded"); 719 SDL_SetError("OpenGL library not loaded");
721 return NULL; 720 return NULL;
722 } 721 }
723 } 722 }
724 723
725 int BE_GL_GetAttribute (_THIS, SDL_GLattr attrib, int *value) 724 int BE_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value)
726 { 725 {
727 /* 726 /*
728 FIXME? Right now BE_GL_GetAttribute shouldn't be called between glBegin() and glEnd() - it doesn't use "cached" values 727 FIXME? Right now BE_GL_GetAttribute shouldn't be called between glBegin() and glEnd() - it doesn't use "cached" values
729 */ 728 */
730 switch (attrib) { 729 switch (attrib) {
731 case SDL_GL_RED_SIZE: 730 case SDL_GL_RED_SIZE:
732 glGetIntegerv (GL_RED_BITS, (GLint *) value); 731 glGetIntegerv(GL_RED_BITS, (GLint *) value);
733 break; 732 break;
734 case SDL_GL_GREEN_SIZE: 733 case SDL_GL_GREEN_SIZE:
735 glGetIntegerv (GL_GREEN_BITS, (GLint *) value); 734 glGetIntegerv(GL_GREEN_BITS, (GLint *) value);
736 break; 735 break;
737 case SDL_GL_BLUE_SIZE: 736 case SDL_GL_BLUE_SIZE:
738 glGetIntegerv (GL_BLUE_BITS, (GLint *) value); 737 glGetIntegerv(GL_BLUE_BITS, (GLint *) value);
739 break; 738 break;
740 case SDL_GL_ALPHA_SIZE: 739 case SDL_GL_ALPHA_SIZE:
741 glGetIntegerv (GL_ALPHA_BITS, (GLint *) value); 740 glGetIntegerv(GL_ALPHA_BITS, (GLint *) value);
742 break; 741 break;
743 case SDL_GL_DOUBLEBUFFER: 742 case SDL_GL_DOUBLEBUFFER:
744 glGetBooleanv (GL_DOUBLEBUFFER, (GLboolean *) value); 743 glGetBooleanv(GL_DOUBLEBUFFER, (GLboolean *) value);
745 break; 744 break;
746 case SDL_GL_BUFFER_SIZE: 745 case SDL_GL_BUFFER_SIZE:
747 int v; 746 int v;
748 glGetIntegerv (GL_RED_BITS, (GLint *) & v); 747 glGetIntegerv(GL_RED_BITS, (GLint *) & v);
749 *value = v; 748 *value = v;
750 glGetIntegerv (GL_GREEN_BITS, (GLint *) & v); 749 glGetIntegerv(GL_GREEN_BITS, (GLint *) & v);
751 *value += v; 750 *value += v;
752 glGetIntegerv (GL_BLUE_BITS, (GLint *) & v); 751 glGetIntegerv(GL_BLUE_BITS, (GLint *) & v);
753 *value += v; 752 *value += v;
754 glGetIntegerv (GL_ALPHA_BITS, (GLint *) & v); 753 glGetIntegerv(GL_ALPHA_BITS, (GLint *) & v);
755 *value += v; 754 *value += v;
756 break; 755 break;
757 case SDL_GL_DEPTH_SIZE: 756 case SDL_GL_DEPTH_SIZE:
758 glGetIntegerv (GL_DEPTH_BITS, (GLint *) value); /* Mesa creates 16 only? r5 always 32 */ 757 glGetIntegerv(GL_DEPTH_BITS, (GLint *) value); /* Mesa creates 16 only? r5 always 32 */
759 break; 758 break;
760 case SDL_GL_STENCIL_SIZE: 759 case SDL_GL_STENCIL_SIZE:
761 glGetIntegerv (GL_STENCIL_BITS, (GLint *) value); 760 glGetIntegerv(GL_STENCIL_BITS, (GLint *) value);
762 break; 761 break;
763 case SDL_GL_ACCUM_RED_SIZE: 762 case SDL_GL_ACCUM_RED_SIZE:
764 glGetIntegerv (GL_ACCUM_RED_BITS, (GLint *) value); 763 glGetIntegerv(GL_ACCUM_RED_BITS, (GLint *) value);
765 break; 764 break;
766 case SDL_GL_ACCUM_GREEN_SIZE: 765 case SDL_GL_ACCUM_GREEN_SIZE:
767 glGetIntegerv (GL_ACCUM_GREEN_BITS, (GLint *) value); 766 glGetIntegerv(GL_ACCUM_GREEN_BITS, (GLint *) value);
768 break; 767 break;
769 case SDL_GL_ACCUM_BLUE_SIZE: 768 case SDL_GL_ACCUM_BLUE_SIZE:
770 glGetIntegerv (GL_ACCUM_BLUE_BITS, (GLint *) value); 769 glGetIntegerv(GL_ACCUM_BLUE_BITS, (GLint *) value);
771 break; 770 break;
772 case SDL_GL_ACCUM_ALPHA_SIZE: 771 case SDL_GL_ACCUM_ALPHA_SIZE:
773 glGetIntegerv (GL_ACCUM_ALPHA_BITS, (GLint *) value); 772 glGetIntegerv(GL_ACCUM_ALPHA_BITS, (GLint *) value);
774 break; 773 break;
775 case SDL_GL_STEREO: 774 case SDL_GL_STEREO:
776 case SDL_GL_MULTISAMPLEBUFFERS: 775 case SDL_GL_MULTISAMPLEBUFFERS:
777 case SDL_GL_MULTISAMPLESAMPLES: 776 case SDL_GL_MULTISAMPLESAMPLES:
778 default: 777 default:
780 return (-1); 779 return (-1);
781 } 780 }
782 return 0; 781 return 0;
783 } 782 }
784 783
785 int BE_GL_MakeCurrent (_THIS) 784 int BE_GL_MakeCurrent(_THIS)
786 { 785 {
787 /* FIXME: should we glview->unlock and then glview->lock()? */ 786 /* FIXME: should we glview->unlock and then glview->lock()? */
788 return 0; 787 return 0;
789 } 788 }
790 789
791 void BE_GL_SwapBuffers (_THIS) 790 void BE_GL_SwapBuffers(_THIS)
792 { 791 {
793 SDL_Win->SwapBuffers (); 792 SDL_Win->SwapBuffers();
794 } 793 }
795 #endif 794 #endif
796 795
797 /* Is the system palette settable? */ 796 /* Is the system palette settable? */
798 int BE_SetColors (_THIS, int firstcolor, int ncolors, SDL_Color * colors) 797 int BE_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
799 { 798 {
800 int i; 799 int i;
801 SDL_Palette *palette; 800 SDL_Palette *palette;
802 const color_map *cmap = BScreen ().ColorMap (); 801 const color_map *cmap = BScreen().ColorMap();
803 802
804 /* Get the screen colormap */ 803 /* Get the screen colormap */
805 palette = _this->screen->format->palette; 804 palette = _this->screen->format->palette;
806 for (i = 0; i < 256; ++i) { 805 for (i = 0; i < 256; ++i) {
807 palette->colors[i].r = cmap->color_list[i].red; 806 palette->colors[i].r = cmap->color_list[i].red;
809 palette->colors[i].b = cmap->color_list[i].blue; 808 palette->colors[i].b = cmap->color_list[i].blue;
810 } 809 }
811 return (0); 810 return (0);
812 } 811 }
813 812
814 void BE_VideoQuit (_THIS) 813 void BE_VideoQuit(_THIS)
815 { 814 {
816 int i, j; 815 int i, j;
817 816
818 SDL_Win->Quit (); 817 SDL_Win->Quit();
819 SDL_Win = NULL; 818 SDL_Win = NULL;
820 819
821 if (SDL_BlankCursor != NULL) { 820 if (SDL_BlankCursor != NULL) {
822 BE_FreeWMCursor (_this, SDL_BlankCursor); 821 BE_FreeWMCursor(_this, SDL_BlankCursor);
823 SDL_BlankCursor = NULL; 822 SDL_BlankCursor = NULL;
824 } 823 }
825 for (i = 0; i < NUM_MODELISTS; ++i) { 824 for (i = 0; i < NUM_MODELISTS; ++i) {
826 if (SDL_modelist[i]) { 825 if (SDL_modelist[i]) {
827 for (j = 0; SDL_modelist[i][j]; ++j) { 826 for (j = 0; SDL_modelist[i][j]; ++j) {
828 SDL_free (SDL_modelist[i][j]); 827 SDL_free(SDL_modelist[i][j]);
829 } 828 }
830 SDL_free (SDL_modelist[i]); 829 SDL_free(SDL_modelist[i]);
831 SDL_modelist[i] = NULL; 830 SDL_modelist[i] = NULL;
832 } 831 }
833 } 832 }
834 /* Restore the original video mode */ 833 /* Restore the original video mode */
835 if (_this->screen) { 834 if (_this->screen) {
836 if ((_this->screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) { 835 if ((_this->screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) {
837 BScreen bscreen; 836 BScreen bscreen;
838 bscreen.SetMode (&saved_mode); 837 bscreen.SetMode(&saved_mode);
839 } 838 }
840 _this->screen->pixels = NULL; 839 _this->screen->pixels = NULL;
841 } 840 }
842 #if SDL_VIDEO_OPENGL 841 #if SDL_VIDEO_OPENGL
843 if (_this->gl_config.dll_handle != NULL) 842 if (_this->gl_config.dll_handle != NULL)
844 unload_add_on ((image_id) _this->gl_config.dll_handle); 843 unload_add_on((image_id) _this->gl_config.dll_handle);
845 #endif 844 #endif
846 845
847 SDL_QuitBeApp (); 846 SDL_QuitBeApp();
848 } 847 }
849 848
850 }; /* Extern C */ 849 }; /* Extern C */
851 850
852 /* vi: set ts=4 sw=4 expandtab: */ 851 /* vi: set ts=4 sw=4 expandtab: */