X11 menus - support pre-selected menu entries

X11 had been ignoring add_menu(..., MENU_SELECTED) to specify a
pre-selected menu entry.  This adds support for that.

Attempt to implement pre-selected entry for PICK_ONE menu sanely by
returning the pre-selected entry instead of toggling it off if the
user chooses it explicitly.   Inner workings of menus are convoluted
so I'm not sure it's 100% correct, although testing hasn't found any
problems.  (tty currently returns 0 for "nothing picked" when
explicitly picking a pre-selected entry in a PICK_ONE menu, and the
core jumps through hoops to handle it.  That can't be cleaned up until
all interfaces which support pre-selected entries achieve sanity.)

Make "random" be chosen for <return> or <enter> during role selection
and highlight it to reflect that.  (Role selection for X11 uses its
own code instead of nethack menus, so pre-selection isn't applicable.)
This commit is contained in:
PatR
2016-01-30 19:39:29 -08:00
parent df41e8f203
commit 757c51bb3c
4 changed files with 199 additions and 247 deletions

View File

@@ -164,6 +164,7 @@ MacOSX: force TIMED_DELAY build option on so that 'runmode' run-time option
X11: core bug for '`' (backtick) and #terrain commands was only noticed by
X11 interface: impossible "add_menu: called before start_menu"
X11: enable a scroll bar in menu windows
X11: support pre-selected entries in menu windows
X11: make the extended command menu be easier to use and look a little nicer
X11: make the getline text entry widget display a bigger text entry area