From 9a8ad93043569c2717bd88f0264e0d3a28b56a74 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 15 Jul 2012 01:30:16 -0700 Subject: Record atoms from InternAtom and GetAtomName requests Uses them to display strings instead of just numeric ids for atoms beyond the builtin set in other requests, such as property lookups. Signed-off-by: Alan Coopersmith --- prtype.c | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) (limited to 'prtype.c') diff --git a/prtype.c b/prtype.c index 7fdea01..9abdd3b 100644 --- a/prtype.c +++ b/prtype.c @@ -25,7 +25,7 @@ * */ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -461,37 +461,22 @@ PrintFONTABLE(const unsigned char *buf) /* ************************************************************ */ -#define NumberofAtoms 68 - -static const char *const AtomTable[NumberofAtoms + 1] = { - "NONE", "PRIMARY", "SECONDARY", "ARC", "ATOM", "BITMAP", "CARDINAL", - "COLORMAP", "CURSOR", "CUT_BUFFER0", "CUT_BUFFER1", "CUT_BUFFER2", - "CUT_BUFFER3", "CUT_BUFFER4", "CUT_BUFFER5", "CUT_BUFFER6", - "CUT_BUFFER7", "DRAWABLE", "FONT", "INTEGER", "PIXMAP", "POINT", - "RECTANGLE", "RESOURCE_MANAGER", "RGB_COLOR_MAP", "RGB_BEST_MAP", - "RGB_BLUE_MAP", "RGB_DEFAULT_MAP", "RGB_GRAY_MAP", "RGB_GREEN_MAP", - "RGB_RED_MAP", "STRING", "VISUALID", "WINDOW", "WM_COMMAND", - "WM_HINTS", "WM_CLIENT_MACHINE", "WM_ICON_NAME", "WM_ICON_SIZE", - "WM_NAME", "WM_NORMAL_HINTS", "WM_SIZE_HINTS", "WM_ZOOM_HINTS", - "MIN_SPACE", "NORM_SPACE", "MAX_SPACE", "END_SPACE", "SUPERSCRIPT_X", - "SUPERSCRIPT_Y", "SUBSCRIPT_X", "SUBSCRIPT_Y", "UNDERLINE_POSITION", - "UNDERLINE_THICKNESS", "STRIKEOUT_ASCENT", "STRIKEOUT_DESCENT", - "ITALIC_ANGLE", "X_HEIGHT", "QUAD_WIDTH", "WEIGHT", "POINT_SIZE", - "RESOLUTION", "COPYRIGHT", "NOTICE", "FONT_NAME", "FAMILY_NAME", - "FULL_NAME", "CAP_HEIGHT", "WM_CLASS", "WM_TRANSIENT_FOR" -}; - -/* for atoms, we print the built-in atoms. We could expand to printing - the user defined ones, too. */ +/* for atoms, we print the built-in atoms, as well as any user defined + ones we've captured during this session. */ int PrintATOM(const unsigned char *buf) { /* print a ATOM -- CARD32 plus 0 = None */ long n = ILong(buf); + const char *name = FindAtomName(n); - if (0 <= n && n <= NumberofAtoms) - fprintf(stdout, "<%s>", AtomTable[n]); + if (name != NULL) { + if (Verbose > 1) + fprintf(stdout, "ATM %08lx <%s>", n, name); + else + fprintf(stdout, "<%s>", name); + } else fprintf(stdout, "ATM %08lx", n); return (4); -- cgit v1.2.1