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

Function MenwKey

outdated/sys/mac/macwin.c:2577–2610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2575 */
2576
2577static void
2578MenwKey(NhWindow *wind, char ch)
2579{
2580 MacMHMenuItem *mi;
2581 int i;
2582
2583 ch = filter_scroll_key(ch, wind);
2584 if (!ch)
2585 return;
2586 if (ClosingWindowChar(ch)) {
2587 AddToKeyQueue(CHAR_CR, 1);
2588 return;
2589 }
2590
2591 if (!wind || !wind->menuInfo)
2592 return;
2593 HLock((char **) wind->menuInfo);
2594 for (i = 0, mi = *wind->menuInfo; i < wind->miLen; i++, mi++) {
2595 if (mi->accelerator == ch) {
2596 ToggleMenuListItemSelected(wind, i);
2597 if (mi->line >= wind->scrollPos && mi->line <= wind->y_size) {
2598 SetPortWindowPort(wind->its_window);
2599 ToggleMenuSelect(wind, mi->line - wind->scrollPos);
2600 }
2601 /* Dismiss window if only picking one item */
2602 if (wind->how != PICK_ANY)
2603 AddToKeyQueue(CHAR_CR, 1);
2604 break;
2605 }
2606 }
2607 HUnlock((char **) wind->menuInfo);
2608 /* add key if didn't find it in menu and not filtered */
2609 return;
2610}
2611
2612static void
2613MenwClick(NhWindow *wind, Point pt)

Callers 2

MenwEventFunction · 0.85
macKeyMenuFunction · 0.85

Calls 5

filter_scroll_keyFunction · 0.85
ClosingWindowCharFunction · 0.85
AddToKeyQueueFunction · 0.85
ToggleMenuSelectFunction · 0.85

Tested by

no test coverage detected