# HG changeset patch # User alex # Date 1013949269 0 # Node ID a3468234709018579c96f7431af1e5013e7aec29 # Parent d3a52470594cad61232a1d84370929f43df56b30 added local X11 error handler (call player_exit) diff -r d3a52470594c -r a34682347090 libvo/x11_common.c --- a/libvo/x11_common.c Sun Feb 17 12:22:01 2002 +0000 +++ b/libvo/x11_common.c Sun Feb 17 12:34:29 2002 +0000 @@ -135,6 +135,26 @@ } #endif +static void x11_errorhandler(Display *display, XErrorEvent *event) +{ +#define MSGLEN 60 + char msg[MSGLEN]; + + XGetErrorText(display, event->error_code, &msg, MSGLEN); + + printf("X11 error: %s\n", msg); + + if (verbose) + { + printf("Type: %x, display: %x, resourceid: %x, serial: %x\n", + event->type, event->display, event->resourceid, event->serial); + printf("Error code: %x, request code: %x, minor code: %x\n", + event->error_code, event->request_code, event->minor_code); + } + + exit_player("X11 error"); +#undef MSGLEN +} int vo_init( void ) { @@ -240,6 +260,9 @@ vo_screenwidth,vo_screenheight, depth, vo_depthonscreen, mDisplayName,mLocalDisplay?"local":"remote"); + + XSetErrorHandler(x11_errorhandler); + return 1; } @@ -387,6 +410,8 @@ int vo_x11_uninit(Display *display, Window window) { + XSetErrorHandler(NULL); + #ifdef HAVE_NEW_GUI /* destroy window only if it's not controlled by GUI */ if (vo_window == None)