[comp.windows.x] Why does 1 program show icon properly under awm while another doesn't

earle@SUN.COM (Greg Earle) (03/12/89)

When I iconify `xman' or `xclock' or `xload' under `awm', everything seems to
be OK; the correct icon is used.  When I iconify, e.g., `mazewar' under `awm',
it doesn't use the correct icon; whatever resource I have for `awm*icon.pixmap'
gets used instead.  The icon is displayed correctly under `uwm' (although it
doesn't `flash', as it's supposed to when another player is added or is in
sight of you, which is what I was *really* trying to test.  Oh well ... ).

It seems the `well behaved' programs tend to declare their icons via code like

	num_args = 0;
	XtSetArg(arglist[num_args], XtNiconPixmap,
		XCreateBitmapFromData( XtDisplay(initial_widget),
					XtScreen(initial_widget)->root,
					icon_bits, icon_width, icon_height));
	num_args++;

(plagiarized & slightly altered from xman's buttons.c)

Whereas the code to define the icon in mazewar looks like

	icon_pixmap = XCreatePixmapFromBitmapData(dpy, mwWindow, icon_bits,
						icon_width, icon_height,
						BlackPixel(dpy, screen),
						WhitePixel(dpy, screen),
						XDefaultDepth(dpy, screen));

	iconmask_pixmap = XCreatePixmapFromBitmapData(dpy, mwWindow,
						icon_mask_bits,
						icon_mask_width,
						icon_mask_height,
						WhitePixel(dpy, screen),
						BlackPixel(dpy, screen),
						XDefaultDepth(dpy, screen));
	icon_reverse_pixmap = XCreatePixmap(dpy, mwWindow, icon_width,
						icon_height,
						XDefaultDepth(dpy, screen));

	XSetFunction(dpy, copyGC, GXcopyInverted);
	XCopyArea(dpy, icon_pixmap, icon_reverse_pixmap, copyGC,
			0, 0, icon_width, icon_height, 0, 0);
	XSetFunction(dpy, copyGC, GXcopy);

	wmhints.icon_pixmap = icon_pixmap;
	wmhints.icon_mask = iconmask_pixmap;
	XSetWMHints(dpy, mwWindow, &wmhints);

(I note with interest that `mazewar' is creating a full pixmap, whereas `xman'
 is content with a bitmap; although there are notes about problems using
 XCreateBitmap with a vs100)

Is there something about the second method which is causing `awm' to ignore
mazewar's pleas to it for setting the icon-related WMHints?  Is this an
anti-social way of defining icons in this day and age?  If so, is `uwm' being
more forgiving?  Or does `awm' ignore things like window manager hints?  Or
is `mazewar' a naughty boy for only using the Toolkit to do initialization
and application resource grabbing, then diving right back into Xlib?  (^:

I'm using `awm', patch level 8 (Will someone put patch #9 on expo please).

Any enlightenment appreciated ...

	- Greg Earle
	  Sun Microsystems, Inc.
	  JPL on-site Software Support
	  earle@Sun.COM
	  earle@mahendo.JPL.NASA.GOV	(Guest account)