X11: Don't reuse perm_invent window for picking an object

The core wants to reuse the permanent inventory window for choosing
an object from inventory, but the perm_invent window could be
hard to focus - it could even be on another display!

Instead, create a temporary new window from which the user can
pick an inventory item.
This commit is contained in:
Pasi Kallinen
2018-10-16 17:39:42 +03:00
parent e0f5cfe0b3
commit ddf6d13fd1
2 changed files with 18 additions and 0 deletions

View File

@@ -236,6 +236,7 @@ X11: allow mouse wheel scrolling to work in menus by default
X11: handle paged menu control keys
X11: remember perm_invent window geometry
X11: handle X errors via panic
X11: don't reuse perm_invent window for picking an object
General New Features

View File

@@ -957,6 +957,23 @@ menu_item **menu_list;
create_menu_translation_tables();
if (menu_info->permi && how != PICK_NONE) {
/* Core is reusing perm_invent window for picking an item.
But it could be even on a different screen!
Create a new temp window for it instead. */
winid newwin = X11_create_nhwindow(NHW_MENU);
struct xwindow *nwp = &window_list[newwin];
X11_start_menu(newwin);
move_menu(&menu_info->new_menu, &nwp->menu_information->new_menu);
for (curr = nwp->menu_information->new_menu.base; curr; curr = curr->next)
curr->window = newwin;
nwp->menu_information->permi = FALSE;
int ret = X11_select_menu(newwin, how, menu_list);
destroy_menu_entry_widgets(nwp);
X11_destroy_nhwindow(newwin);
return ret;
}
menu_info->how = (short) how;
/* collect group accelerators; for PICK_NONE, they're ignored;