From 4534151926c4f3887ba9e37ae67df16f1eb039ef Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 17 Feb 2003 21:25:52 +0000 Subject: split up the otk stuff into separate files. wrap otk::Property properly with typemaps so that it is usable. wrap otk::Timer properly so that you can use it with a python callback --- wrap/ob_screen.i | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'wrap/ob_screen.i') diff --git a/wrap/ob_screen.i b/wrap/ob_screen.i index bbf7b57c..b182d2d7 100644 --- a/wrap/ob_screen.i +++ b/wrap/ob_screen.i @@ -10,8 +10,23 @@ %} %include "ob_client.i" -%include "otk.i" // XXX otk_rect.i!!! -%include "ustring.i" +%include "otk_rect.i" +%include "otk_ustring.i" +%include "otk_size.i" +%include "std_vector.i" + +%typemap(python,out) const otk::Property::StringVect& { + otk::Property::StringVect *v = $1; + unsigned int s = v->size(); + PyObject *l = PyList_New(s); + + otk::Property::StringVect::const_iterator it = v->begin(), end = v->end(); + for (unsigned int i = 0; i < s; ++i, ++it) { + PyObject *pdata = PyString_FromString(it->c_str()); + PyList_SET_ITEM(l, i, pdata); + } + $result = l; +} %typemap(python,out) std::list { unsigned int s = $1.size(); @@ -25,14 +40,14 @@ $result = l; } -%typemap(python,out) const otk::Property::StringVect& { - otk::Property::StringVect *v = $1; +%typemap(python,out) const std::vector& { + std::vector *v = $1; unsigned int s = v->size(); PyObject *l = PyList_New(s); - otk::Property::StringVect::const_iterator it = v->begin(), end = v->end(); + std::vector::const_iterator it = v->begin(), end = v->end(); for (unsigned int i = 0; i < s; ++i, ++it) { - PyObject *pdata = PyString_FromString(it->c_str()); + PyObject *pdata = SWIG_NewPointerObj((void*)&(*it),SWIGTYPE_p_otk__Rect,0); PyList_SET_ITEM(l, i, pdata); } $result = l; @@ -52,6 +67,18 @@ namespace ob { send_client_msg(root, otk::Property::atoms.net_current_desktop, root, desktop); } + + const otk::Size& size() { + return otk::display->screenInfo(self->number())->size(); + } + + const std::vector &xineramaAreas() { + return otk::display->screenInfo(self->number())->xineramaAreas(); + } + + Window rootWindow() { + return otk::display->screenInfo(self->number())->rootWindow(); + } } %immutable Screen::clients; -- cgit v1.2.3