summaryrefslogtreecommitdiffstats
path: root/Include/py_curses.h
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2017-11-01 12:35:41 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-11-01 12:35:41 (GMT)
commitff6ae4de3874f4922a5883f08bb661c93834b060 (patch)
tree4f19cb9363c125dc7f91e180a58234b5ad05de9d /Include/py_curses.h
parent84e252b79eed94bc9e9175f82191322c89e489ad (diff)
downloadcpython-ff6ae4de3874f4922a5883f08bb661c93834b060.zip
cpython-ff6ae4de3874f4922a5883f08bb661c93834b060.tar.gz
cpython-ff6ae4de3874f4922a5883f08bb661c93834b060.tar.bz2
bpo-25720: Fix the method for checking pad state of curses WINDOW (GH-4164) (#4212)
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(). (cherry picked from commit 8bc7d63560024681dce9f40445f2877b2987e92c)
Diffstat (limited to 'Include/py_curses.h')
-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 2513646..b09dde4 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