[comp.windows.x] bug fix for X.V11R3 twm

Richard.Draves@RPD.MACH.CS.CMU.EDU (11/28/88)

The twm in the contrib distribution of X.V11R3 doesn't handle colormap
notifications properly.  At least on my system (RT with Megapel & Moniterm,
running R2 server), a twm on the (black & white) Moniterm display works fine,
but a twm on the (color) Megapel display doesn't handle window movement or
resizing properly.  It also chews up mucho cycles communicating with the
server.  The server sends twm a ColormapNotify event; in response, twm does
an XInstallColormap; this generates another ColormapNotify event, etc.

I modified HandleColormapNotify as follows.  Disclaimer:  I don't know
anything about colormaps or what the ICCCM has to say about them.  However,
with this change twm seems to work OK on my color display.

Rich

*** events.c.~1~	Sun Nov 27 14:15:39 1988
--- events.c	Sun Nov 27 14:23:27 1988
***************
*** 202,214 ****
  void
  HandleColormapNotify()
  {
  #ifdef DEBUG
      fprintf(stderr, "ColormapNotify\n");
  #endif
-     if (tmp_win != NULL)
- 	XGetWindowAttributes(dpy, tmp_win->w, &tmp_win->attr);
  
!     if (tmp_win == Focus)
  	XInstallColormap(dpy, tmp_win->attr.colormap);
  }
  
--- 202,217 ----
  void
  HandleColormapNotify()
  {
+     XColormapEvent *cevent = (XColormapEvent *) &event;
+ 
  #ifdef DEBUG
      fprintf(stderr, "ColormapNotify\n");
  #endif
  
!     if ((cevent->new == True) && (tmp_win != NULL))
! 	tmp_win->attr.colormap = cevent->colormap;
! 
!     if ((cevent->state == ColormapUninstalled) && (tmp_win == Focus))
  	XInstallColormap(dpy, tmp_win->attr.colormap);
  }