summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorMasayuki Yamamoto <ma3yuki.8mamo10@gmail.com>2017-11-01 12:05:26 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-11-01 12:05:26 (GMT)
commit8bc7d63560024681dce9f40445f2877b2987e92c (patch)
treeb1e05ed1a68b1d8b0f3d7a5268c11922084dc29f /Include
parent280c22a82a6756e9caffef031c564fd98f1b50e7 (diff)
downloadcpython-8bc7d63560024681dce9f40445f2877b2987e92c.zip
cpython-8bc7d63560024681dce9f40445f2877b2987e92c.tar.gz
cpython-8bc7d63560024681dce9f40445f2877b2987e92c.tar.bz2
bpo-25720: Fix the method for checking pad state of curses WINDOW (#4164)
Modify the code to use ncurses is_pad() instead of checking WINDOW _flags field. If your platform does not provide the is_pad(), the existing way that checks the field will be enabled. Note: This change does not drop support for platforms where do not have both WINDOW _flags field and is_pad().
Diffstat (limited to 'Include')
-rw-r--r--Include/py_curses.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/Include/py_curses.h b/Include/py_curses.h
index 2e88112..597f419 100644
--- a/Include/py_curses.h
+++ b/Include/py_curses.h
@@ -10,11 +10,6 @@
#ifdef _BSD_WCHAR_T_DEFINED_
#define _WCHAR_T
#endif
-
-/* the following define is necessary for OS X 10.6; without it, the
- Apple-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python
- can't get at the WINDOW flags field. */
-#define NCURSES_OPAQUE 0
#endif /* __APPLE__ */
#ifdef __FreeBSD__
@@ -44,6 +39,13 @@
#endif
#endif
+#if !defined(HAVE_CURSES_IS_PAD) && defined(WINDOW_HAS_FLAGS)
+/* The following definition is necessary for ncurses 5.7; without it,
+ some of [n]curses.h set NCURSES_OPAQUE to 1, and then Python
+ can't get at the WINDOW flags field. */
+#define NCURSES_OPAQUE 0
+#endif
+
#ifdef HAVE_NCURSES_H
#include <ncurses.h>
#else
@@ -52,10 +54,13 @@
#ifdef HAVE_NCURSES_H
/* configure was checking <curses.h>, but we will
- use <ncurses.h>, which has all these features. */
-#ifndef WINDOW_HAS_FLAGS
+ use <ncurses.h>, which has some or all these features. */
+#if !defined(WINDOW_HAS_FLAGS) && !(NCURSES_OPAQUE+0)
#define WINDOW_HAS_FLAGS 1
#endif
+#if !defined(HAVE_CURSES_IS_PAD) && NCURSES_VERSION_PATCH+0 >= 20090906
+#define HAVE_CURSES_IS_PAD 1
+#endif
#ifndef MVWDELCH_IS_EXPRESSION
#define MVWDELCH_IS_EXPRESSION 1
#endif