X11 menu tweaks
Restore handling for keystrokes on PICK_NONE menus so that scrolling via keys works for them. (That handling was disabled as part of the patch to support MENUCOLORS.) Enable [cancel] button for all menus. (That had apparently been grayed out for PICK_NONE menus since day 1 for X11 windowing.)
This commit is contained in:
@@ -199,6 +199,7 @@ tty: fix leftover display artifact when the last field on the row got placed
|
|||||||
to its left, getting shorter
|
to its left, getting shorter
|
||||||
X11: its use of genl_status_update exposed a negative index use that could
|
X11: its use of genl_status_update exposed a negative index use that could
|
||||||
lead to a segfault
|
lead to a segfault
|
||||||
|
X11: rollback disabling of keystroke input for PICK_NONE menus (for scrolling)
|
||||||
|
|
||||||
|
|
||||||
Platform- and/or Interface-Specific Fixes
|
Platform- and/or Interface-Specific Fixes
|
||||||
@@ -248,6 +249,7 @@ X11: handle X errors via panic
|
|||||||
X11: don't reuse perm_invent window for picking an object
|
X11: don't reuse perm_invent window for picking an object
|
||||||
X11: obey mouse_support and allow toggling it in game
|
X11: obey mouse_support and allow toggling it in game
|
||||||
X11: obey menu movement keys
|
X11: obey menu movement keys
|
||||||
|
X11: enable menu [cancel] button for PICK_NONE menus
|
||||||
|
|
||||||
|
|
||||||
General New Features
|
General New Features
|
||||||
|
|||||||
@@ -1920,35 +1920,38 @@ char *input;
|
|||||||
|
|
||||||
/* Display file ----------------------------------------------------------- */
|
/* Display file ----------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* uses a menu (with no selectors specified) rather than a text window
|
||||||
|
to allow previous_page and first_menu actions to move backwards */
|
||||||
void
|
void
|
||||||
X11_display_file(str, complain)
|
X11_display_file(str, complain)
|
||||||
const char *str;
|
const char *str;
|
||||||
boolean complain;
|
boolean complain;
|
||||||
{
|
{
|
||||||
dlb *fp;
|
dlb *fp;
|
||||||
|
winid newwin;
|
||||||
|
struct xwindow *wp;
|
||||||
|
anything any;
|
||||||
|
menu_item *menu_list;
|
||||||
#define LLEN 128
|
#define LLEN 128
|
||||||
char line[LLEN];
|
char line[LLEN];
|
||||||
|
|
||||||
/* Use the port-independent file opener to see if the file exists. */
|
/* Use the port-independent file opener to see if the file exists. */
|
||||||
fp = dlb_fopen(str, RDTMODE);
|
fp = dlb_fopen(str, RDTMODE);
|
||||||
|
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
if (complain)
|
if (complain)
|
||||||
pline("Cannot open %s. Sorry.", str);
|
pline("Cannot open %s. Sorry.", str);
|
||||||
return; /* it doesn't exist, ignore */
|
return; /* it doesn't exist, ignore */
|
||||||
}
|
}
|
||||||
|
|
||||||
winid newwin = X11_create_nhwindow(NHW_MENU);
|
newwin = X11_create_nhwindow(NHW_MENU);
|
||||||
struct xwindow *wp = &window_list[newwin];
|
wp = &window_list[newwin];
|
||||||
anything any = zeroany;
|
|
||||||
menu_item *menu_list;
|
|
||||||
|
|
||||||
X11_start_menu(newwin);
|
X11_start_menu(newwin);
|
||||||
|
|
||||||
|
any = zeroany;
|
||||||
while (dlb_fgets(line, LLEN, fp)) {
|
while (dlb_fgets(line, LLEN, fp)) {
|
||||||
X11_add_menu(newwin, NO_GLYPH, &any, 0, 0, ATR_NONE, line, MENU_UNSELECTED);
|
X11_add_menu(newwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
|
||||||
|
line, MENU_UNSELECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) dlb_fclose(fp);
|
(void) dlb_fclose(fp);
|
||||||
|
|
||||||
/* show file name as the window title */
|
/* show file name as the window title */
|
||||||
|
|||||||
@@ -254,7 +254,8 @@ Cardinal *num_params;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menu_info->is_active && menu_info->how != PICK_NONE) { /* waiting for input */
|
/* don't exclude PICK_NONE menus; doing so disables scrolling via keys */
|
||||||
|
if (menu_info->is_active) { /* waiting for input */
|
||||||
/* first check for an explicit selector match, so that it won't be
|
/* first check for an explicit selector match, so that it won't be
|
||||||
overridden if it happens to duplicate a mapped menu command (':'
|
overridden if it happens to duplicate a mapped menu command (':'
|
||||||
to look inside a container vs ':' to select via search string) */
|
to look inside a container vs ':' to select via search string) */
|
||||||
@@ -324,12 +325,14 @@ Cardinal *num_params;
|
|||||||
} else if (ch == MENU_FIRST_PAGE || ch == MENU_LAST_PAGE) {
|
} else if (ch == MENU_FIRST_PAGE || ch == MENU_LAST_PAGE) {
|
||||||
Widget hbar = (Widget) 0, vbar = (Widget) 0;
|
Widget hbar = (Widget) 0, vbar = (Widget) 0;
|
||||||
float top = (ch == MENU_FIRST_PAGE) ? 0.0 : 1.0;
|
float top = (ch == MENU_FIRST_PAGE) ? 0.0 : 1.0;
|
||||||
|
|
||||||
find_scrollbars(wp->w, &hbar, &vbar);
|
find_scrollbars(wp->w, &hbar, &vbar);
|
||||||
if (vbar)
|
if (vbar)
|
||||||
XtCallCallbacks(vbar, XtNjumpProc, &top);
|
XtCallCallbacks(vbar, XtNjumpProc, &top);
|
||||||
return;
|
return;
|
||||||
} else if (ch == MENU_NEXT_PAGE || ch == MENU_PREVIOUS_PAGE) {
|
} else if (ch == MENU_NEXT_PAGE || ch == MENU_PREVIOUS_PAGE) {
|
||||||
Widget hbar = (Widget) 0, vbar = (Widget) 0;
|
Widget hbar = (Widget) 0, vbar = (Widget) 0;
|
||||||
|
|
||||||
find_scrollbars(wp->w, &hbar, &vbar);
|
find_scrollbars(wp->w, &hbar, &vbar);
|
||||||
if (vbar) {
|
if (vbar) {
|
||||||
float shown, top;
|
float shown, top;
|
||||||
@@ -1029,7 +1032,9 @@ Widget form,under;
|
|||||||
num_args = 0;
|
num_args = 0;
|
||||||
XtSetArg(args[num_args], nhStr(XtNfromVert), label); num_args++;
|
XtSetArg(args[num_args], nhStr(XtNfromVert), label); num_args++;
|
||||||
XtSetArg(args[num_args], nhStr(XtNfromHoriz), ok); num_args++;
|
XtSetArg(args[num_args], nhStr(XtNfromHoriz), ok); num_args++;
|
||||||
|
#if 0 /* [cancel] is a viable choice even for PICK_NONE */
|
||||||
XtSetArg(args[num_args], nhStr(XtNsensitive), how != PICK_NONE); num_args++;
|
XtSetArg(args[num_args], nhStr(XtNsensitive), how != PICK_NONE); num_args++;
|
||||||
|
#endif
|
||||||
XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
|
XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
|
||||||
XtSetArg(args[num_args], nhStr(XtNbottom), XtChainTop); num_args++;
|
XtSetArg(args[num_args], nhStr(XtNbottom), XtChainTop); num_args++;
|
||||||
XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
|
XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
|
||||||
|
|||||||
Reference in New Issue
Block a user