diff options
author | Sadrul Habib Chowdhury <sadrul@users.sourceforge.net> | 2009-06-12 16:55:07 -0400 |
---|---|---|
committer | Sadrul Habib Chowdhury <sadrul@users.sourceforge.net> | 2009-06-12 16:55:07 -0400 |
commit | df5b7de831fd8b7ba65117cc8c4073abf607d01c (patch) | |
tree | 34f8b4924bbf186923a87af5706b55335837a6fe | |
parent | 58dd19429633b0795212f651ef4cfcd6f47c7da6 (diff) | |
download | screen-df5b7de831fd8b7ba65117cc8c4073abf607d01c.tar.gz |
Function to compare windows.
-rw-r--r-- | src/python.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/python.c b/src/python.c index ce59f39..358abc9 100644 --- a/src/python.c +++ b/src/python.c @@ -64,6 +64,10 @@ typedef struct PyObject * (*conv)(void *); } SPyClosure; + +#define compare_display NULL +#define compare_callback NULL + #define REGISTER_TYPE(type, Type, closures, methods) \ static int \ register_##type(PyObject *module) \ @@ -80,6 +84,7 @@ register_##type(PyObject *module) \ } \ PyType##Type.tp_getset = getsets; \ PyType##Type.tp_methods = methods; \ + PyType##Type.tp_compare = compare_##type; \ PyType_Ready(&PyType##Type); \ Py_INCREF(&PyType##Type); \ PyModule_AddObject(module, #Type, (PyObject *)&PyType##Type); \ @@ -151,6 +156,15 @@ static PyMethodDef wmethods[] = { {NULL}, }; +static int +compare_window(PyWindow *one, PyWindow *two) +{ + struct win *wone = one->_obj; + struct win *wtwo = two->_obj; + + return wtwo->w_number - wone->w_number; +} + REGISTER_TYPE(window, Window, wclosures, wmethods) #undef SPY_CLOSURE /** }}} */ |