comparison src/video/x11/SDL_x11gl.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents e94b0d7c33bc
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
18 18
19 Sam Lantinga 19 Sam Lantinga
20 slouken@libsdl.org 20 slouken@libsdl.org
21 */ 21 */
22 22
23 #include <stdlib.h> /* For getenv() prototype */ 23 #include <stdlib.h> /* For SDL_getenv() prototype */
24 #include <string.h> 24 #include <string.h>
25 25
26 #include "SDL_events_c.h" 26 #include "SDL_events_c.h"
27 #include "SDL_error.h" 27 #include "SDL_error.h"
28 #include "SDL_x11video.h" 28 #include "SDL_x11video.h"
139 attribs[i++] = GLX_SAMPLES_ARB; 139 attribs[i++] = GLX_SAMPLES_ARB;
140 attribs[i++] = this->gl_config.multisamplesamples; 140 attribs[i++] = this->gl_config.multisamplesamples;
141 } 141 }
142 142
143 #ifdef GLX_DIRECT_COLOR /* Try for a DirectColor visual for gamma support */ 143 #ifdef GLX_DIRECT_COLOR /* Try for a DirectColor visual for gamma support */
144 if ( !getenv("SDL_VIDEO_X11_NODIRECTCOLOR") ) { 144 if ( !SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR") ) {
145 attribs[i++] = GLX_X_VISUAL_TYPE; 145 attribs[i++] = GLX_X_VISUAL_TYPE;
146 attribs[i++] = GLX_DIRECT_COLOR; 146 attribs[i++] = GLX_DIRECT_COLOR;
147 } 147 }
148 #endif 148 #endif
149 attribs[i++] = None; 149 attribs[i++] = None;
150 150
151 glx_visualinfo = this->gl_data->glXChooseVisual(GFX_Display, 151 glx_visualinfo = this->gl_data->glXChooseVisual(GFX_Display,
152 SDL_Screen, attribs); 152 SDL_Screen, attribs);
153 #ifdef GLX_DIRECT_COLOR 153 #ifdef GLX_DIRECT_COLOR
154 if( !glx_visualinfo && !getenv("SDL_VIDEO_X11_NODIRECTCOLOR") ) { /* No DirectColor visual? Try again.. */ 154 if( !glx_visualinfo && !SDL_getenv("SDL_VIDEO_X11_NODIRECTCOLOR") ) { /* No DirectColor visual? Try again.. */
155 attribs[i-3] = None; 155 attribs[i-3] = None;
156 glx_visualinfo = this->gl_data->glXChooseVisual(GFX_Display, 156 glx_visualinfo = this->gl_data->glXChooseVisual(GFX_Display,
157 SDL_Screen, attribs); 157 SDL_Screen, attribs);
158 } 158 }
159 #endif 159 #endif
387 SDL_SetError("OpenGL context already created"); 387 SDL_SetError("OpenGL context already created");
388 return -1; 388 return -1;
389 } 389 }
390 390
391 if ( path == NULL ) { 391 if ( path == NULL ) {
392 path = getenv("SDL_VIDEO_GL_DRIVER"); 392 path = SDL_getenv("SDL_VIDEO_GL_DRIVER");
393 if ( path == NULL ) { 393 if ( path == NULL ) {
394 path = DEFAULT_OPENGL; 394 path = DEFAULT_OPENGL;
395 } 395 }
396 } 396 }
397 397
452 } 452 }
453 453
454 this->gl_config.dll_handle = handle; 454 this->gl_config.dll_handle = handle;
455 this->gl_config.driver_loaded = 1; 455 this->gl_config.driver_loaded = 1;
456 if ( path ) { 456 if ( path ) {
457 strncpy(this->gl_config.driver_path, path, 457 SDL_strncpy(this->gl_config.driver_path, path,
458 sizeof(this->gl_config.driver_path)-1); 458 sizeof(this->gl_config.driver_path)-1);
459 } else { 459 } else {
460 strcpy(this->gl_config.driver_path, ""); 460 SDL_strcpy(this->gl_config.driver_path, "");
461 } 461 }
462 return 0; 462 return 0;
463 } 463 }
464 464
465 void *X11_GL_GetProcAddress(_THIS, const char* proc) 465 void *X11_GL_GetProcAddress(_THIS, const char* proc)
474 } 474 }
475 #if defined(__OpenBSD__) && !defined(__ELF__) 475 #if defined(__OpenBSD__) && !defined(__ELF__)
476 #undef do_dlsym 476 #undef do_dlsym
477 #endif 477 #endif
478 retval = do_dlsym(handle, proc); 478 retval = do_dlsym(handle, proc);
479 if (!retval && strlen(proc) <= 1022) { 479 if (!retval && SDL_strlen(proc) <= 1022) {
480 procname[0] = '_'; 480 procname[0] = '_';
481 strcpy(procname + 1, proc); 481 SDL_strcpy(procname + 1, proc);
482 retval = do_dlsym(handle, procname); 482 retval = do_dlsym(handle, procname);
483 } 483 }
484 return retval; 484 return retval;
485 } 485 }
486 486