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

Method qt_nhgetch

win/Qt/qt_bind.cpp:636–667  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

634}
635
636int NetHackQtBind::qt_nhgetch()
637{
638 if (main)
639 main->fadeHighlighting(true);
640
641 // Process events until a key arrives.
642 //
643 while (keybuffer.Empty()) {
644 int exc = qApp->exec();
645 /*
646 * On OSX (possibly elsewhere), this prevents an infinite
647 * loop repeatedly issuing the complaint:
648QCoreApplication::exec: The event loop is already running
649 * to stderr if you synchronously start nethack from a terminal
650 * then switch focus back to that terminal and type ^C.
651 * SIGINT -> done1() -> done2() -> yn_function("Really quit?")
652 * in the core asks for another keystroke.
653 *
654 * However, it still issues one such complaint, and whatever
655 * prompt wanted a response ("Really quit?") is shown in the
656 * message window but is auto-answered with ESC.
657 */
658 if (exc == -1)
659 keybuffer.Put('\033');
660 }
661
662 // after getting a key rather than before
663 if (main)
664 main->fadeHighlighting(false);
665
666 return keybuffer.GetAscii();
667}
668
669#ifdef IDLECHECKPOINT
670void

Callers

nothing calls this directly

Calls 4

fadeHighlightingMethod · 0.45
EmptyMethod · 0.45
PutMethod · 0.45
GetAsciiMethod · 0.45

Tested by

no test coverage detected