From 345d957e1ea577480f807b892b73c3f52fe913d2 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 9 Jan 2003 22:54:31 +0000 Subject: [PATCH] new python callbacks data, infrastructure. going to rework bindings code. cvs wont work for shit now. but thats life. --- otk/display.cc | 11 + otk/display.hh | 22 +- otk/eventhandler.cc | 4 + otk/eventhandler.hh | 12 +- otk/otk_wrap.cc | 30 + src/actions.cc | 102 ++- src/actions.hh | 4 + src/bindings.cc | 20 +- src/openbox.cc | 20 +- src/openbox.i | 87 +++ src/openbox_wrap.cc | 1465 ++++++++++++++++++++++++++++++++++++++++++- src/python.cc | 368 +---------- src/python.hh | 120 ++-- src/screen.cc | 26 +- 14 files changed, 1798 insertions(+), 493 deletions(-) diff --git a/otk/display.cc b/otk/display.cc index 6fc6117c..5bd282e6 100644 --- a/otk/display.cc +++ b/otk/display.cc @@ -11,6 +11,10 @@ extern "C" { #include +#ifdef XKB +#include +#endif // XKB + #ifdef SHAPE #include #endif // SHAPE @@ -44,6 +48,8 @@ namespace otk { Display *OBDisplay::display = (Display*) 0; +bool OBDisplay::_xkb = false; +int OBDisplay::_xkb_event_basep = 0; bool OBDisplay::_shape = false; int OBDisplay::_shape_event_basep = 0; bool OBDisplay::_xinerama = false; @@ -107,6 +113,11 @@ line argument.\n\n")); } // find the availability of X extensions we like to use +#ifdef XKB + _xkb = XkbQueryExtension(display, &junk, &_xkb_event_basep, &junk, NULL, + NULL); +#endif + #ifdef SHAPE _shape = XShapeQueryExtension(display, &_shape_event_basep, &junk); #endif diff --git a/otk/display.hh b/otk/display.hh index ed469a6c..0b5d5844 100644 --- a/otk/display.hh +++ b/otk/display.hh @@ -29,14 +29,19 @@ public: typedef std::vector ScreenInfoList; private: - //! Does the display have the Shape extention? + //! Does the display have the XKB extension? + static bool _xkb; + //! Base for events for the XKB extension + static int _xkb_event_basep; + + //! Does the display have the Shape extension? static bool _shape; - //! Base for events for the Shape extention + //! Base for events for the Shape extension static int _shape_event_basep; - //! Does the display have the Xinerama extention? + //! Does the display have the Xinerama extension? static bool _xinerama; - //! Base for events for the Xinerama extention + //! Base for events for the Xinerama extension static int _xinerama_event_basep; //! A list of all possible combinations of keyboard lock masks @@ -99,11 +104,16 @@ public: //! Find a ScreenInfo based on a root window static const ScreenInfo* findScreen(Window root); - //! Returns if the display has the shape extention available + //! Returns if the display has the xkb extension available + inline static bool xkb() { return _xkb; } + //! Returns the xkb extension's event base + inline static int xkbEventBase() { return _xkb_event_basep; } + + //! Returns if the display has the shape extension available inline static bool shape() { return _shape; } //! Returns the shape extension's event base inline static int shapeEventBase() { return _shape_event_basep; } - //! Returns if the display has the xinerama extention available + //! Returns if the display has the xinerama extension available inline static bool xinerama() { return _xinerama; } inline static unsigned int numLockMask() { return _numLockMask; } diff --git a/otk/eventhandler.cc b/otk/eventhandler.cc index d61189e4..7e1ad745 100644 --- a/otk/eventhandler.cc +++ b/otk/eventhandler.cc @@ -91,6 +91,10 @@ void OtkEventHandler::handle(const XEvent &e) if (e.type == otk::OBDisplay::shapeEventBase()) return shapeHandler((*(XShapeEvent*)&e)); #endif // SHAPE +#ifdef XKB + if (e.type == otk::OBDisplay::xkbEventBase()) + return xkbHandler((*(XkbEvent*)&e)); +#endif // XKB ; } } diff --git a/otk/eventhandler.hh b/otk/eventhandler.hh index 9308ed03..96bdff94 100644 --- a/otk/eventhandler.hh +++ b/otk/eventhandler.hh @@ -7,6 +7,11 @@ extern "C" { #ifdef SHAPE #include #endif // SHAPE + +#ifdef XKB +#include +#endif // XKB + } namespace otk { @@ -120,10 +125,15 @@ public: virtual void clientMessageHandler(const XClientMessageEvent &); #if defined(SHAPE) || defined(DOXYGEN_IGNORE) - //! Called when a shape extention event fires + //! Called when a shape extension event fires virtual void shapeHandler(const XShapeEvent &) {} #endif // SHAPE +#if defined(XKB) || defined(DOXYGEN_IGNORE) + //! Called when an xkb extension event fires + virtual void xkbHandler(const XkbEvent &) {} +#endif // XKB + virtual ~OtkEventHandler(); protected: diff --git a/otk/otk_wrap.cc b/otk/otk_wrap.cc index 57a87fa6..5d44b3ef 100644 --- a/otk/otk_wrap.cc +++ b/otk/otk_wrap.cc @@ -5481,6 +5481,34 @@ static PyObject *_wrap_OBDisplay_findScreen(PyObject *self, PyObject *args) { } +static PyObject *_wrap_OBDisplay_xkb(PyObject *self, PyObject *args) { + PyObject *resultobj; + bool result; + + if(!PyArg_ParseTuple(args,(char *)":OBDisplay_xkb")) goto fail; + result = (bool)otk::OBDisplay::xkb(); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_OBDisplay_xkbEventBase(PyObject *self, PyObject *args) { + PyObject *resultobj; + int result; + + if(!PyArg_ParseTuple(args,(char *)":OBDisplay_xkbEventBase")) goto fail; + result = (int)otk::OBDisplay::xkbEventBase(); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + static PyObject *_wrap_OBDisplay_shape(PyObject *self, PyObject *args) { PyObject *resultobj; bool result; @@ -12960,6 +12988,8 @@ static PyMethodDef SwigMethods[] = { { (char *)"OBDisplay_gcCache", _wrap_OBDisplay_gcCache, METH_VARARGS }, { (char *)"OBDisplay_screenInfo", _wrap_OBDisplay_screenInfo, METH_VARARGS }, { (char *)"OBDisplay_findScreen", _wrap_OBDisplay_findScreen, METH_VARARGS }, + { (char *)"OBDisplay_xkb", _wrap_OBDisplay_xkb, METH_VARARGS }, + { (char *)"OBDisplay_xkbEventBase", _wrap_OBDisplay_xkbEventBase, METH_VARARGS }, { (char *)"OBDisplay_shape", _wrap_OBDisplay_shape, METH_VARARGS }, { (char *)"OBDisplay_shapeEventBase", _wrap_OBDisplay_shapeEventBase, METH_VARARGS }, { (char *)"OBDisplay_xinerama", _wrap_OBDisplay_xinerama, METH_VARARGS }, diff --git a/src/actions.cc b/src/actions.cc index 79b31a27..14fba7db 100644 --- a/src/actions.cc +++ b/src/actions.cc @@ -8,6 +8,7 @@ #include "widget.hh" #include "openbox.hh" #include "client.hh" +#include "screen.hh" #include "python.hh" #include "bindings.hh" #include "otk/display.hh" @@ -74,12 +75,15 @@ void OBActions::buttonPressHandler(const XButtonEvent &e) // kill off the Button1Mask etc, only want the modifiers unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask); - ButtonData *data = - new_button_data(otk::OBDisplay::findScreen(e.root)->screen(), - e.window, e.time, state, e.button, w->mcontext(), - MousePress); - Openbox::instance->bindings()->fireButton(data); - Py_DECREF((PyObject*)data); + int screen; + OBClient *c = Openbox::instance->findClient(e.window); + if (c) + screen = c->screen(); + else + screen = otk::OBDisplay::findScreen(e.root)->screen(); + ButtonData data(screen, c, e.time, state, e.button, w->mcontext(), + MousePress); + Openbox::instance->bindings()->fireButton(&data); if (_button) return; // won't count toward CLICK events @@ -114,11 +118,15 @@ void OBActions::buttonReleaseHandler(const XButtonEvent &e) // kill off the Button1Mask etc, only want the modifiers unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask); - ButtonData *data = - new_button_data(otk::OBDisplay::findScreen(e.root)->screen(), - e.window, e.time, state, e.button, w->mcontext(), - MouseClick); - Openbox::instance->bindings()->fireButton(data); + int screen; + OBClient *c = Openbox::instance->findClient(e.window); + if (c) + screen = c->screen(); + else + screen = otk::OBDisplay::findScreen(e.root)->screen(); + ButtonData data(screen, c, e.time, state, e.button, w->mcontext(), + MouseClick); + Openbox::instance->bindings()->fireButton(&data); // XXX: dont load this every time!!@* @@ -130,8 +138,8 @@ void OBActions::buttonReleaseHandler(const XButtonEvent &e) _release.win == e.window && _release.button == e.button) { // run the DOUBLECLICK python hook - data->action = MouseDoubleClick; - Openbox::instance->bindings()->fireButton(data); + data.action = MouseDoubleClick; + Openbox::instance->bindings()->fireButton(&data); // reset so you cant triple click for 2 doubleclicks _release.win = 0; @@ -143,8 +151,6 @@ void OBActions::buttonReleaseHandler(const XButtonEvent &e) _release.button = e.button; _release.time = e.time; } - - Py_DECREF((PyObject*)data); } @@ -153,11 +159,14 @@ void OBActions::enterHandler(const XCrossingEvent &e) OtkEventHandler::enterHandler(e); // run the ENTER python hook - EventData *data = - new_event_data(otk::OBDisplay::findScreen(e.root)->screen(), - e.window, EventEnterWindow, e.state); - Openbox::instance->bindings()->fireEvent(data); - Py_DECREF((PyObject*)data); + int screen; + OBClient *c = Openbox::instance->findClient(e.window); + if (c) + screen = c->screen(); + else + screen = otk::OBDisplay::findScreen(e.root)->screen(); + EventData data(screen, c, EventEnterWindow, e.state); + Openbox::instance->bindings()->fireEvent(&data); } @@ -166,11 +175,14 @@ void OBActions::leaveHandler(const XCrossingEvent &e) OtkEventHandler::leaveHandler(e); // run the LEAVE python hook - EventData *data = - new_event_data(otk::OBDisplay::findScreen(e.root)->screen(), - e.window, EventLeaveWindow, e.state); - Openbox::instance->bindings()->fireEvent(data); - Py_DECREF((PyObject*)data); + int screen; + OBClient *c = Openbox::instance->findClient(e.window); + if (c) + screen = c->screen(); + else + screen = otk::OBDisplay::findScreen(e.root)->screen(); + EventData data(screen, c, EventLeaveWindow, e.state); + Openbox::instance->bindings()->fireEvent(&data); } @@ -216,13 +228,15 @@ void OBActions::motionHandler(const XMotionEvent &e) unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask); unsigned int button = _posqueue[0]->button; - MotionData *data = - new_motion_data(otk::OBDisplay::findScreen(e.root)->screen(), - e.window, e.time, state, button, w->mcontext(), - MouseMotion, x_root, y_root, _posqueue[0]->pos, - _posqueue[0]->clientarea); - Openbox::instance->bindings()->fireButton((ButtonData*)data); - Py_DECREF((PyObject*)data); + int screen; + OBClient *c = Openbox::instance->findClient(e.window); + if (c) + screen = c->screen(); + else + screen = otk::OBDisplay::findScreen(e.root)->screen(); + MotionData data(screen, c, e.time, state, button, w->mcontext(), MouseMotion, + x_root, y_root, _posqueue[0]->pos, _posqueue[0]->clientarea); + Openbox::instance->bindings()->fireButton((ButtonData*)&data); } void OBActions::mapRequestHandler(const XMapRequestEvent &e) @@ -243,4 +257,28 @@ void OBActions::destroyHandler(const XDestroyWindowEvent &e) // do this in OBScreen::unmanageWindow } +#ifdef XKB +void OBActions::xkbHandler(const XkbEvent &e) +{ + Window w; + int screen; + + OtkEventHandler::xkbHandler(e); + + switch (((XkbAnyEvent*)&e)->xkb_type) { + case XkbBellNotify: + w = ((XkbBellNotifyEvent*)&e)->window; + OBClient *c = Openbox::instance->findClient(w); + if (c) + screen = c->screen(); + else + screen = Openbox::instance->focusedScreen()->number(); + EventData data(screen, c, EventBell, 0); + Openbox::instance->bindings()->fireEvent(&data); + break; + } } +#endif // XKB + +} + diff --git a/src/actions.hh b/src/actions.hh index 1da6e278..f98c91d9 100644 --- a/src/actions.hh +++ b/src/actions.hh @@ -80,6 +80,10 @@ public: virtual void unmapHandler(const XUnmapEvent &e); virtual void destroyHandler(const XDestroyWindowEvent &e); +#ifdef XKB + virtual void xkbHandler(const XkbEvent &e); +#endif // XKB + }; } diff --git a/src/bindings.cc b/src/bindings.cc index 108a4ef0..2994f564 100644 --- a/src/bindings.cc +++ b/src/bindings.cc @@ -387,14 +387,11 @@ void OBBindings::fireKey(int screen, unsigned int modifiers, unsigned int key, grabKeys(true); otk::OBDisplay::ungrab(); } else { - Window win = None; OBClient *c = Openbox::instance->focusedClient(); - if (c) win = c->window(); - KeyData *data = new_key_data(screen, win, time, modifiers, key); + KeyData data(screen, c, time, modifiers, key); CallbackList::iterator it, end = p->callbacks.end(); for (it = p->callbacks.begin(); it != end; ++it) - python_callback(*it, (PyObject*)data); - Py_XDECREF((PyObject*)data); + python_callback(*it, &data); resetChains(this); } break; @@ -540,7 +537,11 @@ bool OBBindings::addEvent(EventAction action, PyObject *callback) if (action < 0 || action >= NUM_EVENTS) { return false; } - +#ifdef XKB + if (action == EventBell && _eventlist[action].empty()) + XkbSelectEvents(otk::OBDisplay::display, XkbUseCoreKbd, + XkbBellNotifyMask, XkbBellNotifyMask); +#endif // XKB _eventlist[action].push_back(callback); Py_INCREF(callback); return true; @@ -558,6 +559,11 @@ bool OBBindings::removeEvent(EventAction action, PyObject *callback) if (it != _eventlist[action].end()) { Py_XDECREF(*it); _eventlist[action].erase(it); +#ifdef XKB + if (action == EventBell && _eventlist[action].empty()) + XkbSelectEvents(otk::OBDisplay::display, XkbUseCoreKbd, + XkbBellNotifyMask, 0); +#endif // XKB return true; } return false; @@ -577,7 +583,7 @@ void OBBindings::fireEvent(EventData *data) { CallbackList::iterator c_it, c_end = _eventlist[data->action].end(); for (c_it = _eventlist[data->action].begin(); c_it != c_end; ++c_it) - python_callback(*c_it, (PyObject*)data); + python_callback(*c_it, data); } } diff --git a/src/openbox.cc b/src/openbox.cc index a15f369b..b44a1861 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -288,7 +288,8 @@ void Openbox::showHelp() printf(_("Compile time options:\n\ Debugging: %s\n\ Shape: %s\n\ - Xinerama: %s\n"), + Xinerama: %s\n\ + Xkb: %s\n"), #ifdef DEBUG _("yes"), #else // !DEBUG @@ -302,10 +303,16 @@ void Openbox::showHelp() #endif // SHAPE #ifdef XINERAMA - _("yes") + _("yes"), #else // !XINERAMA - _("no") + _("no"), #endif // XINERAMA + +#ifdef XKB + _("yes") +#else // !XKB + _("no") +#endif // XKB ); } @@ -368,11 +375,8 @@ void Openbox::setFocusedClient(OBClient *c) } // call the python Focus callbacks - EventData *data = new_event_data(_focused_screen->number(), - c ? c->window() : 0, - EventFocus, 0); - Openbox::instance->bindings()->fireEvent(data); - Py_XDECREF((PyObject*)data); + EventData data(_focused_screen->number(), c, EventFocus, 0); + Openbox::instance->bindings()->fireEvent(&data); } void Openbox::execute(int screen, const std::string &bin) diff --git a/src/openbox.i b/src/openbox.i index b914ce9c..0f54362b 100644 --- a/src/openbox.i +++ b/src/openbox.i @@ -12,6 +12,8 @@ #include "client.hh" #include "bindings.hh" #include "actions.hh" +#include "python.hh" +#include "otk/display.hh" %} %include "stl.i" @@ -23,6 +25,91 @@ ob::Openbox *Openbox_instance() { return ob::Openbox::instance; } %}; +%{ +namespace ob { +void python_callback(PyObject *func, MotionData *data) +{ + PyObject *arglist; + PyObject *result; + + arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data, + SWIGTYPE_p_ob__MotionData, + 0)); + + // call the callback + result = PyEval_CallObject(func, arglist); + if (!result || PyErr_Occurred()) { + // an exception occured in the script, display it + PyErr_Print(); + } + + Py_XDECREF(result); + Py_DECREF(arglist); +} + +void python_callback(PyObject *func, ButtonData *data) +{ + PyObject *arglist; + PyObject *result; + + arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data, + SWIGTYPE_p_ob__ButtonData, + 0)); + + // call the callback + result = PyEval_CallObject(func, arglist); + if (!result || PyErr_Occurred()) { + // an exception occured in the script, display it + PyErr_Print(); + } + + Py_XDECREF(result); + Py_DECREF(arglist); +} + +void python_callback(PyObject *func, EventData *data) +{ + PyObject *arglist; + PyObject *result; + + arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data, + SWIGTYPE_p_ob__EventData, + 0)); + + // call the callback + result = PyEval_CallObject(func, arglist); + if (!result || PyErr_Occurred()) { + // an exception occured in the script, display it + PyErr_Print(); + } + + Py_XDECREF(result); + Py_DECREF(arglist); +} + +void python_callback(PyObject *func, KeyData *data) +{ + PyObject *arglist; + PyObject *result; + + arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data, + SWIGTYPE_p_ob__KeyData, + 0)); + + // call the callback + result = PyEval_CallObject(func, arglist); + if (!result || PyErr_Occurred()) { + // an exception occured in the script, display it + PyErr_Print(); + } + + Py_XDECREF(result); + Py_DECREF(arglist); +} + +} +%} + %ignore ob::OBScreen::clients; %{ #include diff --git a/src/openbox_wrap.cc b/src/openbox_wrap.cc index a1d3f58a..1b3dc172 100644 --- a/src/openbox_wrap.cc +++ b/src/openbox_wrap.cc @@ -652,26 +652,32 @@ SWIG_InstallConstants(PyObject *d, swig_const_info constants[]) { #define SWIGTYPE_p_otk__Style swig_types[4] #define SWIGTYPE_p_ob__OBFrame swig_types[5] #define SWIGTYPE_p_XReparentEvent swig_types[6] -#define SWIGTYPE_p_ob__OBClient swig_types[7] -#define SWIGTYPE_p_ob__Openbox swig_types[8] -#define SWIGTYPE_p_otk__Strut swig_types[9] -#define SWIGTYPE_p_XMapRequestEvent swig_types[10] -#define SWIGTYPE_p_XConfigureRequestEvent swig_types[11] -#define SWIGTYPE_p_otk__OtkEventHandler swig_types[12] -#define SWIGTYPE_p_otk__Rect swig_types[13] -#define SWIGTYPE_p_ob__OBWidget swig_types[14] -#define SWIGTYPE_p_XClientMessageEvent swig_types[15] -#define SWIGTYPE_p_XFocusChangeEvent swig_types[16] -#define SWIGTYPE_p_otk__OBProperty swig_types[17] -#define SWIGTYPE_p_otk__OtkEventDispatcher swig_types[18] -#define SWIGTYPE_p_XPropertyEvent swig_types[19] -#define SWIGTYPE_p_XDestroyWindowEvent swig_types[20] -#define SWIGTYPE_p_otk__BImageControl swig_types[21] -#define SWIGTYPE_p_PyObject swig_types[22] -#define SWIGTYPE_p_ob__OBBindings swig_types[23] -#define SWIGTYPE_p_ob__MwmHints swig_types[24] -#define SWIGTYPE_p_XUnmapEvent swig_types[25] -static swig_type_info *swig_types[27]; +#define SWIGTYPE_p_ob__MotionData swig_types[7] +#define SWIGTYPE_p_ob__OBClient swig_types[8] +#define SWIGTYPE_p_ob__Openbox swig_types[9] +#define SWIGTYPE_p_otk__Strut swig_types[10] +#define SWIGTYPE_p_ob__KeyData swig_types[11] +#define SWIGTYPE_p_XMapRequestEvent swig_types[12] +#define SWIGTYPE_p_XConfigureRequestEvent swig_types[13] +#define SWIGTYPE_p_otk__Point swig_types[14] +#define SWIGTYPE_p_otk__OtkEventHandler swig_types[15] +#define SWIGTYPE_p_std__string swig_types[16] +#define SWIGTYPE_p_otk__Rect swig_types[17] +#define SWIGTYPE_p_ob__OBWidget swig_types[18] +#define SWIGTYPE_p_XClientMessageEvent swig_types[19] +#define SWIGTYPE_p_XFocusChangeEvent swig_types[20] +#define SWIGTYPE_p_otk__OBProperty swig_types[21] +#define SWIGTYPE_p_ob__EventData swig_types[22] +#define SWIGTYPE_p_otk__OtkEventDispatcher swig_types[23] +#define SWIGTYPE_p_XPropertyEvent swig_types[24] +#define SWIGTYPE_p_XDestroyWindowEvent swig_types[25] +#define SWIGTYPE_p_otk__BImageControl swig_types[26] +#define SWIGTYPE_p_PyObject swig_types[27] +#define SWIGTYPE_p_ob__OBBindings swig_types[28] +#define SWIGTYPE_p_ob__MwmHints swig_types[29] +#define SWIGTYPE_p_XUnmapEvent swig_types[30] +#define SWIGTYPE_p_ob__ButtonData swig_types[31] +static swig_type_info *swig_types[33]; /* -------- TYPES TABLE (END) -------- */ @@ -692,6 +698,8 @@ static swig_type_info *swig_types[27]; #include "client.hh" #include "bindings.hh" #include "actions.hh" +#include "python.hh" +#include "otk/display.hh" #define SWIG_MemoryError 1 @@ -778,6 +786,90 @@ static std::string SwigString_AsString(PyObject* o) { ob::Openbox *Openbox_instance() { return ob::Openbox::instance; } +namespace ob { +void python_callback(PyObject *func, MotionData *data) +{ + PyObject *arglist; + PyObject *result; + + arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data, + SWIGTYPE_p_ob__MotionData, + 0)); + + // call the callback + result = PyEval_CallObject(func, arglist); + if (!result || PyErr_Occurred()) { + // an exception occured in the script, display it + PyErr_Print(); + } + + Py_XDECREF(result); + Py_DECREF(arglist); +} + +void python_callback(PyObject *func, ButtonData *data) +{ + PyObject *arglist; + PyObject *result; + + arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data, + SWIGTYPE_p_ob__ButtonData, + 0)); + + // call the callback + result = PyEval_CallObject(func, arglist); + if (!result || PyErr_Occurred()) { + // an exception occured in the script, display it + PyErr_Print(); + } + + Py_XDECREF(result); + Py_DECREF(arglist); +} + +void python_callback(PyObject *func, EventData *data) +{ + PyObject *arglist; + PyObject *result; + + arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data, + SWIGTYPE_p_ob__EventData, + 0)); + + // call the callback + result = PyEval_CallObject(func, arglist); + if (!result || PyErr_Occurred()) { + // an exception occured in the script, display it + PyErr_Print(); + } + + Py_XDECREF(result); + Py_DECREF(arglist); +} + +void python_callback(PyObject *func, KeyData *data) +{ + PyObject *arglist; + PyObject *result; + + arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data, + SWIGTYPE_p_ob__KeyData, + 0)); + + // call the callback + result = PyEval_CallObject(func, arglist); + if (!result || PyErr_Occurred()) { + // an exception occured in the script, display it + PyErr_Print(); + } + + Py_XDECREF(result); + Py_DECREF(arglist); +} + +} + + #include ob::OBClient *ob_OBScreen_client(ob::OBScreen *self,int i){ @@ -2696,6 +2788,1256 @@ static PyObject * OBClient_swigregister(PyObject *self, PyObject *args) { Py_INCREF(obj); return Py_BuildValue((char *)""); } +static PyObject *_wrap_MotionData_screen_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:MotionData_screen_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->screen = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_screen_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:MotionData_screen_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->screen); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_client_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + ob::OBClient *arg2 = (ob::OBClient *) 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"OO:MotionData_client_set",&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | SWIG_POINTER_DISOWN )) == -1) SWIG_fail; + if (arg1) (arg1)->client = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_client_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + ob::OBClient *result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:MotionData_client_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (ob::OBClient *) ((arg1)->client); + + resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_ob__OBClient, 0); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_time_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + Time arg2 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"OO:MotionData_time_set",&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + arg2 = (Time) PyInt_AsLong(obj1); + if (PyErr_Occurred()) SWIG_fail; + if (arg1) (arg1)->time = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_time_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + Time result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:MotionData_time_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (Time) ((arg1)->time); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_state_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + unsigned int arg2 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"OO:MotionData_state_set",&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + arg2 = (unsigned int) PyInt_AsLong(obj1); + if (PyErr_Occurred()) SWIG_fail; + if (arg1) (arg1)->state = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_state_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + unsigned int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:MotionData_state_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (unsigned int) ((arg1)->state); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_button_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + unsigned int arg2 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"OO:MotionData_button_set",&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + arg2 = (unsigned int) PyInt_AsLong(obj1); + if (PyErr_Occurred()) SWIG_fail; + if (arg1) (arg1)->button = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_button_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + unsigned int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:MotionData_button_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (unsigned int) ((arg1)->button); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_context_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:MotionData_context_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->context = (ob::MouseContext )arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_context_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:MotionData_context_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->context); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_action_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:MotionData_action_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->action = (ob::MouseAction )arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_action_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:MotionData_action_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->action); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_xroot_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:MotionData_xroot_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->xroot = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_xroot_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:MotionData_xroot_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->xroot); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_yroot_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:MotionData_yroot_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->yroot = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_yroot_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:MotionData_yroot_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->yroot); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_pressx_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:MotionData_pressx_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->pressx = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_pressx_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:MotionData_pressx_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->pressx); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_pressy_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:MotionData_pressy_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->pressy = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_pressy_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:MotionData_pressy_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->pressy); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_press_clientx_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:MotionData_press_clientx_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->press_clientx = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_press_clientx_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:MotionData_press_clientx_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->press_clientx); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_press_clienty_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:MotionData_press_clienty_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->press_clienty = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_press_clienty_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:MotionData_press_clienty_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->press_clienty); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_press_clientwidth_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:MotionData_press_clientwidth_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->press_clientwidth = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_press_clientwidth_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:MotionData_press_clientwidth_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->press_clientwidth); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_press_clientheight_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:MotionData_press_clientheight_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->press_clientheight = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_MotionData_press_clientheight_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::MotionData *arg1 = (ob::MotionData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:MotionData_press_clientheight_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__MotionData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->press_clientheight); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_new_MotionData(PyObject *self, PyObject *args) { + PyObject *resultobj; + int arg1 ; + ob::OBClient *arg2 = (ob::OBClient *) 0 ; + Time arg3 ; + unsigned int arg4 ; + unsigned int arg5 ; + int arg6 ; + int arg7 ; + int arg8 ; + int arg9 ; + otk::Point *arg10 = 0 ; + otk::Rect *arg11 = 0 ; + ob::MotionData *result; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"iOOOOiiiiOO:new_MotionData",&arg1,&obj1,&obj2,&obj3,&obj4,&arg6,&arg7,&arg8,&arg9,&obj9,&obj10)) goto fail; + if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + arg3 = (Time) PyInt_AsLong(obj2); + if (PyErr_Occurred()) SWIG_fail; + arg4 = (unsigned int) PyInt_AsLong(obj3); + if (PyErr_Occurred()) SWIG_fail; + arg5 = (unsigned int) PyInt_AsLong(obj4); + if (PyErr_Occurred()) SWIG_fail; + if ((SWIG_ConvertPtr(obj9,(void **) &arg10, SWIGTYPE_p_otk__Point,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg10 == NULL) { + PyErr_SetString(PyExc_TypeError,"null reference"); SWIG_fail; + } + if ((SWIG_ConvertPtr(obj10,(void **) &arg11, SWIGTYPE_p_otk__Rect,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg11 == NULL) { + PyErr_SetString(PyExc_TypeError,"null reference"); SWIG_fail; + } + result = (ob::MotionData *)new ob::MotionData(arg1,arg2,arg3,arg4,arg5,(ob::MouseContext )arg6,(ob::MouseAction )arg7,arg8,arg9,(otk::Point const &)*arg10,(otk::Rect const &)*arg11); + + resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_ob__MotionData, 1); + return resultobj; + fail: + return NULL; +} + + +static PyObject * MotionData_swigregister(PyObject *self, PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL; + SWIG_TypeClientData(SWIGTYPE_p_ob__MotionData, obj); + Py_INCREF(obj); + return Py_BuildValue((char *)""); +} +static PyObject *_wrap_ButtonData_screen_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::ButtonData *arg1 = (ob::ButtonData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:ButtonData_screen_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__ButtonData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->screen = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_ButtonData_screen_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::ButtonData *arg1 = (ob::ButtonData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:ButtonData_screen_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__ButtonData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->screen); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_ButtonData_client_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::ButtonData *arg1 = (ob::ButtonData *) 0 ; + ob::OBClient *arg2 = (ob::OBClient *) 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"OO:ButtonData_client_set",&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__ButtonData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | SWIG_POINTER_DISOWN )) == -1) SWIG_fail; + if (arg1) (arg1)->client = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_ButtonData_client_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::ButtonData *arg1 = (ob::ButtonData *) 0 ; + ob::OBClient *result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:ButtonData_client_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__ButtonData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (ob::OBClient *) ((arg1)->client); + + resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_ob__OBClient, 0); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_ButtonData_time_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::ButtonData *arg1 = (ob::ButtonData *) 0 ; + Time arg2 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"OO:ButtonData_time_set",&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__ButtonData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + arg2 = (Time) PyInt_AsLong(obj1); + if (PyErr_Occurred()) SWIG_fail; + if (arg1) (arg1)->time = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_ButtonData_time_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::ButtonData *arg1 = (ob::ButtonData *) 0 ; + Time result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:ButtonData_time_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__ButtonData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (Time) ((arg1)->time); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_ButtonData_state_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::ButtonData *arg1 = (ob::ButtonData *) 0 ; + unsigned int arg2 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"OO:ButtonData_state_set",&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__ButtonData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + arg2 = (unsigned int) PyInt_AsLong(obj1); + if (PyErr_Occurred()) SWIG_fail; + if (arg1) (arg1)->state = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_ButtonData_state_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::ButtonData *arg1 = (ob::ButtonData *) 0 ; + unsigned int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:ButtonData_state_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__ButtonData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (unsigned int) ((arg1)->state); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_ButtonData_button_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::ButtonData *arg1 = (ob::ButtonData *) 0 ; + unsigned int arg2 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"OO:ButtonData_button_set",&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__ButtonData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + arg2 = (unsigned int) PyInt_AsLong(obj1); + if (PyErr_Occurred()) SWIG_fail; + if (arg1) (arg1)->button = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_ButtonData_button_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::ButtonData *arg1 = (ob::ButtonData *) 0 ; + unsigned int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:ButtonData_button_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__ButtonData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (unsigned int) ((arg1)->button); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_ButtonData_context_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::ButtonData *arg1 = (ob::ButtonData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:ButtonData_context_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__ButtonData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->context = (ob::MouseContext )arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_ButtonData_context_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::ButtonData *arg1 = (ob::ButtonData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:ButtonData_context_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__ButtonData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->context); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_ButtonData_action_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::ButtonData *arg1 = (ob::ButtonData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:ButtonData_action_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__ButtonData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->action = (ob::MouseAction )arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_ButtonData_action_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::ButtonData *arg1 = (ob::ButtonData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:ButtonData_action_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__ButtonData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->action); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_new_ButtonData(PyObject *self, PyObject *args) { + PyObject *resultobj; + int arg1 ; + ob::OBClient *arg2 = (ob::OBClient *) 0 ; + Time arg3 ; + unsigned int arg4 ; + unsigned int arg5 ; + int arg6 ; + int arg7 ; + ob::ButtonData *result; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"iOOOOii:new_ButtonData",&arg1,&obj1,&obj2,&obj3,&obj4,&arg6,&arg7)) goto fail; + if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + arg3 = (Time) PyInt_AsLong(obj2); + if (PyErr_Occurred()) SWIG_fail; + arg4 = (unsigned int) PyInt_AsLong(obj3); + if (PyErr_Occurred()) SWIG_fail; + arg5 = (unsigned int) PyInt_AsLong(obj4); + if (PyErr_Occurred()) SWIG_fail; + result = (ob::ButtonData *)new ob::ButtonData(arg1,arg2,arg3,arg4,arg5,(ob::MouseContext )arg6,(ob::MouseAction )arg7); + + resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_ob__ButtonData, 1); + return resultobj; + fail: + return NULL; +} + + +static PyObject * ButtonData_swigregister(PyObject *self, PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL; + SWIG_TypeClientData(SWIGTYPE_p_ob__ButtonData, obj); + Py_INCREF(obj); + return Py_BuildValue((char *)""); +} +static PyObject *_wrap_EventData_screen_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::EventData *arg1 = (ob::EventData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:EventData_screen_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__EventData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->screen = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_EventData_screen_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::EventData *arg1 = (ob::EventData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:EventData_screen_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__EventData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->screen); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_EventData_client_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::EventData *arg1 = (ob::EventData *) 0 ; + ob::OBClient *arg2 = (ob::OBClient *) 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"OO:EventData_client_set",&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__EventData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | SWIG_POINTER_DISOWN )) == -1) SWIG_fail; + if (arg1) (arg1)->client = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_EventData_client_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::EventData *arg1 = (ob::EventData *) 0 ; + ob::OBClient *result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:EventData_client_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__EventData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (ob::OBClient *) ((arg1)->client); + + resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_ob__OBClient, 0); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_EventData_state_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::EventData *arg1 = (ob::EventData *) 0 ; + unsigned int arg2 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"OO:EventData_state_set",&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__EventData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + arg2 = (unsigned int) PyInt_AsLong(obj1); + if (PyErr_Occurred()) SWIG_fail; + if (arg1) (arg1)->state = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_EventData_state_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::EventData *arg1 = (ob::EventData *) 0 ; + unsigned int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:EventData_state_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__EventData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (unsigned int) ((arg1)->state); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_EventData_action_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::EventData *arg1 = (ob::EventData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:EventData_action_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__EventData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->action = (ob::EventAction )arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_EventData_action_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::EventData *arg1 = (ob::EventData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:EventData_action_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__EventData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->action); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_new_EventData(PyObject *self, PyObject *args) { + PyObject *resultobj; + int arg1 ; + ob::OBClient *arg2 = (ob::OBClient *) 0 ; + int arg3 ; + unsigned int arg4 ; + ob::EventData *result; + PyObject * obj1 = 0 ; + PyObject * obj3 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"iOiO:new_EventData",&arg1,&obj1,&arg3,&obj3)) goto fail; + if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + arg4 = (unsigned int) PyInt_AsLong(obj3); + if (PyErr_Occurred()) SWIG_fail; + result = (ob::EventData *)new ob::EventData(arg1,arg2,(ob::EventAction )arg3,arg4); + + resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_ob__EventData, 1); + return resultobj; + fail: + return NULL; +} + + +static PyObject * EventData_swigregister(PyObject *self, PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL; + SWIG_TypeClientData(SWIGTYPE_p_ob__EventData, obj); + Py_INCREF(obj); + return Py_BuildValue((char *)""); +} +static PyObject *_wrap_KeyData_screen_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::KeyData *arg1 = (ob::KeyData *) 0 ; + int arg2 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"Oi:KeyData_screen_set",&obj0,&arg2)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__KeyData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->screen = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_KeyData_screen_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::KeyData *arg1 = (ob::KeyData *) 0 ; + int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:KeyData_screen_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__KeyData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (int) ((arg1)->screen); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_KeyData_client_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::KeyData *arg1 = (ob::KeyData *) 0 ; + ob::OBClient *arg2 = (ob::OBClient *) 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"OO:KeyData_client_set",&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__KeyData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | SWIG_POINTER_DISOWN )) == -1) SWIG_fail; + if (arg1) (arg1)->client = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_KeyData_client_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::KeyData *arg1 = (ob::KeyData *) 0 ; + ob::OBClient *result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:KeyData_client_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__KeyData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (ob::OBClient *) ((arg1)->client); + + resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_ob__OBClient, 0); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_KeyData_time_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::KeyData *arg1 = (ob::KeyData *) 0 ; + Time arg2 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"OO:KeyData_time_set",&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__KeyData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + arg2 = (Time) PyInt_AsLong(obj1); + if (PyErr_Occurred()) SWIG_fail; + if (arg1) (arg1)->time = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_KeyData_time_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::KeyData *arg1 = (ob::KeyData *) 0 ; + Time result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:KeyData_time_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__KeyData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (Time) ((arg1)->time); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_KeyData_state_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::KeyData *arg1 = (ob::KeyData *) 0 ; + unsigned int arg2 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"OO:KeyData_state_set",&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__KeyData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + arg2 = (unsigned int) PyInt_AsLong(obj1); + if (PyErr_Occurred()) SWIG_fail; + if (arg1) (arg1)->state = arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_KeyData_state_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::KeyData *arg1 = (ob::KeyData *) 0 ; + unsigned int result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:KeyData_state_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__KeyData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (unsigned int) ((arg1)->state); + + resultobj = PyInt_FromLong((long)result); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_KeyData_key_set(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::KeyData *arg1 = (ob::KeyData *) 0 ; + std::string *arg2 = (std::string *) 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"OO:KeyData_key_set",&obj0,&obj1)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__KeyData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_std__string,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + if (arg1) (arg1)->key = *arg2; + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_KeyData_key_get(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::KeyData *arg1 = (ob::KeyData *) 0 ; + std::string *result; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:KeyData_key_get",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__KeyData,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + result = (std::string *)& ((arg1)->key); + + resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_std__string, 0); + return resultobj; + fail: + return NULL; +} + + +static PyObject *_wrap_new_KeyData(PyObject *self, PyObject *args) { + PyObject *resultobj; + int arg1 ; + ob::OBClient *arg2 = (ob::OBClient *) 0 ; + Time arg3 ; + unsigned int arg4 ; + unsigned int arg5 ; + ob::KeyData *result; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"iOOOO:new_KeyData",&arg1,&obj1,&obj2,&obj3,&obj4)) goto fail; + if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + arg3 = (Time) PyInt_AsLong(obj2); + if (PyErr_Occurred()) SWIG_fail; + arg4 = (unsigned int) PyInt_AsLong(obj3); + if (PyErr_Occurred()) SWIG_fail; + arg5 = (unsigned int) PyInt_AsLong(obj4); + if (PyErr_Occurred()) SWIG_fail; + result = (ob::KeyData *)new ob::KeyData(arg1,arg2,arg3,arg4,arg5); + + resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_ob__KeyData, 1); + return resultobj; + fail: + return NULL; +} + + +static PyObject * KeyData_swigregister(PyObject *self, PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL; + SWIG_TypeClientData(SWIGTYPE_p_ob__KeyData, obj); + Py_INCREF(obj); + return Py_BuildValue((char *)""); +} static PyObject *_wrap_mbind(PyObject *self, PyObject *args) { PyObject *resultobj; std::string *arg1 = 0 ; @@ -2922,6 +4264,76 @@ static PyMethodDef SwigMethods[] = { { (char *)"OBClient_destroyHandler", _wrap_OBClient_destroyHandler, METH_VARARGS }, { (char *)"OBClient_reparentHandler", _wrap_OBClient_reparentHandler, METH_VARARGS }, { (char *)"OBClient_swigregister", OBClient_swigregister, METH_VARARGS }, + { (char *)"MotionData_screen_set", _wrap_MotionData_screen_set, METH_VARARGS }, + { (char *)"MotionData_screen_get", _wrap_MotionData_screen_get, METH_VARARGS }, + { (char *)"MotionData_client_set", _wrap_MotionData_client_set, METH_VARARGS }, + { (char *)"MotionData_client_get", _wrap_MotionData_client_get, METH_VARARGS }, + { (char *)"MotionData_time_set", _wrap_MotionData_time_set, METH_VARARGS }, + { (char *)"MotionData_time_get", _wrap_MotionData_time_get, METH_VARARGS }, + { (char *)"MotionData_state_set", _wrap_MotionData_state_set, METH_VARARGS }, + { (char *)"MotionData_state_get", _wrap_MotionData_state_get, METH_VARARGS }, + { (char *)"MotionData_button_set", _wrap_MotionData_button_set, METH_VARARGS }, + { (char *)"MotionData_button_get", _wrap_MotionData_button_get, METH_VARARGS }, + { (char *)"MotionData_context_set", _wrap_MotionData_context_set, METH_VARARGS }, + { (char *)"MotionData_context_get", _wrap_MotionData_context_get, METH_VARARGS }, + { (char *)"MotionData_action_set", _wrap_MotionData_action_set, METH_VARARGS }, + { (char *)"MotionData_action_get", _wrap_MotionData_action_get, METH_VARARGS }, + { (char *)"MotionData_xroot_set", _wrap_MotionData_xroot_set, METH_VARARGS }, + { (char *)"MotionData_xroot_get", _wrap_MotionData_xroot_get, METH_VARARGS }, + { (char *)"MotionData_yroot_set", _wrap_MotionData_yroot_set, METH_VARARGS }, + { (char *)"MotionData_yroot_get", _wrap_MotionData_yroot_get, METH_VARARGS }, + { (char *)"MotionData_pressx_set", _wrap_MotionData_pressx_set, METH_VARARGS }, + { (char *)"MotionData_pressx_get", _wrap_MotionData_pressx_get, METH_VARARGS }, + { (char *)"MotionData_pressy_set", _wrap_MotionData_pressy_set, METH_VARARGS }, + { (char *)"MotionData_pressy_get", _wrap_MotionData_pressy_get, METH_VARARGS }, + { (char *)"MotionData_press_clientx_set", _wrap_MotionData_press_clientx_set, METH_VARARGS }, + { (char *)"MotionData_press_clientx_get", _wrap_MotionData_press_clientx_get, METH_VARARGS }, + { (char *)"MotionData_press_clienty_set", _wrap_MotionData_press_clienty_set, METH_VARARGS }, + { (char *)"MotionData_press_clienty_get", _wrap_MotionData_press_clienty_get, METH_VARARGS }, + { (char *)"MotionData_press_clientwidth_set", _wrap_MotionData_press_clientwidth_set, METH_VARARGS }, + { (char *)"MotionData_press_clientwidth_get", _wrap_MotionData_press_clientwidth_get, METH_VARARGS }, + { (char *)"MotionData_press_clientheight_set", _wrap_MotionData_press_clientheight_set, METH_VARARGS }, + { (char *)"MotionData_press_clientheight_get", _wrap_MotionData_press_clientheight_get, METH_VARARGS }, + { (char *)"new_MotionData", _wrap_new_MotionData, METH_VARARGS }, + { (char *)"MotionData_swigregister", MotionData_swigregister, METH_VARARGS }, + { (char *)"ButtonData_screen_set", _wrap_ButtonData_screen_set, METH_VARARGS }, + { (char *)"ButtonData_screen_get", _wrap_ButtonData_screen_get, METH_VARARGS }, + { (char *)"ButtonData_client_set", _wrap_ButtonData_client_set, METH_VARARGS }, + { (char *)"ButtonData_client_get", _wrap_ButtonData_client_get, METH_VARARGS }, + { (char *)"ButtonData_time_set", _wrap_ButtonData_time_set, METH_VARARGS }, + { (char *)"ButtonData_time_get", _wrap_ButtonData_time_get, METH_VARARGS }, + { (char *)"ButtonData_state_set", _wrap_ButtonData_state_set, METH_VARARGS }, + { (char *)"ButtonData_state_get", _wrap_ButtonData_state_get, METH_VARARGS }, + { (char *)"ButtonData_button_set", _wrap_ButtonData_button_set, METH_VARARGS }, + { (char *)"ButtonData_button_get", _wrap_ButtonData_button_get, METH_VARARGS }, + { (char *)"ButtonData_context_set", _wrap_ButtonData_context_set, METH_VARARGS }, + { (char *)"ButtonData_context_get", _wrap_ButtonData_context_get, METH_VARARGS }, + { (char *)"ButtonData_action_set", _wrap_ButtonData_action_set, METH_VARARGS }, + { (char *)"ButtonData_action_get", _wrap_ButtonData_action_get, METH_VARARGS }, + { (char *)"new_ButtonData", _wrap_new_ButtonData, METH_VARARGS }, + { (char *)"ButtonData_swigregister", ButtonData_swigregister, METH_VARARGS }, + { (char *)"EventData_screen_set", _wrap_EventData_screen_set, METH_VARARGS }, + { (char *)"EventData_screen_get", _wrap_EventData_screen_get, METH_VARARGS }, + { (char *)"EventData_client_set", _wrap_EventData_client_set, METH_VARARGS }, + { (char *)"EventData_client_get", _wrap_EventData_client_get, METH_VARARGS }, + { (char *)"EventData_state_set", _wrap_EventData_state_set, METH_VARARGS }, + { (char *)"EventData_state_get", _wrap_EventData_state_get, METH_VARARGS }, + { (char *)"EventData_action_set", _wrap_EventData_action_set, METH_VARARGS }, + { (char *)"EventData_action_get", _wrap_EventData_action_get, METH_VARARGS }, + { (char *)"new_EventData", _wrap_new_EventData, METH_VARARGS }, + { (char *)"EventData_swigregister", EventData_swigregister, METH_VARARGS }, + { (char *)"KeyData_screen_set", _wrap_KeyData_screen_set, METH_VARARGS }, + { (char *)"KeyData_screen_get", _wrap_KeyData_screen_get, METH_VARARGS }, + { (char *)"KeyData_client_set", _wrap_KeyData_client_set, METH_VARARGS }, + { (char *)"KeyData_client_get", _wrap_KeyData_client_get, METH_VARARGS }, + { (char *)"KeyData_time_set", _wrap_KeyData_time_set, METH_VARARGS }, + { (char *)"KeyData_time_get", _wrap_KeyData_time_get, METH_VARARGS }, + { (char *)"KeyData_state_set", _wrap_KeyData_state_set, METH_VARARGS }, + { (char *)"KeyData_state_get", _wrap_KeyData_state_get, METH_VARARGS }, + { (char *)"KeyData_key_set", _wrap_KeyData_key_set, METH_VARARGS }, + { (char *)"KeyData_key_get", _wrap_KeyData_key_get, METH_VARARGS }, + { (char *)"new_KeyData", _wrap_new_KeyData, METH_VARARGS }, + { (char *)"KeyData_swigregister", KeyData_swigregister, METH_VARARGS }, { (char *)"mbind", _wrap_mbind, METH_VARARGS }, { (char *)"kbind", _wrap_kbind, METH_VARARGS }, { (char *)"ebind", _wrap_ebind, METH_VARARGS }, @@ -2961,17 +4373,22 @@ static swig_type_info _swigt__p_ob__OBScreen[] = {{"_p_ob__OBScreen", 0, "ob::OB static swig_type_info _swigt__p_otk__Style[] = {{"_p_otk__Style", 0, "otk::Style *", 0},{"_p_otk__Style"},{0}}; static swig_type_info _swigt__p_ob__OBFrame[] = {{"_p_ob__OBFrame", 0, "ob::OBFrame *", 0},{"_p_ob__OBFrame"},{0}}; static swig_type_info _swigt__p_XReparentEvent[] = {{"_p_XReparentEvent", 0, "XReparentEvent *", 0},{"_p_XReparentEvent"},{0}}; +static swig_type_info _swigt__p_ob__MotionData[] = {{"_p_ob__MotionData", 0, "ob::MotionData *", 0},{"_p_ob__MotionData"},{0}}; static swig_type_info _swigt__p_ob__OBClient[] = {{"_p_ob__OBClient", 0, "ob::OBClient *", 0},{"_p_ob__OBClient"},{0}}; static swig_type_info _swigt__p_ob__Openbox[] = {{"_p_ob__Openbox", 0, "ob::Openbox *", 0},{"_p_ob__Openbox"},{0}}; static swig_type_info _swigt__p_otk__Strut[] = {{"_p_otk__Strut", 0, "otk::Strut *", 0},{"_p_otk__Strut"},{0}}; +static swig_type_info _swigt__p_ob__KeyData[] = {{"_p_ob__KeyData", 0, "ob::KeyData *", 0},{"_p_ob__KeyData"},{0}}; static swig_type_info _swigt__p_XMapRequestEvent[] = {{"_p_XMapRequestEvent", 0, "XMapRequestEvent *", 0},{"_p_XMapRequestEvent"},{0}}; static swig_type_info _swigt__p_XConfigureRequestEvent[] = {{"_p_XConfigureRequestEvent", 0, "XConfigureRequestEvent *", 0},{"_p_XConfigureRequestEvent"},{0}}; +static swig_type_info _swigt__p_otk__Point[] = {{"_p_otk__Point", 0, "otk::Point *", 0},{"_p_otk__Point"},{0}}; static swig_type_info _swigt__p_otk__OtkEventHandler[] = {{"_p_otk__OtkEventHandler", 0, "otk::OtkEventHandler *", 0},{"_p_ob__OBActions", _p_ob__OBActionsTo_p_otk__OtkEventHandler},{"_p_otk__OtkEventHandler"},{"_p_ob__Openbox", _p_ob__OpenboxTo_p_otk__OtkEventHandler},{"_p_ob__OBScreen", _p_ob__OBScreenTo_p_otk__OtkEventHandler},{"_p_ob__OBClient", _p_ob__OBClientTo_p_otk__OtkEventHandler},{0}}; +static swig_type_info _swigt__p_std__string[] = {{"_p_std__string", 0, "std::string *", 0},{"_p_std__string"},{0}}; static swig_type_info _swigt__p_otk__Rect[] = {{"_p_otk__Rect", 0, "otk::Rect *", 0},{"_p_otk__Rect"},{0}}; static swig_type_info _swigt__p_ob__OBWidget[] = {{"_p_ob__OBWidget", 0, "ob::OBWidget *", 0},{"_p_ob__OBWidget"},{"_p_ob__OBScreen", _p_ob__OBScreenTo_p_ob__OBWidget},{"_p_ob__OBClient", _p_ob__OBClientTo_p_ob__OBWidget},{0}}; static swig_type_info _swigt__p_XClientMessageEvent[] = {{"_p_XClientMessageEvent", 0, "XClientMessageEvent *", 0},{"_p_XClientMessageEvent"},{0}}; static swig_type_info _swigt__p_XFocusChangeEvent[] = {{"_p_XFocusChangeEvent", 0, "XFocusChangeEvent *", 0},{"_p_XFocusChangeEvent"},{0}}; static swig_type_info _swigt__p_otk__OBProperty[] = {{"_p_otk__OBProperty", 0, "otk::OBProperty *", 0},{"_p_otk__OBProperty"},{0}}; +static swig_type_info _swigt__p_ob__EventData[] = {{"_p_ob__EventData", 0, "ob::EventData *", 0},{"_p_ob__EventData"},{0}}; static swig_type_info _swigt__p_otk__OtkEventDispatcher[] = {{"_p_otk__OtkEventDispatcher", 0, "otk::OtkEventDispatcher *", 0},{"_p_otk__OtkEventDispatcher"},{"_p_ob__Openbox", _p_ob__OpenboxTo_p_otk__OtkEventDispatcher},{0}}; static swig_type_info _swigt__p_XPropertyEvent[] = {{"_p_XPropertyEvent", 0, "XPropertyEvent *", 0},{"_p_XPropertyEvent"},{0}}; static swig_type_info _swigt__p_XDestroyWindowEvent[] = {{"_p_XDestroyWindowEvent", 0, "XDestroyWindowEvent *", 0},{"_p_XDestroyWindowEvent"},{0}}; @@ -2980,6 +4397,7 @@ static swig_type_info _swigt__p_PyObject[] = {{"_p_PyObject", 0, "PyObject *", 0 static swig_type_info _swigt__p_ob__OBBindings[] = {{"_p_ob__OBBindings", 0, "ob::OBBindings *", 0},{"_p_ob__OBBindings"},{0}}; static swig_type_info _swigt__p_ob__MwmHints[] = {{"_p_ob__MwmHints", 0, "ob::MwmHints *", 0},{"_p_ob__MwmHints"},{0}}; static swig_type_info _swigt__p_XUnmapEvent[] = {{"_p_XUnmapEvent", 0, "XUnmapEvent *", 0},{"_p_XUnmapEvent"},{0}}; +static swig_type_info _swigt__p_ob__ButtonData[] = {{"_p_ob__ButtonData", 0, "ob::ButtonData *", 0},{"_p_ob__ButtonData"},{0}}; static swig_type_info *swig_types_initial[] = { _swigt__p_otk__OBTimerQueueManager, @@ -2989,17 +4407,22 @@ _swigt__p_ob__OBScreen, _swigt__p_otk__Style, _swigt__p_ob__OBFrame, _swigt__p_XReparentEvent, +_swigt__p_ob__MotionData, _swigt__p_ob__OBClient, _swigt__p_ob__Openbox, _swigt__p_otk__Strut, +_swigt__p_ob__KeyData, _swigt__p_XMapRequestEvent, _swigt__p_XConfigureRequestEvent, +_swigt__p_otk__Point, _swigt__p_otk__OtkEventHandler, +_swigt__p_std__string, _swigt__p_otk__Rect, _swigt__p_ob__OBWidget, _swigt__p_XClientMessageEvent, _swigt__p_XFocusChangeEvent, _swigt__p_otk__OBProperty, +_swigt__p_ob__EventData, _swigt__p_otk__OtkEventDispatcher, _swigt__p_XPropertyEvent, _swigt__p_XDestroyWindowEvent, @@ -3008,6 +4431,7 @@ _swigt__p_PyObject, _swigt__p_ob__OBBindings, _swigt__p_ob__MwmHints, _swigt__p_XUnmapEvent, +_swigt__p_ob__ButtonData, 0 }; @@ -3099,6 +4523,7 @@ static swig_const_info swig_const_table[] = { { SWIG_PY_INT, (char *)"EventStartup", (long) ob::EventStartup, 0, 0, 0}, { SWIG_PY_INT, (char *)"EventShutdown", (long) ob::EventShutdown, 0, 0, 0}, { SWIG_PY_INT, (char *)"EventFocus", (long) ob::EventFocus, 0, 0, 0}, +{ SWIG_PY_INT, (char *)"EventBell", (long) ob::EventBell, 0, 0, 0}, { SWIG_PY_INT, (char *)"NUM_EVENTS", (long) ob::NUM_EVENTS, 0, 0, 0}, { SWIG_PY_INT, (char *)"X_PROTOCOL", (long) 11, 0, 0, 0}, { SWIG_PY_INT, (char *)"X_PROTOCOL_REVISION", (long) 0, 0, 0, 0}, diff --git a/src/python.cc b/src/python.cc index 258c4114..2e490d31 100644 --- a/src/python.cc +++ b/src/python.cc @@ -18,350 +18,6 @@ namespace ob { static PyObject *obdict = NULL; -// ************************************************************* // -// Define some custom types which are passed to python callbacks // -// ************************************************************* // - -static void dealloc(PyObject *self) -{ - PyObject_Del(self); -} - -PyObject *MotionData_screen(MotionData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":screen")) return NULL; - return PyLong_FromLong(self->screen); -} - -PyObject *MotionData_window(MotionData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":window")) return NULL; - return PyLong_FromLong(self->window); -} - -PyObject *MotionData_context(MotionData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":context")) return NULL; - return PyLong_FromLong((int)self->context); -} - -PyObject *MotionData_action(MotionData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":action")) return NULL; - return PyLong_FromLong((int)self->action); -} - -PyObject *MotionData_modifiers(MotionData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":modifiers")) return NULL; - return PyLong_FromUnsignedLong(self->state); -} - -PyObject *MotionData_button(MotionData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":button")) return NULL; - int b = 0; - switch (self->button) { - case Button5: b++; - case Button4: b++; - case Button3: b++; - case Button2: b++; - case Button1: b++; - default: ; - } - return PyLong_FromLong(b); -} - -PyObject *MotionData_xroot(MotionData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":xroot")) return NULL; - return PyLong_FromLong(self->xroot); -} - -PyObject *MotionData_yroot(MotionData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":yroot")) return NULL; - return PyLong_FromLong(self->yroot); -} - -PyObject *MotionData_pressx(MotionData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":pressx")) return NULL; - return PyLong_FromLong(self->pressx); -} - -PyObject *MotionData_pressy(MotionData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":pressy")) return NULL; - return PyLong_FromLong(self->pressy); -} - - -PyObject *MotionData_press_clientx(MotionData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":press_clientx")) return NULL; - return PyLong_FromLong(self->press_clientx); -} - -PyObject *MotionData_press_clienty(MotionData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":press_clienty")) return NULL; - return PyLong_FromLong(self->press_clienty); -} - -PyObject *MotionData_press_clientwidth(MotionData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":press_clientwidth")) return NULL; - return PyLong_FromLong(self->press_clientwidth); -} - -PyObject *MotionData_press_clientheight(MotionData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":press_clientheight")) return NULL; - return PyLong_FromLong(self->press_clientheight); -} - -PyObject *MotionData_time(MotionData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":time")) return NULL; - return PyLong_FromLong(self->time); -} - -static PyMethodDef MotionData_methods[] = { - {"action", (PyCFunction)MotionData_action, METH_VARARGS, - "Return the action being executed."}, - {"screen", (PyCFunction)MotionData_screen, METH_VARARGS, - "Return the number of the screen the event is on."}, - {"window", (PyCFunction)MotionData_window, METH_VARARGS, - "Return the client window id."}, - {"context", (PyCFunction)MotionData_context, METH_VARARGS, - "Return the context that the action is occuring in."}, - {"modifiers", (PyCFunction)MotionData_modifiers, METH_VARARGS, - "Return the modifier keys state."}, - {"button", (PyCFunction)MotionData_button, METH_VARARGS, - "Return the number of the pressed button (1-5)."}, - {"xroot", (PyCFunction)MotionData_xroot, METH_VARARGS, - "Return the X-position of the mouse cursor on the root window."}, - {"yroot", (PyCFunction)MotionData_yroot, METH_VARARGS, - "Return the Y-position of the mouse cursor on the root window."}, - {"pressx", (PyCFunction)MotionData_pressx, METH_VARARGS, - "Return the X-position of the mouse cursor at the start of the drag."}, - {"pressy", (PyCFunction)MotionData_pressy, METH_VARARGS, - "Return the Y-position of the mouse cursor at the start of the drag."}, - {"press_clientx", (PyCFunction)MotionData_press_clientx, METH_VARARGS, - "Return the X-position of the client at the start of the drag."}, - {"press_clienty", (PyCFunction)MotionData_press_clienty, METH_VARARGS, - "Return the Y-position of the client at the start of the drag."}, - {"press_clientwidth", (PyCFunction)MotionData_press_clientwidth, - METH_VARARGS, - "Return the width of the client at the start of the drag."}, - {"press_clientheight", (PyCFunction)MotionData_press_clientheight, - METH_VARARGS, - "Return the height of the client at the start of the drag."}, - {"time", (PyCFunction)MotionData_time, METH_VARARGS, - "Return the time at which the event occured."}, - {NULL, NULL, 0, NULL} -}; - -static PyMethodDef ButtonData_methods[] = { - {"action", (PyCFunction)MotionData_action, METH_VARARGS, - "Return the action being executed."}, - {"context", (PyCFunction)MotionData_context, METH_VARARGS, - "Return the context that the action is occuring in."}, - {"screen", (PyCFunction)MotionData_screen, METH_VARARGS, - "Return the number of the screen the event is on."}, - {"window", (PyCFunction)MotionData_window, METH_VARARGS, - "Return the client window id."}, - {"modifiers", (PyCFunction)MotionData_modifiers, METH_VARARGS, - "Return the modifier keys state."}, - {"button", (PyCFunction)MotionData_button, METH_VARARGS, - "Return the number of the pressed button (1-5)."}, - {"time", (PyCFunction)MotionData_time, METH_VARARGS, - "Return the time at which the event occured."}, - {NULL, NULL, 0, NULL} -}; - -PyObject *EventData_action(EventData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":action")) return NULL; - return PyLong_FromLong((int)self->action); -} - -PyObject *EventData_modifiers(EventData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":modifiers")) return NULL; - return PyLong_FromUnsignedLong(self->state); -} - -static PyMethodDef EventData_methods[] = { - {"screen", (PyCFunction)MotionData_screen, METH_VARARGS, - "Return the number of the screen the event is on."}, - {"window", (PyCFunction)MotionData_window, METH_VARARGS, - "Return the client window id."}, - {"action", (PyCFunction)EventData_action, METH_VARARGS, - "Return the action being executed."}, - {"modifiers", (PyCFunction)EventData_modifiers, METH_VARARGS, - "Return the modifier keys state."}, - {NULL, NULL, 0, NULL} -}; - -PyObject *KeyData_key(KeyData *self, PyObject *args) -{ - if(!PyArg_ParseTuple(args,":key")) return NULL; - return PyString_FromString( - XKeysymToString(XKeycodeToKeysym(otk::OBDisplay::display, self->key, 0))); - -} - -static PyMethodDef KeyData_methods[] = { - {"screen", (PyCFunction)MotionData_screen, METH_VARARGS, - "Return the number of the screen the event is on."}, - {"window", (PyCFunction)MotionData_window, METH_VARARGS, - "Return the client window id."}, - {"modifiers", (PyCFunction)MotionData_modifiers, METH_VARARGS, - "Return the modifier keys state."}, - {"key", (PyCFunction)KeyData_key, METH_VARARGS, - "Return the name of the pressed key."}, - {"time", (PyCFunction)MotionData_time, METH_VARARGS, - "Return the time at which the event occured."}, - {NULL, NULL, 0, NULL} -}; - -static PyObject *MotionDataGetAttr(PyObject *obj, char *name) -{ - return Py_FindMethod(MotionData_methods, obj, name); -} - -static PyObject *ButtonDataGetAttr(PyObject *obj, char *name) -{ - return Py_FindMethod(ButtonData_methods, obj, name); -} - -static PyObject *EventDataGetAttr(PyObject *obj, char *name) -{ - return Py_FindMethod(EventData_methods, obj, name); -} - -static PyObject *KeyDataGetAttr(PyObject *obj, char *name) -{ - return Py_FindMethod(KeyData_methods, obj, name); -} - -static PyTypeObject MotionData_Type = { - PyObject_HEAD_INIT(NULL) - 0, - "MotionData", - sizeof(MotionData), - 0, - dealloc, - 0, - (getattrfunc)MotionDataGetAttr, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -}; - -static PyTypeObject ButtonData_Type = { - PyObject_HEAD_INIT(NULL) - 0, - "ButtonData", - sizeof(ButtonData), - 0, - dealloc, - 0, - (getattrfunc)ButtonDataGetAttr, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -}; - -static PyTypeObject EventData_Type = { - PyObject_HEAD_INIT(NULL) - 0, - "EventData", - sizeof(EventData), - 0, - dealloc, - 0, - (getattrfunc)EventDataGetAttr, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -}; - -static PyTypeObject KeyData_Type = { - PyObject_HEAD_INIT(NULL) - 0, - "KeyData", - sizeof(KeyData), - 0, - dealloc, - 0, - (getattrfunc)KeyDataGetAttr, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -}; - -MotionData *new_motion_data(int screen, Window window, Time time, - unsigned int state, unsigned int button, - MouseContext context, MouseAction action, - int xroot, int yroot, const otk::Point &initpos, - const otk::Rect &initarea) -{ - MotionData *data = PyObject_New(MotionData, &MotionData_Type); - data->screen = screen; - data->window = window; - data->time = time; - data->state = state; - data->button = button; - data->context= context; - data->action = action; - data->xroot = xroot; - data->yroot = yroot; - data->pressx = initpos.x(); - data->pressy = initpos.y(); - data->press_clientx = initarea.x(); - data->press_clienty = initarea.y(); - data->press_clientwidth = initarea.width(); - data->press_clientheight = initarea.height(); - return data; -} - -ButtonData *new_button_data(int screen, Window window, Time time, - unsigned int state, unsigned int button, - MouseContext context, MouseAction action) -{ - ButtonData *data = PyObject_New(ButtonData, &ButtonData_Type); - data->screen = screen; - data->window = window; - data->time = time; - data->state = state; - data->button = button; - data->context= context; - data->action = action; - return data; -} - -EventData *new_event_data(int screen, Window window, EventAction action, - unsigned int state) -{ - EventData *data = PyObject_New(EventData, &EventData_Type); - data->screen = screen; - data->window = window; - data->action = action; - data->state = state; - return data; -} - -KeyData *new_key_data(int screen, Window window, Time time, unsigned int state, - unsigned int key) -{ - KeyData *data = PyObject_New(KeyData, &KeyData_Type); - data->screen = screen; - data->window = window; - data->time = time; - data->state = state; - data->key = key; - return data; -} - -// **************** // -// End custom types // -// **************** // - void python_init(char *argv0) { Py_SetProgramName(argv0); @@ -375,16 +31,12 @@ void python_init(char *argv0) /* XXX sys.path.append('stuff') install the .py wrappers, and include their path with this, then import em + and ~/.openbox/python/ !! */ // set up access to the python global variables PyObject *obmodule = PyImport_AddModule("__main__"); obdict = PyModule_GetDict(obmodule); - - // set up the custom types - MotionData_Type.ob_type = &PyType_Type; - ButtonData_Type.ob_type = &PyType_Type; - KeyData_Type.ob_type = &PyType_Type; } void python_destroy() @@ -404,24 +56,6 @@ bool python_exec(const std::string &path) return true; } -void python_callback(PyObject *func, PyObject *data) -{ - PyObject *arglist; - PyObject *result; - - arglist = Py_BuildValue("(O)", data); - - // call the callback - result = PyEval_CallObject(func, arglist); - if (!result || PyErr_Occurred()) { - // an exception occured in the script, display it - PyErr_Print(); - } - - Py_XDECREF(result); - Py_DECREF(arglist); -} - bool python_get_long(const char *name, long *value) { PyObject *val = PyDict_GetItemString(obdict, const_cast(name)); diff --git a/src/python.hh b/src/python.hh index cfa625d0..189c29b3 100644 --- a/src/python.hh +++ b/src/python.hh @@ -9,6 +9,7 @@ #include "otk/point.hh" #include "otk/rect.hh" #include "otk/property.hh" +#include "otk/display.hh" extern "C" { #include @@ -20,6 +21,8 @@ extern "C" { namespace ob { +class OBClient; + enum MouseContext { MC_Frame, MC_Titlebar, @@ -58,16 +61,15 @@ enum EventAction { EventStartup, EventShutdown, EventFocus, + EventBell, NUM_EVENTS }; -#ifndef SWIG - // *** MotionData can be (and is) cast ButtonData!! (in actions.cc) *** // -typedef struct { - PyObject_HEAD; +class MotionData { +public: int screen; - Window window; + OBClient *client; Time time; unsigned int state; unsigned int button; @@ -81,60 +83,106 @@ typedef struct { int press_clienty; int press_clientwidth; int press_clientheight; -} MotionData; + + MotionData(int screen, OBClient *client, Time time, unsigned int state, + unsigned int button, MouseContext context, MouseAction action, + int xroot, int yroot, const otk::Point &initpos, + const otk::Rect &initarea) { + this->screen = screen; + this->client = client; + this->time = time; + this->state = state; + this->button = button; + this->context= context; + this->action = action; + this->xroot = xroot; + this->yroot = yroot; + this->pressx = initpos.x(); + this->pressy = initpos.y(); + this->press_clientx = initarea.x(); + this->press_clienty = initarea.y(); + this->press_clientwidth = initarea.width(); + this->press_clientheight = initarea.height(); + } +}; // *** MotionData can be (and is) cast ButtonData!! (in actions.cc) *** // -typedef struct { - PyObject_HEAD; +class ButtonData { +public: int screen; - Window window; + OBClient *client; Time time; unsigned int state; unsigned int button; MouseContext context; MouseAction action; -} ButtonData; -typedef struct { - PyObject_HEAD; + ButtonData(int screen, OBClient *client, Time time, unsigned int state, + unsigned int button, MouseContext context, MouseAction action) { + this->screen = screen; + this->client = client; + this->time = time; + this->state = state; + this->button = button; + this->context= context; + this->action = action; + } +}; + +class EventData { +public: int screen; - Window window; + OBClient *client; unsigned int state; EventAction action; -} EventData; -typedef struct { - PyObject_HEAD; + EventData(int screen, OBClient *client, EventAction action, + unsigned int state) { + this->screen = screen; + this->client = client; + this->action = action; + this->state = state; + } +}; + +class KeyData { +public: int screen; - Window window; + OBClient *client; Time time; unsigned int state; - unsigned int key; -} KeyData; + std::string key; + + KeyData(int screen, OBClient *client, Time time, unsigned int state, + unsigned int key) { + this->screen = screen; + this->client = client; + this->time = time; + this->state = state; + this->key = XKeysymToString(XKeycodeToKeysym(otk::OBDisplay::display, + key, 0)); + } +}; + +#ifndef SWIG void python_init(char *argv0); void python_destroy(); bool python_exec(const std::string &path); - -MotionData *new_motion_data(int screen, Window window, Time time, - unsigned int state, unsigned int button, - MouseContext context, MouseAction action, - int xroot, int yroot, const otk::Point &initpos, - const otk::Rect &initarea); -ButtonData *new_button_data(int screen, Window window, Time time, - unsigned int state, unsigned int button, - MouseContext context, MouseAction action); -EventData *new_event_data(int screen, Window window, EventAction action, - unsigned int state); -KeyData *new_key_data(int screen, Window window, Time time, unsigned int state, - unsigned int key); - -void python_callback(PyObject *func, PyObject *data); bool python_get_long(const char *name, long *value); bool python_get_string(const char *name, std::string *value); bool python_get_stringlist(const char *name, std::vector *value); -#endif + +/*********************************************** + * These are found in openbox.i, not python.cc * + ***********************************************/ +void python_callback(PyObject *func, MotionData *data); +void python_callback(PyObject *func, ButtonData *data); +void python_callback(PyObject *func, EventData *data); +void python_callback(PyObject *func, KeyData *data); + +#endif // SWIG PyObject *mbind(const std::string &button, ob::MouseContext context, ob::MouseAction action, PyObject *func); @@ -148,7 +196,7 @@ void set_reset_key(const std::string &key); PyObject *send_client_msg(Window target, int type, Window about, long data, long data1 = 0, long data2 = 0, long data3 = 0, long data4 = 0); - } + #endif // __python_hh diff --git a/src/screen.cc b/src/screen.cc index c650872e..e97c05b2 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -140,9 +140,8 @@ OBScreen::OBScreen(int screen) Openbox::instance->registerHandler(_info->rootWindow(), this); // call the python Startup callbacks - EventData *data = new_event_data(_number, 0, EventShutdown, 0); - Openbox::instance->bindings()->fireEvent(data); - Py_XDECREF((PyObject*)data); + EventData data(_number, 0, EventShutdown, 0); + Openbox::instance->bindings()->fireEvent(&data); } @@ -157,9 +156,8 @@ OBScreen::~OBScreen() unmanageWindow(clients.front()); // call the python Shutdown callbacks - EventData *data = new_event_data(_number, 0, EventShutdown, 0); - Openbox::instance->bindings()->fireEvent(data); - Py_XDECREF((PyObject*)data); + EventData data(_number, 0, EventShutdown, 0); + Openbox::instance->bindings()->fireEvent(&data); XDestroyWindow(otk::OBDisplay::display, _focuswindow); XDestroyWindow(otk::OBDisplay::display, _supportwindow); @@ -497,9 +495,8 @@ void OBScreen::manageWindow(Window window) client->positionRequested())) { // position the window intelligenty .. hopefully :) // call the python PLACEWINDOW binding - EventData *data = new_event_data(_number, window, EventPlaceWindow, 0); - Openbox::instance->bindings()->fireEvent(data); - Py_DECREF((PyObject*)data); + EventData data(_number, client, EventPlaceWindow, 0); + Openbox::instance->bindings()->fireEvent(&data); } // create the decoration frame for the client window @@ -542,9 +539,8 @@ void OBScreen::manageWindow(Window window) Openbox::instance->bindings()->grabButtons(true, client); // call the python NEWWINDOW binding - EventData *data = new_event_data(_number, window, EventNewWindow, 0); - Openbox::instance->bindings()->fireEvent(data); - Py_DECREF((PyObject*)data); + EventData data(_number, client, EventNewWindow, 0); + Openbox::instance->bindings()->fireEvent(&data); #ifdef DEBUG printf("Managed window 0x%lx\n", window); @@ -557,10 +553,8 @@ void OBScreen::unmanageWindow(OBClient *client) OBFrame *frame = client->frame; // call the python CLOSEWINDOW binding - EventData *data = new_event_data(_number, client->window(), - EventCloseWindow, 0); - Openbox::instance->bindings()->fireEvent(data); - Py_DECREF((PyObject*)data); + EventData data(_number, client, EventCloseWindow, 0); + Openbox::instance->bindings()->fireEvent(&data); Openbox::instance->bindings()->grabButtons(false, client); -- 2.45.2