tasknc: fix build with ncurses 6.3

This commit is contained in:
Michal Vasilek 2022-11-24 23:05:35 +01:00
parent 5517a3e7f8
commit 960e4610a1
1 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,36 @@
From f74ea0641e9bf287acf22fac9f6eeea571b01800 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyich@gmail.com>
Date: Sat, 6 Nov 2021 11:28:04 +0000
Subject: [PATCH] src/keys.c: used KEY_EVENT only if it exists
On ncurses-6.3 the build fails as:
src/keys.c:122:6: error: 'KEY_EVENT' undeclared here (not in a function); did you mean 'KEY_SLEFT'?
122 | {KEY_EVENT, "event"},
| ^~~~~~~~~
| KEY_SLEFT
ncurses-6.3 deprecated KEY_EVENT as:
* mark wgetch-events feature as deprecated.
+ prevent KEY_EVENT from appearing in curses.h unless the
configure option --enable-wgetch-events is used.
---
src/keys.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/keys.c b/src/keys.c
index f62bdae..d35e425 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -119,7 +119,10 @@ struct keymap keymaps[] = {
{KEY_UNDO, "undo"},
{KEY_MOUSE, "mouse"},
{KEY_RESIZE, "resize"},
+/* Optional deprecated ncurses feature. */
+#ifdef KEY_EVENT
{KEY_EVENT, "event"},
+#endif
{1, "C-a"},
{2, "C-b"},
{3, "C-c"},