comparison src/video/x11/SDL_x11gl.c @ 1575:3ba88cb7eb1b

Updated dynamic X11 code. See details in Bugzilla #170.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 22 Mar 2006 05:00:59 +0000
parents d910939febfa
children d75c2d78e87d
comparison
equal deleted inserted replaced
1574:0fd72308659e 1575:3ba88cb7eb1b
62 if ( SDL_windowid ) { 62 if ( SDL_windowid ) {
63 XWindowAttributes a; 63 XWindowAttributes a;
64 XVisualInfo vi_in; 64 XVisualInfo vi_in;
65 int out_count; 65 int out_count;
66 66
67 pXGetWindowAttributes(SDL_Display, SDL_Window, &a); 67 XGetWindowAttributes(SDL_Display, SDL_Window, &a);
68 vi_in.screen = SDL_Screen; 68 vi_in.screen = SDL_Screen;
69 vi_in.visualid = pXVisualIDFromVisual(a.visual); 69 vi_in.visualid = XVisualIDFromVisual(a.visual);
70 glx_visualinfo = pXGetVisualInfo(SDL_Display, 70 glx_visualinfo = XGetVisualInfo(SDL_Display,
71 VisualScreenMask|VisualIDMask, &vi_in, &out_count); 71 VisualScreenMask|VisualIDMask, &vi_in, &out_count);
72 return glx_visualinfo; 72 return glx_visualinfo;
73 } 73 }
74 74
75 /* Setup our GLX attributes according to the gl_config. */ 75 /* Setup our GLX attributes according to the gl_config. */
184 attributes.background_pixel = black; 184 attributes.background_pixel = black;
185 attributes.border_pixel = black; 185 attributes.border_pixel = black;
186 attributes.colormap = SDL_XColorMap; 186 attributes.colormap = SDL_XColorMap;
187 mask = CWBackPixel | CWBorderPixel | CWColormap; 187 mask = CWBackPixel | CWBorderPixel | CWColormap;
188 188
189 SDL_Window = pXCreateWindow(SDL_Display, WMwindow, 189 SDL_Window = XCreateWindow(SDL_Display, WMwindow,
190 0, 0, w, h, 0, glx_visualinfo->depth, 190 0, 0, w, h, 0, glx_visualinfo->depth,
191 InputOutput, glx_visualinfo->visual, 191 InputOutput, glx_visualinfo->visual,
192 mask, &attributes); 192 mask, &attributes);
193 if ( !SDL_Window ) { 193 if ( !SDL_Window ) {
194 SDL_SetError("Could not create window"); 194 SDL_SetError("Could not create window");
205 int X11_GL_CreateContext(_THIS) 205 int X11_GL_CreateContext(_THIS)
206 { 206 {
207 int retval; 207 int retval;
208 #if SDL_VIDEO_OPENGL_GLX 208 #if SDL_VIDEO_OPENGL_GLX
209 /* We do this to create a clean separation between X and GLX errors. */ 209 /* We do this to create a clean separation between X and GLX errors. */
210 pXSync( SDL_Display, False ); 210 XSync( SDL_Display, False );
211 glx_context = this->gl_data->glXCreateContext(GFX_Display, 211 glx_context = this->gl_data->glXCreateContext(GFX_Display,
212 glx_visualinfo, NULL, True); 212 glx_visualinfo, NULL, True);
213 pXSync( GFX_Display, False ); 213 XSync( GFX_Display, False );
214 214
215 if (glx_context == NULL) { 215 if (glx_context == NULL) {
216 SDL_SetError("Could not create GL context"); 216 SDL_SetError("Could not create GL context");
217 return -1; 217 return -1;
218 } 218 }
256 if ( ! this->gl_data->glXMakeCurrent(GFX_Display, 256 if ( ! this->gl_data->glXMakeCurrent(GFX_Display,
257 SDL_Window, glx_context) ) { 257 SDL_Window, glx_context) ) {
258 SDL_SetError("Unable to make GL context current"); 258 SDL_SetError("Unable to make GL context current");
259 retval = -1; 259 retval = -1;
260 } 260 }
261 pXSync( GFX_Display, False ); 261 XSync( GFX_Display, False );
262 262
263 /* More Voodoo X server workarounds... Grr... */ 263 /* More Voodoo X server workarounds... Grr... */
264 SDL_Lock_EventThread(); 264 SDL_Lock_EventThread();
265 X11_CheckDGAMouse(this); 265 X11_CheckDGAMouse(this);
266 SDL_Unlock_EventThread(); 266 SDL_Unlock_EventThread();