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., 51 Franklin St, Fifth Floor, Boston,
24 #include <X11/Xutil.h>
25 #include <X11/Xatom.h>
33 #include <WINGs/WUtil.h>
35 static Atom Clipboard
= 0;
38 static char *requestCodes
[] = {
41 "X_ChangeWindowAttributes",
42 "X_GetWindowAttributes",
44 "X_DestroySubwindows",
61 "X_SetSelectionOwner",
62 "X_GetSelectionOwner",
69 "X_ChangeActivePointerGrab",
89 "X_ListFontsWithInfo",
98 "X_SetClipRectangles",
109 "X_PolyFillRectangle",
119 "X_CopyColormapAndFree",
121 "X_UninstallColormap",
122 "X_ListInstalledColormaps",
126 "X_AllocColorPlanes",
133 "X_CreateGlyphCursor",
139 "X_ChangeKeyboardMapping",
140 "X_GetKeyboardMapping",
141 "X_ChangeKeyboardControl",
142 "X_GetKeyboardControl",
144 "X_ChangePointerControl",
145 "X_GetPointerControl",
150 "X_SetAccessControl",
151 "X_SetCloseDownMode",
153 "X_RotateProperties",
154 "X_ForceScreenSaver",
155 "X_SetPointerMapping",
156 "X_GetPointerMapping",
157 "X_SetModifierMapping",
158 "X_GetModifierMapping",
162 void FormatXError(Display
* dpy
, XErrorEvent
* error
, char *buffer
, int size
)
166 XGetErrorText(dpy
, error
->error_code
, buffer
, size
);
171 if (error
->request_code
>= sizeof(requestCodes
) / sizeof(requestCodes
[0])) {
172 sprintf(buffer
, "\n Request code: %i\n", error
->request_code
);
174 sprintf(buffer
, "\n Request code: %i %s\n", error
->request_code
,
175 requestCodes
[error
->request_code
]);
177 i
+= p
= strlen(buffer
);
181 sprintf(buffer
, " Request minor code: %i\n", error
->minor_code
);
182 i
+= p
= strlen(buffer
);
186 sprintf(buffer
, " Resource ID: 0x%x\n", (unsigned int)error
->resourceid
);
187 i
+= p
= strlen(buffer
);
191 sprintf(buffer
, " Error serial: %li\n", error
->serial
);