*/
static void PythonMouseCallback(ob::MouseData *data, void *pyfunc)
{
- PyObject *func, *arglist, *pdata;
- PyObject *result;
- double dres = 0;
-
- func = (PyObject*) pyfunc;
+ PyObject *arglist, *pdata, *result;
pdata = SWIG_NewPointerObj((void *) data, SWIGTYPE_p_ob__MouseData, 0);
arglist = Py_BuildValue("(O)", pdata);
Py_DECREF(pdata);
// call the callback
- result = PyEval_CallObject(func, arglist);
+ result = PyEval_CallObject((PyObject*)pyfunc, arglist);
if (!result || PyErr_Occurred()) {
// an exception occured in the script, display it
PyErr_Print();
*/
static void PythonKeyCallback(ob::KeyData *data, void *pyfunc)
{
- PyObject *func, *arglist, *pdata;
- PyObject *result;
- double dres = 0;
-
- func = (PyObject*) pyfunc;
+ PyObject *arglist, *pdata, *result;
pdata = SWIG_NewPointerObj((void *) data, SWIGTYPE_p_ob__KeyData, 0);
arglist = Py_BuildValue("(O)", pdata);
Py_DECREF(pdata);
// call the callback
- result = PyEval_CallObject(func, arglist);
+ result = PyEval_CallObject((PyObject*)pyfunc, arglist);
if (!result || PyErr_Occurred()) {
// an exception occured in the script, display it
PyErr_Print();
*/
static void PythonEventCallback(ob::EventData *data, void *pyfunc)
{
- PyObject *func, *arglist, *pdata;
- PyObject *result;
- double dres = 0;
-
- func = (PyObject*) pyfunc;
+ PyObject *arglist, *pdata, *result;
pdata = SWIG_NewPointerObj((void *) data, SWIGTYPE_p_ob__EventData, 0);
arglist = Py_BuildValue("(O)", pdata);
Py_DECREF(pdata);
// call the callback
- result = PyEval_CallObject(func, arglist);
+ result = PyEval_CallObject((PyObject*)pyfunc, arglist);
if (!result || PyErr_Occurred()) {
// an exception occured in the script, display it
PyErr_Print();
PyErr_SetString(PyExc_RuntimeError,"Unable to add binding.");
return false;
}
+ Py_INCREF(func);
return true;
}
PyErr_SetString(PyExc_RuntimeError,"Unable to add binding.");
return false;
}
+ Py_INCREF(func);
return true;
}
PyErr_SetString(PyExc_RuntimeError,"Unable to grab keybaord.");
return false;
}
+ Py_INCREF(func);
return true;
}
PyErr_SetString(PyExc_RuntimeError,"Unable to add binding.");
return false;
}
+ Py_INCREF(func);
return true;
}
}
void send_client_msg(Window target, Atom type, Window about,
- long data, long data1, long data2,
- long data3, long data4)
+ long data=0, long data1=0, long data2=0,
+ long data3=0, long data4=0)
{
XEvent e;
e.xclient.type = ClientMessage;
&e);
}
-void execute(const std::string &bin, int screen)
+void execute(const std::string &bin, int screen=0)
{
if (screen >= ScreenCount(**otk::display))
screen = 0;