X11: set menu entries to same length
While testing the new mouse action menus, it was quite annoying to try and hit some shorter entries. Make all the selectable entries the same maximum length, and with text left justified.
This commit is contained in:
@@ -1371,6 +1371,7 @@ X11: with 'slow' resource set to False, the pop up yn_function didn't always
|
||||
X11: (possibly X11+OSX): if persistent inventory was displayed at time of
|
||||
end-of-game prompting, prompting would stall until that window was
|
||||
manually dismissed
|
||||
X11: set all selectable menu lines to the same length, left justified
|
||||
|
||||
|
||||
General New Features
|
||||
|
||||
@@ -1285,6 +1285,7 @@ menu_create_entries(struct xwindow *wp, struct menu *curr_menu)
|
||||
int how = wp->menu_information->how;
|
||||
Arg args[15];
|
||||
Cardinal num_args;
|
||||
Dimension cwidth, maxwidth = 0;
|
||||
|
||||
for (curr = curr_menu->base; curr; curr = curr->next) {
|
||||
char tmpbuf[BUFSZ];
|
||||
@@ -1296,6 +1297,7 @@ menu_create_entries(struct xwindow *wp, struct menu *curr_menu)
|
||||
|
||||
num_args = 0;
|
||||
XtSetArg(args[num_args], nhStr(XtNlabel), str); num_args++;
|
||||
XtSetArg(args[num_args], nhStr(XtNjustify), XtJustifyLeft); num_args++;
|
||||
XtSetArg(args[num_args], nhStr(XtNleft), XtChainLeft); num_args++;
|
||||
XtSetArg(args[num_args], nhStr(XtNright), XtChainLeft); num_args++;
|
||||
XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
|
||||
@@ -1352,6 +1354,22 @@ menu_create_entries(struct xwindow *wp, struct menu *curr_menu)
|
||||
XtAddCallback(linewidget, XtNcallback, menu_select,
|
||||
(XtPointer) curr);
|
||||
prevlinewidget = linewidget;
|
||||
|
||||
if (canpick) {
|
||||
/* get the current line width */
|
||||
XtSetArg(args[0], XtNwidth, &cwidth);
|
||||
XtGetValues(curr->w, args, ONE);
|
||||
if (maxwidth < cwidth)
|
||||
maxwidth = cwidth;
|
||||
}
|
||||
}
|
||||
|
||||
/* set all selectable menu entries to the maximum width */
|
||||
if (how != PICK_NONE) {
|
||||
XtSetArg(args[0], XtNwidth, maxwidth);
|
||||
for (curr = curr_menu->base; curr; curr = curr->next)
|
||||
if (curr->identifier.a_void)
|
||||
XtSetValues(curr->w, args, ONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user