]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blob - zephyr/zwgc/xerror.c
33e389a7c4c6c53437ec89a37c488172879b301b
[1ts-debian.git] / zephyr / zwgc / xerror.c
1 /* This file is part of the Project Athena Zephyr Notification System.
2  * It is one of the source files comprising zwgc, the Zephyr WindowGram
3  * client.
4  *
5  *      Created by:     Marc Horowitz <marc@athena.mit.edu>
6  *
7  *      $Id$
8  *
9  *      Copyright (c) 1989 by the Massachusetts Institute of Technology.
10  *      For copying and distribution information, see the file
11  *      "mit-copyright.h".
12  */
13
14 #include <sysdep.h>
15
16 #if (!defined(lint) && !defined(SABER))
17 static const char rcsid_xerror_c[] = "$Id$";
18 #endif
19
20 #include <zephyr/mit-copyright.h>
21
22 #ifndef X_DISPLAY_MISSING
23
24 #include <X11/Xlib.h>
25 #include "mux.h"
26
27 int xerror_happened;
28
29 /*ARGSUSED*/
30 static int xerrortrap(dpy,xerrev)
31      Display *dpy;
32      XErrorEvent *xerrev;
33 {
34    xerror_happened = 1;
35    return 0;
36 }
37
38 /*ARGSUSED*/
39 void begin_xerror_trap(dpy)
40      Display *dpy;
41 {
42    xerror_happened = 0;
43    XSetErrorHandler(xerrortrap);
44 }
45
46 void end_xerror_trap(dpy)
47      Display *dpy;
48 {
49    XSync(dpy,False);
50    XSetErrorHandler(NULL);
51 }
52
53 #endif
54