@@ -105,8 +105,13 @@ static const char PyCursesVersion[] = "2.2";
105
105
#endif
106
106
107
107
#include "Python.h"
108
- #include "pycore_long.h" // _PyLong_GetZero()
109
- #include "pycore_structseq.h" // _PyStructSequence_NewType()
108
+
109
+ /* This function declaration was moved from pycore_structseq.h file to adapt
110
+ it for windows-curses package */
111
+ PyAPI_FUNC (int ) _PyStructSequence_InitType (
112
+ PyTypeObject * type ,
113
+ PyStructSequence_Desc * desc ,
114
+ unsigned long tp_flags );
110
115
111
116
#ifdef __hpux
112
117
#define STRICT_SYSV_CURSES
@@ -1116,9 +1121,9 @@ _curses_window_border_impl(PyCursesWindowObject *self, PyObject *ls,
1116
1121
_curses.window.box
1117
1122
1118
1123
[
1119
- verch: object(c_default="_PyLong_GetZero( )") = 0
1124
+ verch: object(c_default="PyLong_FromLong(0 )") = 0
1120
1125
Left and right side.
1121
- horch: object(c_default="_PyLong_GetZero( )") = 0
1126
+ horch: object(c_default="PyLong_FromLong(0 )") = 0
1122
1127
Top and bottom side.
1123
1128
]
1124
1129
/
@@ -1132,7 +1137,7 @@ horch. The default corner characters are always used by this function.
1132
1137
static PyObject *
1133
1138
_curses_window_box_impl (PyCursesWindowObject * self , int group_right_1 ,
1134
1139
PyObject * verch , PyObject * horch )
1135
- /*[clinic end generated code: output=f3fcb038bb287192 input=f00435f9c8c98f60 ]*/
1140
+ /*[clinic end generated code: output=f3fcb038bb287192 input=07797b056d82f6ab ]*/
1136
1141
{
1137
1142
chtype ch1 = 0 , ch2 = 0 ;
1138
1143
if (group_right_1 ) {
@@ -1415,6 +1420,12 @@ _curses_window_getch_impl(PyCursesWindowObject *self, int group_right_1,
1415
1420
else {
1416
1421
rtn = mvwgetch (self -> win , y , x );
1417
1422
}
1423
+
1424
+ // windows-curses hack to make resizing work the same as in ncurses. See
1425
+ // PDCurses' documentation for resize_term().
1426
+ if (rtn == KEY_RESIZE )
1427
+ resize_term (0 , 0 );
1428
+
1418
1429
Py_END_ALLOW_THREADS
1419
1430
1420
1431
return rtn ;
@@ -1452,6 +1463,12 @@ _curses_window_getkey_impl(PyCursesWindowObject *self, int group_right_1,
1452
1463
else {
1453
1464
rtn = mvwgetch (self -> win , y , x );
1454
1465
}
1466
+
1467
+ // windows-curses hack to make resizing work the same as in ncurses. See
1468
+ // PDCurses' documentation for resize_term().
1469
+ if (rtn == KEY_RESIZE )
1470
+ resize_term (0 , 0 );
1471
+
1455
1472
Py_END_ALLOW_THREADS
1456
1473
1457
1474
if (rtn == ERR ) {
@@ -1519,13 +1536,13 @@ _curses_window_get_wch_impl(PyCursesWindowObject *self, int group_right_1,
1519
1536
PyErr_SetString (PyCursesError , "no input" );
1520
1537
return NULL ;
1521
1538
}
1522
- if (ct == KEY_CODE_YES ){
1539
+ if (ct == KEY_CODE_YES ) {
1523
1540
// windows-curses hack to make resizing work the same as in ncurses. See
1524
1541
// PDCurses' documentation for resize_term().
1525
1542
if (rtn == KEY_RESIZE )
1526
1543
resize_term (0 , 0 );
1527
1544
1528
- return PyLong_FromLong (rtn );
1545
+ return PyLong_FromLong (rtn );
1529
1546
}
1530
1547
else
1531
1548
return PyUnicode_FromOrdinal (rtn );
0 commit comments