|
Packit |
5bd3a9 |
/*
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
Copyright 1986, 1998 The Open Group
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
Permission to use, copy, modify, distribute, and sell this software and its
|
|
Packit |
5bd3a9 |
documentation for any purpose is hereby granted without fee, provided that
|
|
Packit |
5bd3a9 |
the above copyright notice appear in all copies and that both that
|
|
Packit |
5bd3a9 |
copyright notice and this permission notice appear in supporting
|
|
Packit |
5bd3a9 |
documentation.
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
The above copyright notice and this permission notice shall be included in
|
|
Packit |
5bd3a9 |
all copies or substantial portions of the Software.
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
Packit |
5bd3a9 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
Packit |
5bd3a9 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
Packit |
5bd3a9 |
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
Packit |
5bd3a9 |
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
Packit |
5bd3a9 |
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
Except as contained in this notice, the name of The Open Group shall not be
|
|
Packit |
5bd3a9 |
used in advertising or otherwise to promote the sale, use or other dealings
|
|
Packit |
5bd3a9 |
in this Software without prior written authorization from The Open Group.
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
*/
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
#ifdef HAVE_CONFIG_H
|
|
Packit |
5bd3a9 |
#include <config.h>
|
|
Packit |
5bd3a9 |
#endif
|
|
Packit |
5bd3a9 |
#include "Xlibint.h"
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
/*
|
|
Packit |
5bd3a9 |
* XErrorHandler - This procedure sets the X non-fatal error handler
|
|
Packit |
5bd3a9 |
* (_XErrorFunction) to be the specified routine. If NULL is passed in
|
|
Packit |
5bd3a9 |
* the original error handler is restored.
|
|
Packit |
5bd3a9 |
*/
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
XErrorHandler
|
|
Packit |
5bd3a9 |
XSetErrorHandler(XErrorHandler handler)
|
|
Packit |
5bd3a9 |
{
|
|
Packit |
5bd3a9 |
int (*oldhandler)(Display *dpy, XErrorEvent *event);
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
_XLockMutex(_Xglobal_lock);
|
|
Packit |
5bd3a9 |
oldhandler = _XErrorFunction;
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
if (!oldhandler)
|
|
Packit |
5bd3a9 |
oldhandler = _XDefaultError;
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
if (handler != NULL) {
|
|
Packit |
5bd3a9 |
_XErrorFunction = handler;
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
else {
|
|
Packit |
5bd3a9 |
_XErrorFunction = _XDefaultError;
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
_XUnlockMutex(_Xglobal_lock);
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
return (XErrorHandler) oldhandler;
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
/*
|
|
Packit |
5bd3a9 |
* XIOErrorHandler - This procedure sets the X fatal I/O error handler
|
|
Packit |
5bd3a9 |
* (_XIOErrorFunction) to be the specified routine. If NULL is passed in
|
|
Packit |
5bd3a9 |
* the original error handler is restored.
|
|
Packit |
5bd3a9 |
*/
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
XIOErrorHandler
|
|
Packit |
5bd3a9 |
XSetIOErrorHandler(XIOErrorHandler handler)
|
|
Packit |
5bd3a9 |
{
|
|
Packit |
5bd3a9 |
int (*oldhandler)(Display *dpy);
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
_XLockMutex(_Xglobal_lock);
|
|
Packit |
5bd3a9 |
oldhandler = _XIOErrorFunction;
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
if (!oldhandler)
|
|
Packit |
5bd3a9 |
oldhandler = _XDefaultIOError;
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
if (handler != NULL) {
|
|
Packit |
5bd3a9 |
_XIOErrorFunction = handler;
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
else {
|
|
Packit |
5bd3a9 |
_XIOErrorFunction = _XDefaultIOError;
|
|
Packit |
5bd3a9 |
}
|
|
Packit |
5bd3a9 |
_XUnlockMutex(_Xglobal_lock);
|
|
Packit |
5bd3a9 |
|
|
Packit |
5bd3a9 |
return (XIOErrorHandler) oldhandler;
|
|
Packit |
5bd3a9 |
}
|