[comp.windows.x] twm fixes

rpd@CS.CMU.EDU (Richard Draves) (11/17/88)

These are fixes for the twm that came on the R3 tape.  In twm.c, I added some
casts to make my compiler (hc2 on RTs) happy.  In add_window.c, I fixed the code
that fetches the icon window name property.  Evidently the XGetWindowProperty
call has changed in R3; now even if you don't get the property you want it still
sets the returned value to the null string, instead of leaving it unchanged as
in R2.

Rich

*** add_window.c.~1~    Wed Nov 16 16:03:32 1988
--- add_window.c        Wed Nov 16 16:18:52 1988
***************
*** 93,99 ****
      unsigned long valuemask;          /* mask for create windows */
      XSetWindowAttributes attributes;  /* attributes for create windows */
      int width, len;                   /* tmp variable */
!     int junk1, junk2, junk3;
      int x;
      Pixmap pm;                        /* tmp pixmap variable */
      XWindowChanges xwc;               /* change window structure */
--- 93,100 ----
      unsigned long valuemask;          /* mask for create windows */
      XSetWindowAttributes attributes;  /* attributes for create windows */
      int width, len;                   /* tmp variable */
!     Atom icon_type;
!     int junk2, junk3;
      int x;
      Pixmap pm;                        /* tmp pixmap variable */
      XWindowChanges xwc;               /* change window structure */
***************
*** 327,338 ****
      tmp_win->name_width = XTextWidth(TitleBarFont.font, tmp_win->name,
        strlen(tmp_win->name));

!     if (XGetWindowProperty(dpy, tmp_win->w, XA_WM_ICON_NAME, 0, 200, False,
!       XA_STRING, &junk1, &junk2, &junk3, &len, &tmp_win->icon_name))
        tmp_win->icon_name = tmp_win->name;

!     if (tmp_win->icon_name == NULL)
!       tmp_win->icon_name = tmp_win->name;

      tmp_win->iconified = FALSE;
      tmp_win->icon = FALSE;
--- 328,342 ----
      tmp_win->name_width = XTextWidth(TitleBarFont.font, tmp_win->name,
        strlen(tmp_win->name));

!     if ((XGetWindowProperty(dpy, tmp_win->w, XA_WM_ICON_NAME,
!                           0, 200, False,
!                           XA_STRING, &icon_type,
!                           &junk2, &junk3, &len,
!                           &tmp_win->icon_name) != Success) ||
!       (icon_type != XA_STRING))
        tmp_win->icon_name = tmp_win->name;

!     /* we know tmp_win->icon_name != NULL now */

      tmp_win->iconified = FALSE;
      tmp_win->icon = FALSE;
*** twm.c.~1~   Tue Nov 15 11:11:28 1988
--- twm.c       Tue Nov 15 11:12:14 1988
***************
*** 211,224 ****

      old_handler = signal(SIGINT, SIG_IGN);
      if (old_handler != SIG_IGN)
!       signal(SIGINT, Done);

      old_handler = signal(SIGHUP, SIG_IGN);
      if (old_handler != SIG_IGN)
!       signal(SIGHUP, Done);

!     signal(SIGQUIT, Done);
!     signal(SIGTERM, Done);

      Home = (char *)getenv("HOME");
      if (Home == NULL)
--- 211,224 ----

      old_handler = signal(SIGINT, SIG_IGN);
      if (old_handler != SIG_IGN)
!       signal(SIGINT, (int (*)()) Done);

      old_handler = signal(SIGHUP, SIG_IGN);
      if (old_handler != SIG_IGN)
!       signal(SIGHUP, (int (*)()) Done);

!     signal(SIGQUIT, (int (*)()) Done);
!     signal(SIGTERM, (int (*)()) Done);

      Home = (char *)getenv("HOME");
      if (Home == NULL)