MCPcopy Create free account
hub / github.com/NetHack/NetHack / X11_get_ext_cmd

Function X11_get_ext_cmd

win/X11/winmisc.c:1560–1586  ·  view source on GitHub ↗

called by core to have the player pick an extended command */

Source from the content-addressed store, hash-verified

1558
1559/* called by core to have the player pick an extended command */
1560int
1561X11_get_ext_cmd(void)
1562{
1563 if (iflags.extmenu != ec_full_list) {
1564 /* player has toggled the 'extmenu' option, toss the old widgets */
1565 if (extended_commands)
1566 release_extended_cmds(); /* will set extended_commands to Null */
1567 ec_full_list = iflags.extmenu;
1568 }
1569 if (!extended_commands)
1570 init_extended_commands_popup();
1571
1572 extended_cmd_selected = -1; /* reset selected value */
1573 ec_scroll_to_view(-1); /* force scroll bar to top */
1574
1575 positionpopup(extended_command_popup, FALSE); /* center on cursor */
1576 nh_XtPopup(extended_command_popup, (int) XtGrabExclusive,
1577 extended_command_form);
1578
1579 /* The callbacks will enable the event loop exit. */
1580 (void) x_event(EXIT_ON_EXIT);
1581
1582 if (extended_cmd_selected < 0) {
1583 return -1;
1584 }
1585 return command_indx[extended_cmd_selected];
1586}
1587
1588void
1589release_extended_cmds(void)

Callers

nothing calls this directly

Calls 6

release_extended_cmdsFunction · 0.85
ec_scroll_to_viewFunction · 0.85
positionpopupFunction · 0.85
nh_XtPopupFunction · 0.85
x_eventFunction · 0.85

Tested by

no test coverage detected