• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

Public Member Functions | List of all members
KXErrorHandler Class Reference

#include <kxerrorhandler.h>

Public Member Functions

 KXErrorHandler (Display *dpy=tqt_xdisplay())
 
 KXErrorHandler (bool(*handler)(int request, int error_code, unsigned long resource_id), Display *dpy=tqt_xdisplay())
 
 KXErrorHandler (int(*handler)(Display *, XErrorEvent *), Display *dpy=tqt_xdisplay())
 
bool error (bool sync) const
 

Detailed Description

This class simplifies handling of X errors.

It shouldn't be necessary to use with Qt classes, as the toolkit should handle X errors itself, so this class will be mainly used with direct Xlib usage, and some lowlevel classes like NETWinInfo.

The usual usage is to create a KXErrorHandler instance right before starting operations that might cause X errors, and checking if there was an error by calling error() after the operations are finished. The handlers may be nested, but must be destroyed in reverse order they were created.

There's no need to do X sync before creating an instance, every instance will handle only errors for request issued after the instance was created. Errors for older requests will be passed to previous error handler. When checking for error by calling error() at the end, it is necessary to sync with X, to catch all errors that were caused by requests issued before the call to error(). This can be done by passing true to error() to cause explicit XSync(), however, if the last X request needed a roundtrip (e.g. XGetWindowAttributes(), XGetGeometry(), etc.), it is not required to do an explicit sync.

Author
Lubos Lunak l.lun.nosp@m.ak@k.nosp@m.de.or.nosp@m.g

Handler for X errors

Definition at line 57 of file kxerrorhandler.h.

Constructor & Destructor Documentation

◆ KXErrorHandler() [1/3]

KXErrorHandler::KXErrorHandler ( Display *  dpy = tqt_xdisplay())

Creates error handler that will set error flag after encountering any X error.

◆ KXErrorHandler() [2/3]

KXErrorHandler::KXErrorHandler ( bool(*)(int request, int error_code, unsigned long resource_id)  handler,
Display *  dpy = tqt_xdisplay() 
)

This constructor takes pointer to a function that will get request number, error code number and resource id of the failed request, as provided by XErrorEvent.

If the function returns true, the error flag will be set.

◆ KXErrorHandler() [3/3]

KXErrorHandler::KXErrorHandler ( int(*)(Display *, XErrorEvent *)  handler,
Display *  dpy = tqt_xdisplay() 
)

This constructor takes pointer to a function whose prototype matches the one that's used with the XSetErrorHandler() Xlib function.

NOTE: For the error flag to be set, the function must return non-zero value.

Member Function Documentation

◆ error()

bool KXErrorHandler::error ( bool  sync) const

This function returns true if the error flag is set (i.e.

no custom handler function was used and there was any error, or the custom handler indicated an error by its return value).

Parameters
syncif true, and explicit XSync() will be done. Not necessary when the last X request required a roundtrip.

The documentation for this class was generated from the following file:
  • kxerrorhandler.h

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.4
This website is maintained by Timothy Pearson.