[comp.windows.x] uwm does not correctly f.newiconify when using Pixmap hints +FIX

dave@speedy.cs.wisc.edu (Dave Cohrs) (04/21/88)

VERSION:
	X11 release 2

CLIENT MACHINE:
	Sun 4/110

CLIENT OPERATING SYSTEM:
	SunOS 3.2

DISPLAY:
	BW

SYNOPSIS:
	uwm will not initialially f.newiconify a window that has
	specified a Pixmap WM_HINTS.

DESCRIPTION:
	The code for f.newiconify in uwm is subtly different from
	the f.iconify code.  If one initially f.iconify's a window
	with a Pixmap Window-manager hint, it works fine.  I can
	then move the icon window, or f.newiconify the associated
	real window afterward, and everything works fine.
	If I initially f.newiconify, uwm fails to iconify the window,
	and furthermore, refuses to ever iconify that window.

REPEAT-BY:
	This appears to be an architecture dependent bug, it may
	be hard for you to reproduce, but look at the fix, and it
	is pretty obvious that there is a bug here.

	- add the code from Jef Poskanzer (sybase!jef) that allows
	  one to specify iconPixmap resources.  This adds a new
	  StringtoPixmap converter to the Xt Converters.c.
	- now, specify something like in the .Xdefaults or .Xres
	  file (and re-xrdb):
		xterm*iconPixmap: /pathname/to/a/X11/bitmap/file
	- start a new xterm
	- use uwm to f.newiconify this window.  Note that the
	  uwm cursor changes to the ICONIFY cross-hairs, but the
	  icon box never appears, and the window fails to iconify
	- Try either f.iconify'ing or f.iconify'ing this same window
	  notice that uwm fails to do anything.
	- Kill the window
	- start another new xterm
	- use uwm to f.iconify the window.  Notice that it worked,
	  and the bitmap that you specified appeared instead of the
	  stupid character-string icon.
	- un-iconify the xterm bitmap icon.
	- either f.iconify or f.newiconify this window again, notice
	  that it works either way.

FIX:
	This appears to be yet another architecture dependent
	bug, caused by uninitialized variables.  The problem appears
	to be that the MakePixmapfromBitmap() routine in Icons.c
	meant to check if the pointers for the width and height
	return values were NULL, but instead dereferenced them.

	Here's the simple fix:

*** Icons.c.save	Wed Apr 20 11:54:52 1988
--- Icons.c	Wed Apr 20 12:31:59 1988
***************
*** 82,90 ****
       */
      XCopyPlane( dpy, bitmap, tile, IconGC, 0, 0, width, height, 0, 0, 1 );
  
!     if (*width_return)  *width_return = width;
!     if (*height_return) *height_return = height;
  
      return( tile );
  }
  
--- 82,90 ----
       */
      XCopyPlane( dpy, bitmap, tile, IconGC, 0, 0, width, height, 0, 0, 1 );
  
!     if (width_return)  *width_return = width;
!     if (height_return) *height_return = height;
  
      return( tile );
  }
  
Dave Cohrs
+1 608 262-6617                        UW-Madison Computer Sciences Department
dave@cs.wisc.edu                 ...!{harvard,ihnp4,rutgers,ucbvax}!uwvax!dave

rpd@CS.CMU.EDU (Richard Draves) (04/21/88)

I reported this bug and the fix to xbugs many weeks ago.  Too bad it didn't
come out as a patch in time to help you.

Rich

dave@CS.WISC.EDU (Dave Cohrs) (04/21/88)

Well, I also reported it as a bug+fix to xbugs.  Perhaps with
two identical fixes, they'll process things.

That's why I sent a msg to comp.windows.x as well; xbugs has a terrible
turnaround time.

dave