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

Function mac_nhgetch

outdated/sys/mac/macwin.c:1701–1761  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1699}
1700
1701int
1702mac_nhgetch(void)
1703{
1704 int ch;
1705 long doDawdle = 1L;
1706 EventRecord anEvent;
1707
1708#if 1 //!TARGET_API_MAC_CARBON
1709 /* We want to take care of keys in the buffer as fast as
1710 * possible
1711 */
1712 if (keyQueueCount)
1713 doDawdle = 0L;
1714 else {
1715 long total, contig;
1716 static char warn = 0;
1717
1718 doDawdle = (in_topl_mode() ? GetCaretTime() : 120L);
1719 /* Since we have time, check memory */
1720 PurgeSpace(&total, &contig);
1721 if (contig < 25000L || total < 50000L) {
1722 if (!warn) {
1723 pline("Low Memory!");
1724 warn = 1;
1725 }
1726 } else {
1727 warn = 0;
1728 }
1729 }
1730#endif
1731
1732 do {
1733#if TARGET_API_MAC_CARBON
1734 QDFlushPortBuffer(GetWindowPort(_mt_window), NULL);
1735#endif
1736#if 0 // TARGET_API_MAC_CARBON
1737 EventRef event;
1738
1739 if (ReceiveNextEvent(0, NULL, kEventDurationForever, TRUE, &event) == noErr) {
1740 SendEventToEventTarget(event, dispatcher);
1741 ReleaseEvent(event);
1742 }
1743#else
1744 (void) WaitNextEvent(everyEvent, &anEvent, doDawdle, gMouseRgn);
1745 HandleEvent(&anEvent);
1746#endif
1747 ch = GetFromKeyQueue();
1748 } while (!ch && !gClickedToMove);
1749
1750 if (!gClickedToMove)
1751 ObscureCursor();
1752 else
1753 gClickedToMove = 0;
1754
1755#ifdef THINK_C
1756 if (ch == '\r')
1757 ch = '\n';
1758#endif

Callers 3

mac_display_nhwindowFunction · 0.85
mac_nh_poskeyFunction · 0.85
mac_select_menuFunction · 0.85

Calls 4

in_topl_modeFunction · 0.85
HandleEventFunction · 0.85
GetFromKeyQueueFunction · 0.85
plineFunction · 0.50

Tested by

no test coverage detected