diff options
author | alex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-02-17 12:34:29 +0000 |
---|---|---|
committer | alex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-02-17 12:34:29 +0000 |
commit | 12a6e7927e63b3607ef912799d31c81d329c73ae (patch) | |
tree | 1d2113e71701fc5bbee21df2a01e3126f5ba5380 /libvo | |
parent | 0a83c6ec7bfeef0f53c6e891fcb5788d9fe88ed6 (diff) |
added local X11 error handler (call player_exit)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4743 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/x11_common.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libvo/x11_common.c b/libvo/x11_common.c index e5e5b498d4..6b04756aaf 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -135,6 +135,26 @@ int vo_find_depth_from_visuals(Display *dpy, int screen, Visual **visual_return) } #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 @@ int vo_init( void ) vo_screenwidth,vo_screenheight, depth, vo_depthonscreen, mDisplayName,mLocalDisplay?"local":"remote"); + + XSetErrorHandler(x11_errorhandler); + return 1; } @@ -387,6 +410,8 @@ void vo_x11_classhint( Display * display,Window window,char *name ){ 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) |