components/python/python26/patches/Python26-27-get_wch.patch
changeset 4984 7145b15b7f0d
parent 4983 db2589571faa
child 4985 eed3576cafd0
equal deleted inserted replaced
4983:db2589571faa 4984:7145b15b7f0d
     1 --- Python-2.6.8/Modules/_cursesmodule.c.orig	2012-09-18 08:01:45.938603187 -0700
       
     2 +++ Python-2.6.8/Modules/_cursesmodule.c	2012-09-18 08:05:15.216646894 -0700
       
     3 @@ -856,6 +856,37 @@
       
     4  }
       
     5  
       
     6  static PyObject *
       
     7 +PyCursesWindow_Get_WCh(PyCursesWindowObject *self, PyObject *args)
       
     8 +{
       
     9 +    int x, y;
       
    10 +    int ct;
       
    11 +    wint_t rtn;
       
    12 +
       
    13 +    switch (PyTuple_Size(args)) {
       
    14 +    case 0:
       
    15 +        Py_BEGIN_ALLOW_THREADS
       
    16 +        ct = wget_wch(self->win,&rtn);
       
    17 +        Py_END_ALLOW_THREADS
       
    18 +        break;
       
    19 +    case 2:
       
    20 +        if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x))
       
    21 +            return NULL;
       
    22 +        Py_BEGIN_ALLOW_THREADS
       
    23 +        ct = mvwget_wch(self->win,y,x,&rtn);
       
    24 +        Py_END_ALLOW_THREADS
       
    25 +        break;
       
    26 +    default:
       
    27 +        PyErr_SetString(PyExc_TypeError, "get_wch requires 0 or 2 arguments");
       
    28 +        return NULL;
       
    29 +    }
       
    30 +    if (ct == ERR) {
       
    31 +        PyErr_SetString(PyCursesError, "get_wch failed");
       
    32 +        return NULL;
       
    33 +    }
       
    34 +    return PyInt_FromLong((long)rtn);
       
    35 +}
       
    36 +
       
    37 +static PyObject *
       
    38  PyCursesWindow_GetKey(PyCursesWindowObject *self, PyObject *args)
       
    39  {
       
    40      int x, y;
       
    41 @@ -1563,6 +1594,7 @@
       
    42              {"getbegyx",        (PyCFunction)PyCursesWindow_getbegyx, METH_NOARGS},
       
    43              {"getbkgd",         (PyCFunction)PyCursesWindow_GetBkgd, METH_NOARGS},
       
    44              {"getch",           (PyCFunction)PyCursesWindow_GetCh, METH_VARARGS},
       
    45 +            {"get_wch",         (PyCFunction)PyCursesWindow_Get_WCh, METH_VARARGS},
       
    46              {"getkey",          (PyCFunction)PyCursesWindow_GetKey, METH_VARARGS},
       
    47              {"getmaxyx",        (PyCFunction)PyCursesWindow_getmaxyx, METH_NOARGS},
       
    48              {"getparyx",        (PyCFunction)PyCursesWindow_getparyx, METH_NOARGS},