diff options
author | Přemysl Janouch <p@janouch.name> | 2018-10-24 08:53:01 +0200 |
---|---|---|
committer | Přemysl Janouch <p@janouch.name> | 2018-10-24 10:23:37 +0200 |
commit | 6e879c9db9612a777bcd0ee009f3dca059124b72 (patch) | |
tree | 4c6cc2b05483665d37450666fd57fcd3235ed2f9 | |
parent | 45f79abf9c4833c37c8178b8e7fa983cd458eee5 (diff) | |
download | sdn-6e879c9db9612a777bcd0ee009f3dca059124b72.tar.gz sdn-6e879c9db9612a777bcd0ee009f3dca059124b72.tar.xz sdn-6e879c9db9612a777bcd0ee009f3dca059124b72.zip |
Defer keypad() invocation
-rw-r--r-- | sdn.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -814,8 +814,7 @@ int main (int argc, char *argv[]) { } locale::global (locale ("")); - if (!initscr () || cbreak () == ERR || noecho () == ERR || nonl () == ERR - || halfdelay (1) == ERR || keypad (stdscr, TRUE) == ERR) { + if (!initscr () || cbreak () == ERR || noecho () == ERR || nonl () == ERR) { cerr << "cannot initialize screen" << endl; return 1; } @@ -825,6 +824,14 @@ int main (int argc, char *argv[]) { g.start_dir = g.cwd; update (); + // Invoking keypad() earlier would make ncurses flush its output buffer, + // which would worsen start-up flickering + if (halfdelay (1) == ERR || keypad (stdscr, TRUE) == ERR) { + endwin (); + cerr << "cannot initialize screen" << endl; + return 1; + } + wint_t c; while (1) { inotify_check (); |