From: Max Kellermann Date: Mon, 20 Mar 2017 16:17:36 +0000 (+0100) Subject: screen_utils: move KEY_MOUSE check to ignore_key(), avoid recursion X-Git-Tag: v0.27~35 X-Git-Url: https://git.tokkee.org/?p=ncmpc.git;a=commitdiff_plain;h=4ec02f37ba70c59641c08bf9199e5c3395e8d1ff screen_utils: move KEY_MOUSE check to ignore_key(), avoid recursion --- diff --git a/src/screen_utils.c b/src/screen_utils.c index 891b9b3..8f69930 100644 --- a/src/screen_utils.c +++ b/src/screen_utils.c @@ -41,7 +41,12 @@ screen_bell(void) static bool ignore_key(int key) { - return key == ERR; + return +#ifdef HAVE_GETMOUSE + /* ignore mouse events */ + key == KEY_MOUSE || +#endif + key == ERR; } int @@ -60,12 +65,6 @@ screen_getch(const char *prompt) int key; while (ignore_key(key = wgetch(w))) {} -#ifdef HAVE_GETMOUSE - /* ignore mouse events */ - if (key == KEY_MOUSE) - return screen_getch(prompt); -#endif - noecho(); curs_set(0);