comparison src/video/x11/SDL_x11video.c @ 1248:d2c6881935be

Catch X11 extension errors...since most of these are notifications that we queried for a missing extension (such as the XiG vidmode one that most people don't have), and default Xlib behaviour is to write notification to stderr, this tends to generate incorrect bug reports. Since we'll actually deal with the missing extension when querying for it, we ignore these errors in our hook. The rest continue to pass through to the default handler. Fixes Bugzilla #42. --ryan.
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 14 Jan 2006 08:15:38 +0000
parents aac47040c6d7
children 2bf9dda618e5
comparison
equal deleted inserted replaced
1247:ff73ee89ff4b 1248:d2c6881935be
218 (((e->error_code == BadRequest)&&(e->request_code == vm_error)) || 218 (((e->error_code == BadRequest)&&(e->request_code == vm_error)) ||
219 ((e->error_code > vm_error) && 219 ((e->error_code > vm_error) &&
220 (e->error_code <= (vm_error+XF86VidModeNumberErrors)))) ) { 220 (e->error_code <= (vm_error+XF86VidModeNumberErrors)))) ) {
221 #ifdef XFREE86_DEBUG 221 #ifdef XFREE86_DEBUG
222 { char errmsg[1024]; 222 { char errmsg[1024];
223 XGetErrorText(d, e->error_code, errmsg, sizeof(errmsg)); 223 pXGetErrorText(d, e->error_code, errmsg, sizeof(errmsg));
224 printf("VidMode error: %s\n", errmsg); 224 printf("VidMode error: %s\n", errmsg);
225 } 225 }
226 #endif 226 #endif
227 return(0); 227 return(0);
228 } 228 }
233 if ( (dga_error >= 0) && 233 if ( (dga_error >= 0) &&
234 ((e->error_code > dga_error) && 234 ((e->error_code > dga_error) &&
235 (e->error_code <= (dga_error+XF86DGANumberErrors))) ) { 235 (e->error_code <= (dga_error+XF86DGANumberErrors))) ) {
236 #ifdef XFREE86_DEBUG 236 #ifdef XFREE86_DEBUG
237 { char errmsg[1024]; 237 { char errmsg[1024];
238 XGetErrorText(d, e->error_code, errmsg, sizeof(errmsg)); 238 pXGetErrorText(d, e->error_code, errmsg, sizeof(errmsg));
239 printf("DGA error: %s\n", errmsg); 239 printf("DGA error: %s\n", errmsg);
240 } 240 }
241 #endif 241 #endif
242 return(0); 242 return(0);
243 } 243 }
258 } 258 }
259 current_video->hidden->X11_Display = NULL; 259 current_video->hidden->X11_Display = NULL;
260 260
261 /* Continue with the standard X11 error handler */ 261 /* Continue with the standard X11 error handler */
262 return(XIO_handler(d)); 262 return(XIO_handler(d));
263 }
264
265 static int (*Xext_handler)(Display *,char *,char *) = NULL;
266 static int xext_errhandler(Display *d, char *ext_name, char *reason)
267 {
268 #ifdef XFREE86_DEBUG
269 printf("Xext error inside SDL (may be harmless):\n");
270 printf(" Extension \"%s\" %s on display \"%s\".\n",
271 ext_name, reason, pXDisplayString(d));
272 #endif
273
274 if (strcmp(reason, "missing") == 0) {
275 /*
276 * Since the query itself, elsewhere, can handle a missing extension
277 * and the default behaviour in Xlib is to write to stderr, which
278 * generates unnecessary bug reports, we just ignore these.
279 */
280 return 0;
281 }
282
283 /* Everything else goes to the default handler... */
284 return Xext_handler(d, ext_name, reason);
263 } 285 }
264 286
265 /* Create auxiliary (toplevel) windows with the current visual */ 287 /* Create auxiliary (toplevel) windows with the current visual */
266 static void create_aux_windows(_THIS) 288 static void create_aux_windows(_THIS)
267 { 289 {
435 /* Set the normal X error handler */ 457 /* Set the normal X error handler */
436 X_handler = pXSetErrorHandler(x_errhandler); 458 X_handler = pXSetErrorHandler(x_errhandler);
437 459
438 /* Set the error handler if we lose the X display */ 460 /* Set the error handler if we lose the X display */
439 XIO_handler = pXSetIOErrorHandler(xio_errhandler); 461 XIO_handler = pXSetIOErrorHandler(xio_errhandler);
462
463 /* Set the X extension error handler */
464 Xext_handler = pXSetExtensionErrorHandler(xext_errhandler);
440 465
441 /* use default screen (from $DISPLAY) */ 466 /* use default screen (from $DISPLAY) */
442 SDL_Screen = DefaultScreen(SDL_Display); 467 SDL_Screen = DefaultScreen(SDL_Display);
443 468
444 #ifndef NO_SHARED_MEMORY 469 #ifndef NO_SHARED_MEMORY