]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blob - zephyr/zwgc/xerror.c
r4264@bucket (orig r254): kcr | 2008-01-20 22:11:44 -0500
[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
31 xerrortrap(Display *dpy,
32            XErrorEvent *xerrev)
33 {
34    xerror_happened = 1;
35    return 0;
36 }
37
38 /*ARGSUSED*/
39 void
40 begin_xerror_trap(Display *dpy)
41 {
42    xerror_happened = 0;
43    XSetErrorHandler(xerrortrap);
44 }
45
46 void
47 end_xerror_trap(Display *dpy)
48 {
49    XSync(dpy,False);
50    XSetErrorHandler(NULL);
51 }
52
53 #endif
54