[maemo-commits] [maemo-commits] r19008 - in projects/haf/trunk/libmatchbox2: . matchbox/core

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Jul 29 19:34:58 EEST 2009
Author: aendrodi
Date: 2009-07-29 19:34:51 +0300 (Wed, 29 Jul 2009)
New Revision: 19008

Added:
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-debug-symbols.h
Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-util.c
Log:
	* matchbox/core/mb-wm-util.c (error_handler):
	  Gift to those who know the cheat code: print symbolic names
	  of X errors and requests, so perhaps there'll be more motivation
	  to track them down.


Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-07-29 07:59:35 UTC (rev 19007)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-07-29 16:34:51 UTC (rev 19008)
@@ -1,5 +1,12 @@
 2009-07-28  Adam Endrodi  <adam.endrodi at blumsoft.eu>
 
+	* matchbox/core/mb-wm-util.c (error_handler):
+	  Gift to those who know the cheat code: print symbolic names
+	  of X errors and requests, so perhaps there'll be more motivation
+	  to track them down.
+
+2009-07-28  Adam Endrodi  <adam.endrodi at blumsoft.eu>
+
 	* matchbox/core/mb-wm-client-window.c
 	  (mb_wm_client_window_sync_properties):
 	  Blogged about the monster hack.

Added: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-debug-symbols.h
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-debug-symbols.h	2009-07-29 07:59:35 UTC (rev 19007)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-debug-symbols.h	2009-07-29 16:34:51 UTC (rev 19008)
@@ -0,0 +1,149 @@
+#ifndef G_DEBUG_DISABLE
+
+static const char * mb_wm_debug_x_errors[] =
+{
+  [ 0] = "Success",
+  [ 1] = "BadRequest",
+  [ 2] = "BadValue",
+  [ 3] = "BadWindow",
+  [ 4] = "BadPixmap",
+  [ 5] = "BadAtom",
+  [ 6] = "BadCursor",
+  [ 7] = "BadFont",
+  [ 8] = "BadMatch",
+  [ 9] = "BadDrawable",
+  [10] = "BadAccess",
+  [11] = "BadAlloc",
+  [12] = "BadColor",
+  [13] = "BadGC",
+  [14] = "BadIDChoice",
+  [15] = "BadName",
+  [16] = "BadLength",
+  [17] = "BadImplementation",
+};
+
+static const char * mb_wm_debug_x_requests[] =
+{
+  [  1] = "CreateWindow",
+  [  2] = "ChangeWindowAttributes",
+  [  3] = "GetWindowAttributes",
+  [  4] = "DestroyWindow",
+  [  5] = "DestroySubwindows",
+  [  6] = "ChangeSaveSet",
+  [  7] = "ReparentWindow",
+  [  8] = "MapWindow",
+  [  9] = "MapSubwindows",
+  [ 10] = "UnmapWindow",
+  [ 11] = "UnmapSubwindows",
+  [ 12] = "ConfigureWindow",
+  [ 13] = "CirculateWindow",
+  [ 14] = "GetGeometry",
+  [ 15] = "QueryTree",
+  [ 16] = "InternAtom",
+  [ 17] = "GetAtomName",
+  [ 18] = "ChangeProperty",
+  [ 19] = "DeleteProperty",
+  [ 20] = "GetProperty",
+  [ 21] = "ListProperties",
+  [ 22] = "SetSelectionOwner",
+  [ 23] = "GetSelectionOwner",
+  [ 24] = "ConvertSelection",
+  [ 25] = "SendEvent",
+  [ 26] = "GrabPointer",
+  [ 27] = "UngrabPointer",
+  [ 28] = "GrabButton",
+  [ 29] = "UngrabButton",
+  [ 30] = "ChangeActivePointerGrab",
+  [ 31] = "GrabKeyboard",
+  [ 32] = "UngrabKeyboard",
+  [ 33] = "GrabKey",
+  [ 34] = "UngrabKey",
+  [ 35] = "AllowEvents",
+  [ 36] = "GrabServer",
+  [ 37] = "UngrabServer",
+  [ 38] = "QueryPointer",
+  [ 39] = "GetMotionEvents",
+  [ 40] = "TranslateCoords",
+  [ 41] = "WarpPointer",
+  [ 42] = "SetInputFocus",
+  [ 43] = "GetInputFocus",
+  [ 44] = "QueryKeymap",
+  [ 45] = "OpenFont",
+  [ 46] = "CloseFont",
+  [ 47] = "QueryFont",
+  [ 48] = "QueryTextExtents",
+  [ 49] = "ListFonts",
+  [ 50] = "ListFontsWithInfo",
+  [ 51] = "SetFontPath",
+  [ 52] = "GetFontPath",
+  [ 53] = "CreatePixmap",
+  [ 54] = "FreePixmap",
+  [ 55] = "CreateGC",
+  [ 56] = "ChangeGC",
+  [ 57] = "CopyGC",
+  [ 58] = "SetDashes",
+  [ 59] = "SetClipRectangles",
+  [ 60] = "FreeGC",
+  [ 61] = "ClearArea",
+  [ 62] = "CopyArea",
+  [ 63] = "CopyPlane",
+  [ 64] = "PolyPoint",
+  [ 65] = "PolyLine",
+  [ 66] = "PolySegment",
+  [ 67] = "PolyRectangle",
+  [ 68] = "PolyArc",
+  [ 69] = "FillPoly",
+  [ 70] = "PolyFillRectangle",
+  [ 71] = "PolyFillArc",
+  [ 72] = "PutImage",
+  [ 73] = "GetImage",
+  [ 74] = "PolyText8",
+  [ 75] = "PolyText16",
+  [ 76] = "ImageText8",
+  [ 77] = "ImageText16",
+  [ 78] = "CreateColormap",
+  [ 79] = "FreeColormap",
+  [ 80] = "CopyColormapAndFree",
+  [ 81] = "InstallColormap",
+  [ 82] = "UninstallColormap",
+  [ 83] = "ListInstalledColormaps",
+  [ 84] = "AllocColor",
+  [ 85] = "AllocNamedColor",
+  [ 86] = "AllocColorCells",
+  [ 87] = "AllocColorPlanes",
+  [ 88] = "FreeColors",
+  [ 89] = "StoreColors",
+  [ 90] = "StoreNamedColor",
+  [ 91] = "QueryColors",
+  [ 92] = "LookupColor",
+  [ 93] = "CreateCursor",
+  [ 94] = "CreateGlyphCursor",
+  [ 95] = "FreeCursor",
+  [ 96] = "RecolorCursor",
+  [ 97] = "QueryBestSize",
+  [ 98] = "QueryExtension",
+  [ 99] = "ListExtensions",
+  [100] = "ChangeKeyboardMapping",
+  [101] = "GetKeyboardMapping",
+  [102] = "ChangeKeyboardControl",
+  [103] = "GetKeyboardControl",
+  [104] = "Bell",
+  [105] = "ChangePointerControl",
+  [106] = "GetPointerControl",
+  [107] = "SetScreenSaver",
+  [108] = "GetScreenSaver",
+  [109] = "ChangeHosts",
+  [110] = "ListHosts",
+  [111] = "SetAccessControl",
+  [112] = "SetCloseDownMode",
+  [113] = "KillClient",
+  [114] = "RotateProperties",
+  [115] = "ForceScreenSaver",
+  [116] = "SetPointerMapping",
+  [117] = "GetPointerMapping",
+  [118] = "SetModifierMapping",
+  [119] = "GetModifierMapping",
+  [127] = "NoOperation",
+};
+
+#endif /* ! G_DEBUG_DISABLE */

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-util.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-util.c	2009-07-29 07:59:35 UTC (rev 19007)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-util.c	2009-07-29 16:34:51 UTC (rev 19008)
@@ -1,6 +1,8 @@
 #include "mb-wm.h"
 #include <stdarg.h>
 
+#include "mb-wm-debug-symbols.h"
+
 #undef  G_LOG_DOMAIN
 #define G_LOG_DOMAIN "libmatchbox"
 
@@ -11,10 +13,25 @@
 error_handler(Display     *xdpy,
 	      XErrorEvent *error)
 {
+#ifndef G_DEBUG_DISABLE
+  char err[64], req[64];
+
+  sprintf(err, "%s (%d)",
+          error->error_code < G_N_ELEMENTS (mb_wm_debug_x_errors)
+              && mb_wm_debug_x_errors[error->error_code]
+            ? mb_wm_debug_x_errors[error->error_code] : "???",
+          error->error_code);
+  sprintf(req, "%s (%d)",
+          error->request_code < G_N_ELEMENTS (mb_wm_debug_x_requests)
+              && mb_wm_debug_x_requests[error->request_code]
+            ? mb_wm_debug_x_requests[error->request_code] : "???",
+          error->request_code);
+  g_debug("X error %s, window: 0x%lx, req: %s, minor: %d",
+          err, error->resourceid, req, error->minor_code);
+#endif
+
   TrappedErrorCode = error->error_code;
-  g_debug("X error %d, window: 0x%lx, req: %d, minor: %d",
-          error->error_code, error->resourceid,
-          error->request_code, error->minor_code);
+
   return 0;
 }
 

More information about the maemo-commits mailing list