xutil: remove useless error functions

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-04-14 11:54:48 +02:00
parent d834e19a23
commit d5596c06ed
2 changed files with 0 additions and 249 deletions

View File

@ -95,193 +95,6 @@ xutil_error_handler_catch_all_set(xcb_event_handlers_t *evenths,
xcb_event_set_error_handler(evenths, err_num, handler, data); xcb_event_set_error_handler(evenths, err_num, handler, data);
} }
const char *
xutil_label_error[] =
{
"Success",
"BadRequest",
"BadValue",
"BadWindow",
"BadPixmap",
"BadAtom",
"BadCursor",
"BadFont",
"BadMatch",
"BadDrawable",
"BadAccess",
"BadAlloc",
"BadColor",
"BadGC",
"BadIDChoice",
"BadName",
"BadLength",
"BadImplementation",
};
const char *
xutil_label_request[] =
{
"None",
"CreateWindow",
"ChangeWindowAttributes",
"GetWindowAttributes",
"DestroyWindow",
"DestroySubwindows",
"ChangeSaveSet",
"ReparentWindow",
"MapWindow",
"MapSubwindows",
"UnmapWindow",
"UnmapSubwindows",
"ConfigureWindow",
"CirculateWindow",
"GetGeometry",
"QueryTree",
"InternAtom",
"GetAtomName",
"ChangeProperty",
"DeleteProperty",
"GetProperty",
"ListProperties",
"SetSelectionOwner",
"GetSelectionOwner",
"ConvertSelection",
"SendEvent",
"GrabPointer",
"UngrabPointer",
"GrabButton",
"UngrabButton",
"ChangeActivePointerGrab",
"GrabKeyboard",
"UngrabKeyboard",
"GrabKey",
"UngrabKey",
"AllowEvents",
"GrabServer",
"UngrabServer",
"QueryPointer",
"GetMotionEvents",
"TranslateCoords",
"WarpPointer",
"SetInputFocus",
"GetInputFocus",
"QueryKeymap",
"OpenFont",
"CloseFont",
"QueryFont",
"QueryTextExtents",
"ListFonts",
"ListFontsWithInfo",
"SetFontPath",
"GetFontPath",
"CreatePixmap",
"FreePixmap",
"CreateGC",
"ChangeGC",
"CopyGC",
"SetDashes",
"SetClipRectangles",
"FreeGC",
"ClearArea",
"CopyArea",
"CopyPlane",
"PolyPoint",
"PolyLine",
"PolySegment",
"PolyRectangle",
"PolyArc",
"FillPoly",
"PolyFillRectangle",
"PolyFillArc",
"PutImage",
"GetImage",
"PolyText",
"PolyText",
"ImageText",
"ImageText",
"CreateColormap",
"FreeColormap",
"CopyColormapAndFree",
"InstallColormap",
"UninstallColormap",
"ListInstalledColormaps",
"AllocColor",
"AllocNamedColor",
"AllocColorCells",
"AllocColorPlanes",
"FreeColors",
"StoreColors",
"StoreNamedColor",
"QueryColors",
"LookupColor",
"CreateCursor",
"CreateGlyphCursor",
"FreeCursor",
"RecolorCursor",
"QueryBestSize",
"QueryExtension",
"ListExtensions",
"ChangeKeyboardMapping",
"GetKeyboardMapping",
"ChangeKeyboardControl",
"GetKeyboardControl",
"Bell",
"ChangePointerControl",
"GetPointerControl",
"SetScreenSaver",
"GetScreenSaver",
"ChangeHosts",
"ListHosts",
"SetAccessControl",
"SetCloseDownMode",
"KillClient",
"RotateProperties",
"ForceScreenSaver",
"SetPointerMapping",
"GetPointerMapping",
"SetModifierMapping",
"GetModifierMapping",
"major 120",
"major 121",
"major 122",
"major 123",
"major 124",
"major 125",
"major 126",
"NoOperation",
};
bool
xutil_error_init(const xcb_generic_error_t *e, xutil_error_t *err)
{
if(e->response_type != 0)
/* This is not an error, this _should_ not happen */
return false;
/*
* Get the request code, taken from 'xcb-util/wm'. I can't figure
* out how it works BTW, seems to get a byte in 'pad' member
* (second byte in second element of the array)
*/
err->request_code = *((uint8_t *) e + 10);
/* Extensions generally provide their own requests so we just
* store the request code */
if(err->request_code >= (sizeof(xutil_label_request) / sizeof(char *)))
a_asprintf(&err->request_label, "%d", err->request_code);
else
err->request_label = a_strdup(xutil_label_request[err->request_code]);
/* Extensions may also define their own errors, so just store the
* error_code */
if(e->error_code >= (sizeof(xutil_label_error) / sizeof(char *)))
a_asprintf(&err->error_label, "%d", e->error_code);
else
err->error_label = a_strdup(xutil_label_error[e->error_code]);
return true;
}
xcb_keysym_t xcb_keysym_t
xutil_key_mask_fromstr(const char *keyname, size_t len) xutil_key_mask_fromstr(const char *keyname, size_t len)
{ {

View File

@ -34,77 +34,15 @@
#define XUTIL_MASK_CLEAN(mask) (mask & ~(XCB_MOD_MASK_LOCK | XCB_MOD_MASK_2)) #define XUTIL_MASK_CLEAN(mask) (mask & ~(XCB_MOD_MASK_LOCK | XCB_MOD_MASK_2))
/* X error codes */
/* Everything's okay */
#define XUTIL_SUCCESS 0
/* Bad request code */
#define XUTIL_BAD_REQUEST 1
/* Int parameter out of range */
#define XUTIL_BAD_VALUE 2
/* Parameter not a Window */
#define XUTIL_BAD_WINDOW 3
/* Parameter not a Pixmap */
#define XUTIL_BAD_PIXMAP 4
/* Parameter not an Atom */
#define XUTIL_BAD_ATOM 5
/* Parameter not a Cursor */
#define XUTIL_BAD_CURSOR 6
/* Parameter not a Font */
#define XUTIL_BAD_FONT 7
/* Parameter mismatch */
#define XUTIL_BAD_MATCH 8
/* Parameter not a Pixmap or Window */
#define XUTIL_BAD_DRAWABLE 9
/* Depending on context:
- key/button already grabbed
- attempt to free an illegal
cmap entry
- attempt to store into a read-only
color map entry.
- attempt to modify the access control
list from other than the local host.
*/
#define XUTIL_BAD_ACCESS 10
/* Insufficient resources */
#define XUTIL_BAD_ALLOC 11
/* No such colormap */
#define XUTIL_BAD_COLOR 12
/* Parameter not a GC */
#define XUTIL_BAD_GC 13
/* Choice not in range or already used */
#define XUTIL_BAD_ID_CHOICE 14
/* Font or color name doesn't exist */
#define XUTIL_BAD_NAME 15
/* Request length incorrect */
#define XUTIL_BAD_LENGTH 16
/* Server is defective */
#define XUTIL_BAD_IMPLEMENTATION 17
bool xutil_text_prop_get(xcb_connection_t *, xcb_window_t, xcb_atom_t, char **, ssize_t *); bool xutil_text_prop_get(xcb_connection_t *, xcb_window_t, xcb_atom_t, char **, ssize_t *);
/** Set the same handler for all errors */ /** Set the same handler for all errors */
void xutil_error_handler_catch_all_set(xcb_event_handlers_t *, void xutil_error_handler_catch_all_set(xcb_event_handlers_t *,
xcb_generic_error_handler_t, void *); xcb_generic_error_handler_t, void *);
typedef struct
{
uint8_t request_code;
char *request_label;
char *error_label;
} xutil_error_t;
bool xutil_error_init(const xcb_generic_error_t *, xutil_error_t *);
xcb_keysym_t xutil_key_mask_fromstr(const char *, size_t); xcb_keysym_t xutil_key_mask_fromstr(const char *, size_t);
unsigned int xutil_button_fromint(int); unsigned int xutil_button_fromint(int);
static inline void
xutil_error_wipe(xutil_error_t *err)
{
p_delete(&err->error_label);
p_delete(&err->request_label);
}
/* Get the informations about the screen. /* Get the informations about the screen.
* \param c X connection. * \param c X connection.
* \param screen Screen number. * \param screen Screen number.