[w3m-dev-en 00040] Re: Remaining difference xterm/gpm <-> sysmouse

From: Christian Weisgerber (w3m-dev-en@mips.rhein-neckar.de)
Date: Wed Jan 26 2000 - 09:31:44 CST


Hironori Sakamoto <h-saka@lsi.nec.co.jp> wrote:

> >> - The option menu pops up with the current value of the option
> >> pre-selected.
[Then the menu is canceled.]
> >> With xterm/gpm, the value is the old one, which was preselected.
> >> With sysmouse, the value is always set to the first one in the
>
> I don't understatnd that behaviour.
> The value pre-selected isn't related to mouse.

I found the bug. You are right, it isn't related to the mouse.

In formChooseOptionByMenu(), optionMenu() is called and the variable
"selected" is used to set the new option value.

> optionMenu -> new_option_menu (make structure of menu)
> -> popup_menu (display menu)
                                          -> action_menu()

A pointer to "selected" is put into the menu structure and propagates
through this call path. In action_menu(), the variable pointed to
is only assigned a value *if* an option has been selected:

  if (select >= 0 && select < menu->nitem) {
    ...
    if (item.type & MENU_VALUE)
      *item.variable = item.value;
    ...
  } else if (select == MENU_CLOSE) {
    ...
  }
  return(0);

Returning to formChooseOptionByMenu(), "selected" is *not initialized*
if the menu has been canceled, causing unpredictable results.

(On this machine "selected" is always 0 with sysmouse, 135227392
with xterm...)

I don't have a patch, but with this description somebody who actually
understands the menu code should be able to fix the problem.

-- 
Christian "naddy" Weisgerber                     naddy@unix-ag.uni-kl.de



This archive was generated by hypermail 2b29 : Wed Jul 19 2000 - 10:30:43 CDT