struct x_error_message_stack {
char string[X_ERROR_MESSAGE_SIZE];
Display *dpy;
+ x_special_error_handler handler;
+ void *handler_data;
struct x_error_message_stack *prev;
};
static struct x_error_message_stack *x_error_message;
XGetErrorText (display, event->error_code,
x_error_message->string,
X_ERROR_MESSAGE_SIZE);
+ if (x_error_message->handler)
+ x_error_message->handler (display, event, x_error_message->string,
+ x_error_message->handler_data);
}
/* Begin trapping X errors for display DPY. Actually we trap X errors
x_had_errors_p or x_check_errors. */
void
-x_catch_errors (Display *dpy)
+x_catch_errors_with_handler (Display *dpy, x_special_error_handler handler,
+ void *handler_data)
{
struct x_error_message_stack *data = xmalloc (sizeof *data);
data->dpy = dpy;
data->string[0] = 0;
+ data->handler = handler;
+ data->handler_data = handler_data;
data->prev = x_error_message;
x_error_message = data;
}
+void
+x_catch_errors (Display *dpy)
+{
+ x_catch_errors_with_handler (dpy, NULL, NULL);
+}
+
/* Undo the last x_catch_errors call.
DPY should be the display that was passed to x_catch_errors.
/* Defined in xterm.c */
+typedef void (*x_special_error_handler)(Display *, XErrorEvent *, char *,
+ void *);
+
extern bool x_text_icon (struct frame *, const char *);
extern void x_catch_errors (Display *);
+extern void x_catch_errors_with_handler (Display *, x_special_error_handler,
+ void *);
extern void x_check_errors (Display *, const char *)
ATTRIBUTE_FORMAT_PRINTF (2, 0);
extern bool x_had_errors_p (Display *);