aboutsummaryrefslogtreecommitdiff
path: root/lib/actions
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-11-25 17:18:48 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-11-25 17:18:48 +0000
commit6dcb75c26bbfec04b381bb99d75404f9fe50635d (patch)
treeb4b0e4e7b92c2d6563a848279cb5b48e7e183f96 /lib/actions
parent26a6141301937e0ef501b4cd7ae61b4f2293b7e5 (diff)
downloadenigma2-6dcb75c26bbfec04b381bb99d75404f9fe50635d.tar.gz
enigma2-6dcb75c26bbfec04b381bb99d75404f9fe50635d.zip
python object refcount debugging code second try
Diffstat (limited to 'lib/actions')
-rw-r--r--lib/actions/action.cpp15
-rw-r--r--lib/actions/action.h7
2 files changed, 10 insertions, 12 deletions
diff --git a/lib/actions/action.cpp b/lib/actions/action.cpp
index 8b298ead..56ad89a1 100644
--- a/lib/actions/action.cpp
+++ b/lib/actions/action.cpp
@@ -54,12 +54,11 @@ void eActionMap::bindAction(const std::string &context, int priority, int id, eW
bnd.m_context = context;
bnd.m_widget = widget;
- bnd.m_fnc = 0;
bnd.m_id = id;
m_bindings.insert(std::pair<int,eActionBinding>(priority, bnd));
}
-void eActionMap::bindAction(const std::string &context, int priority, PyObject *function)
+void eActionMap::bindAction(const std::string &context, int priority, ePyObject function)
{
eActionBinding bnd;
@@ -80,7 +79,7 @@ void eActionMap::unbindAction(eWidget *widget, int id)
}
}
-void eActionMap::unbindAction(const std::string &context, PyObject *function)
+void eActionMap::unbindAction(const std::string &context, ePyObject function)
{
for (std::multimap<int, eActionBinding>::iterator i(m_bindings.begin()); i != m_bindings.end(); ++i)
{
@@ -126,11 +125,11 @@ void eActionMap::bindKey(const std::string &device, int key, int flags, const st
struct call_entry
{
- PyObject *m_fnc, *m_arg;
+ ePyObject m_fnc, m_arg;
eWidget *m_widget;
void *m_widget_arg, *m_widget_arg2;
- call_entry(PyObject *fnc, PyObject *arg): m_fnc(fnc), m_arg(arg), m_widget(0), m_widget_arg(0) { }
- call_entry(eWidget *widget, void *arg, void *arg2): m_fnc(0), m_arg(0), m_widget(widget), m_widget_arg(arg), m_widget_arg2(arg2) { }
+ call_entry(ePyObject fnc, ePyObject arg): m_fnc(fnc), m_arg(arg), m_widget(0), m_widget_arg(0) { }
+ call_entry(eWidget *widget, void *arg, void *arg2): m_widget(widget), m_widget_arg(arg), m_widget_arg2(arg2) { }
};
void eActionMap::keyPressed(const std::string &device, int key, int flags)
@@ -183,7 +182,7 @@ void eActionMap::keyPressed(const std::string &device, int key, int flags)
((k->second.m_device == device) || (k->second.m_device == "generic"))
)
{
- PyObject *pArgs = PyTuple_New(2);
+ ePyObject pArgs = PyTuple_New(2);
PyTuple_SET_ITEM(pArgs, 0, PyString_FromString(k->first.c_str()));
PyTuple_SET_ITEM(pArgs, 1, PyString_FromString(k->second.m_action.c_str()));
++k;
@@ -195,7 +194,7 @@ void eActionMap::keyPressed(const std::string &device, int key, int flags)
} else
{
eDebug("wildcard.");
- PyObject *pArgs = PyTuple_New(2);
+ ePyObject pArgs = PyTuple_New(2);
PyTuple_SET_ITEM(pArgs, 0, PyInt_FromLong(key));
PyTuple_SET_ITEM(pArgs, 1, PyInt_FromLong(flags));
Py_INCREF(i->second.m_fnc);
diff --git a/lib/actions/action.h b/lib/actions/action.h
index 560fdbbf..f2e0d8f4 100644
--- a/lib/actions/action.h
+++ b/lib/actions/action.h
@@ -7,7 +7,6 @@
#include <features.h>
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200112L
-#include <Python.h>
#include <lib/python/python.h>
#include <string>
#include <map>
@@ -29,8 +28,8 @@ public:
void unbindAction(eWidget *widget, int id);
#endif
- void bindAction(const std::string &context, int priority, PyObject *function);
- void unbindAction(const std::string &context, PyObject *function);
+ void bindAction(const std::string &context, int priority, SWIG_PYOBJECT(ePyObject) function);
+ void unbindAction(const std::string &context, SWIG_PYOBJECT(ePyObject) function);
void bindKey(const std::string &device, int key, int flags, const std::string &context, const std::string &action);
@@ -45,7 +44,7 @@ private:
// eActionContext *m_context;
std::string m_context; // FIXME
- PyObject *m_fnc;
+ ePyObject m_fnc;
eWidget *m_widget;
int m_id;