From: Max Kellermann Date: Mon, 20 Mar 2017 16:16:35 +0000 (+0100) Subject: screen_utils: move check to ignore_key() X-Git-Tag: v0.27~36 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=aef88fd9eb8d3969ad4352f17b6532195d30771d;p=ncmpc.git screen_utils: move check to ignore_key() --- diff --git a/src/screen_utils.c b/src/screen_utils.c index 28d5e4b..891b9b3 100644 --- a/src/screen_utils.c +++ b/src/screen_utils.c @@ -38,6 +38,12 @@ screen_bell(void) flash(); } +static bool +ignore_key(int key) +{ + return key == ERR; +} + int screen_getch(const char *prompt) { @@ -52,8 +58,7 @@ screen_getch(const char *prompt) curs_set(1); int key; - while ((key = wgetch(w)) == ERR) - ; + while (ignore_key(key = wgetch(w))) {} #ifdef HAVE_GETMOUSE /* ignore mouse events */