B

Error Messages and Protocol Requests

This appendix contains two tables: Table B-1 describes the standard error codes (the error_code member of XErrorEvent) and what causes them, and Table B-2 describes the mapping between protocol requests and Xlib functions. Each reference page in this volume describes in more detail the errors that may occur because of that Xlib routine. Volume One, Chapter 3, Basic Window Program, describes the handling of errors in general.

A protocol request is the actual network message that is sent from Xlib to the server. Many convenience functions are provided in Xlib to make programs easier to write and more readable. When any one of several convenience routines is called it will be translated into one type of protocol request. For example, XMoveWindow and XResizeWindow are convenience routines for the more general XConfigureWindow. Both of these Xlib routines use the protocol request X_ConfigureWindow. The protocol request that causes an error, along with other information about the error is printed to the standard error output by the default error handlers. In order to find out where in your code the error ocurred, you will need to know what Xlib function to look for. Use Table B-2 to find this function.

Xlib functions that do not appear in Table B-2 do not generate protocol requests. They perform their function without affecting the display and without requiring information from the server. If errors can occur in them, the errors are reported in the returned value.

Table B-1. Error Messages

Error Codes Possible Cause
BadAccess Client attempted to grab a key/button combination that is already grabbed by another client.

Client attempted to free a colormap entry that is not allocated by the client.

Client attempted to store into a read-only colormap entry.

Client attempted to modify the access control list from other than the local (or otherwise authorized) host.

Client attempted to select an event type that only one client can select at a time, when another client has already selected it.

BadAlloc The server failed to allocate the requested resource.
BadAtom A value for an Atom argument does not name a defined Atom.
BadColor A value for a Colormap argument does not name a defined Colormap.
BadCursor A value for a Cursor argument does not name a defined Cursor.
BadDrawable A value for a Drawable argument does not name a defined Window or Pixmap.
BadFont A value for a Font or GContext argument does not name a defined Font.
BadGC A value for a GContext argument does not name a defined GContext.
BadIDChoice The value chosen for a resource identifier is either not included in the range assigned to the client, or is already in use.
BadImplementation The server does not implement some aspect of the request. A server that generates this error for a core request is deficient. Clients should be prepared to receive such errors and either handle or discard them.
BadLength The length of a request is shorter or longer than that required to minimally contain the arguments. This usually indicates an internal Xlib error.
BadMatch An InputOnly window is used as a Drawable.

Some argument (or pair of arguments) has the correct type and range, but fails to “match” in some other way required by the request.

BadName A font or color of the specified name does not exist.
BadPixmap A value for a Pixmap argument does not name a defined Pixmap.
BadRequest The major or minor opcode does not specify a valid request.
BadValue Some numeric value falls outside the range of values accepted by the request. Unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. Any argument defined as a set of alternatives can generate this error.
BadWindow A value for a Window argument does not name a defined Window.

The BadAtom, BadColor, BadCursor, BadDrawable, BadFont, BadGC, BadPixmap, and Badwindow errors are also used when the argument type should be among a set of fixed alternatives (for example, a window ID, PointerRoot, or None) and some other constant or variable is used.

Table B-2. Xlib Functions and Protocol Requests

Protocol Request Xlib Function
X_AllocColor XAllocColor
X_AllocColorCells XAllocColorCells
X_AllocColorPlanes XAllocColorPlanes
X_AllocNamedColor XAllocNamedColor
X_AllowEvents XAllowEvents
X_Bell XBell
X_ChangeActivePointerGrab XChangeActivePointerGrab
X_ChangeGC XChangeGC

XSetArcMode

XSetBackground

XSetClipMask

XSetClipOrigin

XSetFillRule

XSetFillStyle

XSetFont

XSetForeground

XSetFunction

XSetGraphicsExposures

XSetLineAttributes

XSetPlaneMask

XSetState

XSetStipple

XSetSubwindowMode

XSetTile

XSetTSOrigin

X_ChangeHosts XAddHost

XAddHosts

XRemoveHost

XRemoveHosts

X_ChangeKeyboardControl XAutoRepeatOff

XAutoRepeatOn

XChangeKeyboardControl

X_ChangeKeyboardMapping XChangeKeyboardMapping
X_ChangePointerControl XChangePointerControl
X_ChangeProperty XChangeProperty

XSetCommand

XSetIconSizes

XSetIconWindow

XSetNormalHints

XSetResizeHint

XSetSizeHints

XSetStandardProperties

XSetWMHints

XSetZoomHints

XStoreBuffer

XStoreBytes

XStoreName

X_ChangeSaveSet XAddToSaveSet

XChangeSaveSet

XRemoveFromSaveSet

X_ChangeWindow Attributes XChangeWindowAttributes

XDefineCursor

XSelectInput

XSetWindowBackground

XSetWindowBackgroundPixmap

XSetWindowBorder

XSetWindowBorderPixmap

XSetWindowColormap

XUndefineCursor

X_CirculateWindow XCirculateSubwindows

XCirculateSubwindowsDown

XCirculateSubwindowsUp

X_ClearArea XClearArea

XClearWindow

X_CloseFont XFreeFont

XUnloadFont

X_ConfigureWindow XConfigureWindow

XLowerWindow

XMapRaised

XMoveResizeWindow

XMoveWindow

XRaiseWindow

XResizeWindow

XRestackWindows

XSetWindowBorderWidth

X_ConvertSelection XConvertSelection
X_CopyArea XCopyArea
X_CopyColormapAndFree XCopyColormapAndFree
X_CopyGC XCopyGC
X_CopyPlane XCopyPlane
X_CreateColormap XCreateColormap
X_CreateCursor XCreatePixmapCursor
X_CreateGC XCreateGC

XOpenDisplay

X_CreateGlyphCursor XCreateFontCursor

XCreateGlyphCursor

X_CreatePixmap XCreatePixmap
X_CreateWindow XCreateSimpleWindow

XCreateWindow

X_DeleteProperty XDeleteProperty
X_DestroySubwindows XDestroySubwindows
X_DestroyWindow XDestroyWindow
X_FillPoly XFillPolygon
X_ForceScreenSaver XActivateScreenSaver

XForceScreenSaver

XResetScreensaver

X_FreeColormap XFreeColormap
X_FreeColors XFreeColors
X_FreeCursor XFreeCursor
X_FreeGC XFreeGC
X_FreePixmap XFreePixmap
X_GetAtomName XGetAtomName
X_GetFontPath XGetFontPath
X_GetGeometry XGetGeometry

XGetWindowAttributes

X_GetImage XGetImage
X_GetInputFocus XGetInputFocus

XSync

X_GetKeyboardControl XGetKeyboardControl
X_GetKeyboardMapping XGetKeyboardMapping
X_GetModifierMapping XGetModifierMapping
X_GetMotionEvents XGetMotionEvents
X_GetPointerControl XGetPointerControl
X_GetPointerMapping XGetPonterMapping
X_GetProperty XClearIconWindow

XFetchBytes

XFetchName

XGetIconSizes

XGetIconWindow

XGetNormalHints

XGetSizeHints

XGetWindowProperty

XGetWMHints

XGetZoomHints

X_GetScreenSaver XGetScreensaver
X_GetSelectionOwner XGetSelectionOwner
X_GetWindowAttributes XGetWindowAttributes
X_GrabButton XGrabButton
X_GrabKey XGrabKey
X_GrabKeyboard XGrabKeyboard
X_GrabPointer XGrabPointer
X_GrabServer XGrabServer
X_ImageText8 XDrawImagestring
X_ImageText16 XDrawImageString16
X_InstallColormap XInstallColormap
X_InternAtom XInternAtom
X_KillClient XKillClient
X_ListExtensions XListExtensions
X_ListFonts XListFonts
X_ListFontsWithInfo XListFontsWithInfo
X_ListHosts XListHosts
X_ListInstalledColormaps XListInstalledColormaps
X_ListProperties XListProperties
X_LookupColor XLookupColor

XParseColor

X_MapSubwindows XMapSubwindows
X_MapWindow XMapRaised

XMapWindow

X_NoOperation XNoOp
X_OpenFont XLoadFont

XLoadQueryFont

X_PolyArc XDrawArc

XDrawArcs

X_PolyFillArc XFillArc

XFillArcs

X_PolyFillRectangle XFillRectangle

XFillRectangles

X_PolyLine XDrawLines
X_PolyPoint XDrawPoint

XDrawPoints

X_PolyRectangle XDrawRectangle

XDrawRectangles

X_PolySegment XDrawLine

XDrawSegments

X_PolyText8 XDrawString

XDrawText

X_PolyText16 XDrawString16

XDrawText16

X_PutImage XPutImage
X_QueryBestSize XQueryBestCursor

XQueryBestSize

XQueryBestStipple

XQueryBestTile

X_QueryColors XQueryColor

XQueryColors

X_QueryExtension XInitExtension

XQueryExtension

X_QueryFont XLoadQueryFont
X_QueryKeymap XQueryKeymap
X_QueryPointer XQueryPointer
X_QueryTextExtents XQueryTextExtents

XQueryTextExtents16

XQueryTree XQueryTree
X_RecolorCursor XRecolorCursor
X_ReparentWindow XReparentWindow
X_RotateProperties XRotateBuffers

XRotateWindowProperties

X_SendEvent XSendEvent
X_SetAccessControl XDisableAccessControl

XEnableAccessControl

XSetAccessControl

X_SetClipRectangles XSetClipRectangles
X_SetCloseDownMode XSetCloseDownMode
X_SetDashes XSetDashes
X_SetFontPath XSetFontPath
X_SetInputFocus XSetInputFocus
X_SetModifierMapping XSetModifierMapping
X_SetPointerMapping XSetPointerMapping
X_SetScreenSaver XSetScreenSaver
X_SetSelectionOwner XSetSelectionOwner
X_StoreColors XStoreColor

XStoreColors

X_StoreNamedColor XStoreNamedColor
X_TranslateCoords XTranslateCoordinates
X_UngrabButton XUngrabButton
X_UngrabKey XUngrabKey
X_UngrabKeyboard XUngrabKeyboard
X_UngrabPointer XUngrabPointer
X_UngrabServer XUngrabServer
X_UninstallColormap XUninstallColormap
X_UnmapSubwindows XUnmapSubWindows
X_UnmapWindow XUnmapWindow
X_WarpPointer XWarpPointer

Get Xlib Reference Manual for Version 11 of the X Window System now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.