summaryrefslogtreecommitdiff
path: root/zwgc/xerror.c
diff options
context:
space:
mode:
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);
+}