2 * WindowMaker miscelaneous functions
4 * Copyright (c) 1997-2003 Alfredo K. Kojima
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <X11/Xutil.h>
24 #include <X11/Xatom.h>
32 #include <WINGs/WUtil.h>
34 static Atom Clipboard
= 0;
37 static char *requestCodes
[] = {
40 "X_ChangeWindowAttributes",
41 "X_GetWindowAttributes",
43 "X_DestroySubwindows",
60 "X_SetSelectionOwner",
61 "X_GetSelectionOwner",
68 "X_ChangeActivePointerGrab",
88 "X_ListFontsWithInfo",
97 "X_SetClipRectangles",
108 "X_PolyFillRectangle",
118 "X_CopyColormapAndFree",
120 "X_UninstallColormap",
121 "X_ListInstalledColormaps",
125 "X_AllocColorPlanes",
132 "X_CreateGlyphCursor",
138 "X_ChangeKeyboardMapping",
139 "X_GetKeyboardMapping",
140 "X_ChangeKeyboardControl",
141 "X_GetKeyboardControl",
143 "X_ChangePointerControl",
144 "X_GetPointerControl",
149 "X_SetAccessControl",
150 "X_SetCloseDownMode",
152 "X_RotateProperties",
153 "X_ForceScreenSaver",
154 "X_SetPointerMapping",
155 "X_GetPointerMapping",
156 "X_SetModifierMapping",
157 "X_GetModifierMapping",
161 void FormatXError(Display
* dpy
, XErrorEvent
* error
, char *buffer
, int size
)
165 XGetErrorText(dpy
, error
->error_code
, buffer
, size
);
170 if (error
->request_code
>= sizeof(requestCodes
) / sizeof(char *)) {
171 sprintf(buffer
, "\n Request code: %i\n", error
->request_code
);
173 sprintf(buffer
, "\n Request code: %i %s\n", error
->request_code
,
174 requestCodes
[error
->request_code
]);
176 i
+= p
= strlen(buffer
);
180 sprintf(buffer
, " Request minor code: %i\n", error
->minor_code
);
181 i
+= p
= strlen(buffer
);
185 sprintf(buffer
, " Resource ID: 0x%x\n", (unsigned int)error
->resourceid
);
186 i
+= p
= strlen(buffer
);
190 sprintf(buffer
, " Error serial: %li\n", error
->serial
);