summaryrefslogtreecommitdiff
path: root/zwgc/xerror.c
diff options
context:
space:
mode:
authorGravatar Marc Horowitz <marc@mit.edu>1989-11-13 19:55:48 +0000
committerGravatar Marc Horowitz <marc@mit.edu>1989-11-13 19:55:48 +0000
commit0746b026f03939800e25e1f5d00810a165afe72d (patch)
tree9845c7d2d5cdcce2efd62b53ebbbf7dda38cedf8 /zwgc/xerror.c
parent05bb0c93268b1cc3d18dcbb2757412197983f0a3 (diff)
Initial revision
Diffstat (limited to 'zwgc/xerror.c')
-rw-r--r--zwgc/xerror.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/zwgc/xerror.c b/zwgc/xerror.c
new file mode 100644
index 0000000..974d2c8
--- /dev/null
+++ b/zwgc/xerror.c
@@ -0,0 +1,47 @@
+/* This file is part of the Project Athena Zephyr Notification System.
+ * It is one of the source files comprising zwgc, the Zephyr WindowGram
+ * client.
+ *
+ * Created by: Marc Horowitz <marc@athena.mit.edu>
+ *
+ * $Source$
+ * $Author$
+ *
+ * Copyright (c) 1989 by the Massachusetts Institute of Technology.
+ * For copying and distribution information, see the file
+ * "mit-copyright.h".
+ */
+
+#if (!defined(lint) && !defined(SABER))
+static char rcsid_xerror_c[] = "$Id$";
+#endif
+
+#include <zephyr/mit-copyright.h>
+
+#include <X11/Xlib.h>
+#include <stdio.h>
+#include "mux.h"
+
+int xerror_happened;
+
+/*ARGSUSED*/
+static int xerrortrap(dpy,xerrev)
+ Display *dpy;
+ XErrorEvent *xerrev;
+{
+ xerror_happened = 1;
+}
+
+void begin_xerror_trap(dpy)
+ Display *dpy;
+{
+ xerror_happened = 0;
+ XSetErrorHandler(xerrortrap);
+}
+
+void end_xerror_trap(dpy)
+ Display *dpy;
+{
+ XSync(dpy,False);
+ XSetErrorHandler(NULL);
+}