00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 #include "mit-copyright.h"
00010 
00011 #ifndef X_DISPLAY_MISSING
00012 
00013 #include <X11/Xlib.h>
00014 #include "mux.h"
00015 
00016 int xerror_happened;
00017 
00018 
00019 static int 
00020 xerrortrap(dpy, xerrev)
00021         Display *dpy;
00022         XErrorEvent *xerrev;
00023 {
00024         xerror_happened = 1;
00025         return (1);
00026 }
00027 
00028 
00029 void 
00030 begin_xerror_trap(dpy)
00031         Display *dpy;
00032 {
00033         xerror_happened = 0;
00034         XSetErrorHandler(xerrortrap);
00035 }
00036 
00037 void 
00038 end_xerror_trap(dpy)
00039         Display *dpy;
00040 {
00041         XSync(dpy, False);
00042         XSetErrorHandler(NULL);
00043 }
00044 
00045 #endif