[Mplayer-cvslog] CVS: main/libvo x11_common.c,1.48,1.49
Alex Beregszaszi
alex at mplayer.dev.hu
Sun Feb 17 13:34:32 CET 2002
Update of /cvsroot/mplayer/main/libvo
In directory mplayer:/var/tmp.root/cvs-serv30163
Modified Files:
x11_common.c
Log Message:
added local X11 error handler (call player_exit)
Index: x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- x11_common.c 11 Feb 2002 11:44:50 -0000 1.48
+++ x11_common.c 17 Feb 2002 12:34:29 -0000 1.49
@@ -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)
More information about the MPlayer-cvslog
mailing list