[comp.windows.x] bug in twm/tvtwm

brossard@sic.epfl.ch (Alain Brossard EPFL-SIC/SII) (03/21/91)

Bg:  X.V11R4, patch level 18

    If we try to use mod2 through mod5 as modifiers for pointer
binding with twm or tvtwm, it always fails.  Once we look at
the code, we can make key bindings work but at the risk of overwriting
random memory.

    The problem is that the mask used doesn't take into account
the modifiers above mod1 and the array that holds the pointers
bindings isn't big enough.

   Here are the patches for tvtwm, the same patches apply to twm.

diff -c -r1.1 gram.y
*** /tmp/,RCSt1a14499   Wed Mar 20 20:17:06 1991
--- gram.y      Wed Mar 20 18:44:52 1991
***************
*** 62,68 ****
  static int cont = 0;
  static int color;
  int mods = 0;
! unsigned int mods_used = (ShiftMask | ControlMask | Mod1Mask);

  extern int do_single_keyword(), do_string_keyword(), do_number_keyword();
  extern name_list **do_colorlist_keyword();
--- 63,70 ----
  static int cont = 0;
  static int color;
  int mods = 0;
! unsigned int mods_used = (ShiftMask | ControlMask | Mod1Mask | Mod2Mask |
!                       Mod3Mask | Mod4Mask | Mod5Mask );

  extern int do_single_keyword(), do_string_keyword(), do_number_keyword();
  extern name_list **do_colorlist_keyword();
diff -c -r1.1 twm.h
*** /tmp/,RCSt1a14506   Wed Mar 20 20:18:01 1991
--- twm.h       Wed Mar 20 18:48:13 1991
***************
*** 99,105 ****
                         C_ROOT_BIT | C_FRAME_BIT | C_ICONMGR_BIT)

  /* modifiers for button presses */
! #define MOD_SIZE      ((ShiftMask | ControlMask | Mod1Mask) + 1)

  #define TITLE_BAR_SPACE         1     /* 2 pixel space bordering chars */
  #define TITLE_BAR_FONT_HEIGHT   15    /* max of 15 pixel high chars */
--- 100,107 ----
                         C_ROOT_BIT | C_FRAME_BIT | C_ICONMGR_BIT)

  /* modifiers for button presses */
! #define MOD_SIZE      ((ShiftMask | ControlMask | Mod1Mask | \
!                       Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask) + 1)

  #define TITLE_BAR_SPACE         1     /* 2 pixel space bordering chars */
  #define TITLE_BAR_FONT_HEIGHT   15    /* max of 15 pixel high chars */
diff -c -r1.1 tvtwm.man
*** /tmp/,RCSt1a14520   Wed Mar 20 20:19:03 1991
--- tvtwm.man   Wed Mar 20 20:14:31 1991
***************
*** 942,948 ****
  .EE
  The \fImodlist\fP is any combination of the modifier names \fBshift\fP,
  \fBcontrol\fP, \fBlock\fP, \fBmeta\fP, \fBmod1\fP, \fBmod2\fP, \fBmod3\fP,
! \fBmod4\fP, or \fBmod1\fP (which may be abbreviated as
  \fBs\fP, \fBc\fP, \fBl\fP, \fBm\fP, \fBm1\fP, \fBm2\fP, \fBm3\fP, \fBm4\fP,
  \fBm5\fP, respectively) separated by a vertical bar (\(or).
  Similarly, the \fIcontext\fP is any combination of
--- 947,953 ----
  .EE
  The \fImodlist\fP is any combination of the modifier names \fBshift\fP,
  \fBcontrol\fP, \fBlock\fP, \fBmeta\fP, \fBmod1\fP, \fBmod2\fP, \fBmod3\fP,
! \fBmod4\fP, or \fBmod5\fP (which may be abbreviated as
  \fBs\fP, \fBc\fP, \fBl\fP, \fBm\fP, \fBm1\fP, \fBm2\fP, \fBm3\fP, \fBm4\fP,
  \fBm5\fP, respectively) separated by a vertical bar (\(or).
  Similarly, the \fIcontext\fP is any combination of
a