X11 extended commands menu scrolling

Support for scrolling within menus via first-/previous-/next-/last-
page keystrokes ("^<>|" by default) was added to X11's general menu
handling but the extended commands menu uses a special menu rather
than a general one.  This clones the relevant code to add support for
those keys to extended commands.
This commit is contained in:
PatR
2019-04-01 09:27:09 -07:00
parent 0cad960428
commit 10dac50433
2 changed files with 27 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.295 $ $NHDT-Date: 1554134321 2019/04/01 15:58:41 $
$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.296 $ $NHDT-Date: 1554136021 2019/04/01 16:27:01 $
This fixes36.2 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.1 in April 2018. Please note, however,
@@ -501,6 +501,7 @@ X11: its use of genl_status_update exposed a negative index use that could
X11: rollback disabling of keystroke input for PICK_NONE menus (for scrolling)
X11: make use of the 'extmenu' option: On to choose among all commands, Off
to choose among the traditional extended command subset
X11: support menu scrolling via (^ < > |) in the extended commands menu
curses: catch up with tty to not put dolook/whatis autodescribe feedback into
^P message recall (multi-digit count feedback was already handled)
curses: if the interface code ran out of memory, it would crash rather than
@@ -614,7 +615,7 @@ windows-tty: add support for mouse_support:0 (disabled), mouse_support:1
X11: implement menucolors and allow menus to obey some attributes
X11: make key translations work with menus on Linux
X11: allow mouse wheel scrolling to work in menus by default
X11: handle paged menu control keys
X11: handle menu scrolling via first-/previous-/next-/last-page keys (^ < > |)
X11: remember perm_invent window geometry
X11: handle X errors via panic
X11: don't reuse perm_invent window for picking an object

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 winmisc.c $NHDT-Date: 1554134316 2019/04/01 15:58:36 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.43 $ */
/* NetHack 3.6 winmisc.c $NHDT-Date: 1554135506 2019/04/01 16:18:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.44 $ */
/* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */
@@ -1856,11 +1856,12 @@ String *params;
Cardinal *num_params;
{
char ch;
int i;
int pass;
int i, pass;
float shown, top;
Arg arg[2];
Widget hbar, vbar;
XKeyEvent *xkey = (XKeyEvent *) event;
nhUse(w);
nhUse(params);
nhUse(num_params);
@@ -1888,6 +1889,25 @@ Cardinal *num_params;
exit_x_event = TRUE; /* leave event loop */
ec_active = FALSE;
return;
} else if (ch == MENU_FIRST_PAGE || ch == MENU_LAST_PAGE) {
hbar = vbar = (Widget) 0;
find_scrollbars(w, &hbar, &vbar);
if (vbar) {
top = (ch == MENU_FIRST_PAGE) ? 0.0 : 1.0;
XtCallCallbacks(vbar, XtNjumpProc, &top);
}
return;
} else if (ch == MENU_NEXT_PAGE || ch == MENU_PREVIOUS_PAGE) {
hbar = vbar = (Widget) 0;
find_scrollbars(w, &hbar, &vbar);
if (vbar) {
XtSetArg(arg[0], nhStr(XtNshown), &shown);
XtSetArg(arg[1], nhStr(XtNtopOfThumb), &top);
XtGetValues(vbar, arg, TWO);
top += ((ch == MENU_NEXT_PAGE) ? shown : -shown);
XtCallCallbacks(vbar, XtNjumpProc, &top);
}
return;
}
/*