HPlogo HP Xlib Extensions: > Chapter 3 Support for Multiple Error Handlers

Introduction

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

To establish multiple error handling routines for a single process (up to one routine per connection to the server), use XHPSetErrorHandler as follows:

#include <X11/XHPlib.h>

typedef int (*PFI) ();

PFI XHPSetErrorHandler(display, routine)
Display *display;
int (*routine) ();

int routine(display, error)
Display *display;
XErrorEvent *error;

This function registers with Xlib the address of a routine to handle X errors. It is intended to be used by libraries and drivers that wish to establish an error handing routine without interfering with any error handling routine that may have been established by the client program.

XHPSetErrorHandler records one error handling routine per connection to the server. Therefore, for a library or driver to set up its own error handling routine without affecting that of the client, the library or driver must first have established its own connection to the server via XOpenDisplay.

When an XErrorEvent is received by the client, which error handling routine is invoked is determined by the display associated with the error. If the display matches that associated with a driver error handling routine, that error handling routine is invoked. If it does not match any driver routine, the error handling routine established by the client, if any exists, is invoked. Otherwise, the default Xlib error handler is invoked.

XHPSetErrorHandler returns the address of the previously established error handler. If that error handler was the default error handler, NULL is returned.

A driver or library may remove its error handler by invoking XHPSetErrorHandler with a NULL error handling routine.

© 1995 Hewlett-Packard Development Company, L.P.