Search code examples
error-handlingxlib

How to make Xlib print error message, but not exit?


"The action of the default handlers is to print an explanatory message and exit." (link)

Example of such message:

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  12 (X_ConfigureWindow)
  Resource id in failed request:  0xc0007a
  Serial number of failed request:  140
  Current serial number in output stream:  141

If I set (XSetErrorHandler) my own "ignore everything" error handler, the "explanatory messages" disappear.

How to make Xlib ignore errors, but still print error messages?


Solution

  • You have to format your own message. The contents of the message is the contents of the XErrorEvent struct:

    http://tronche.com/gui/x/xlib/event-handling/protocol-errors/default-handlers.html