summaryrefslogtreecommitdiff
path: root/wrap/ob.i
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-02-05 15:38:29 +0000
committerDana Jansens <danakj@orodu.net>2003-02-05 15:38:29 +0000
commit7c8c9e998ffc3a9b22e15feeffe77823142ce531 (patch)
tree703b1db62f68f85d97a01a265fd73d18d9b24682 /wrap/ob.i
parentffea5b55912ea936c84ce3d17577e9532a81cae4 (diff)
new swig build system. much better. yay.
Diffstat (limited to 'wrap/ob.i')
-rw-r--r--wrap/ob.i102
1 files changed, 102 insertions, 0 deletions
diff --git a/wrap/ob.i b/wrap/ob.i
new file mode 100644
index 00000000..b4c94622
--- /dev/null
+++ b/wrap/ob.i
@@ -0,0 +1,102 @@
+// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
+
+%module ob
+
+%{
+#ifdef HAVE_CONFIG_H
+# include "../config.h"
+#endif
+
+#include "frame.hh"
+#include "openbox.hh"
+#include "screen.hh"
+#include "client.hh"
+#include "bindings.hh"
+#include "actions.hh"
+#include "python.hh"
+#include "otk/otk.hh"
+%}
+
+%include "stl.i"
+//%include std_list.i
+//%template(ClientList) std::list<Client*>;
+%include "callback.i"
+
+%immutable ob::openbox;
+/*
+%ignore ob::openbox;
+%inline %{
+ ob::Openbox *Openbox_instance() { return ob::openbox; }
+%};
+*/
+
+%ignore ob::Screen::clients;
+%{
+ #include <iterator>
+%}
+%extend ob::Screen {
+ Client *client(int i) {
+ if (i < 0 || i >= (int)self->clients.size())
+ return NULL;
+ ob::Client::List::iterator it = self->clients.begin();
+ std::advance(it,i);
+ return *it;
+ }
+ int clientCount() const {
+ return (int) self->clients.size();
+ }
+};
+
+%import "otk.i"
+
+%import "widgetbase.hh"
+%import "actions.hh"
+
+%include "openbox.hh"
+%include "screen.hh"
+%include "client.hh"
+%include "frame.hh"
+%include "python.hh"
+
+// for Window etc
+%import "X11/X.h"
+
+%inline %{
+void set_reset_key(const std::string &key)
+{
+ ob::openbox->bindings()->setResetKey(key);
+}
+
+void send_client_msg(Window target, Atom type, Window about,
+ long data, long data1, long data2,
+ long data3, long data4)
+{
+ XEvent e;
+ e.xclient.type = ClientMessage;
+ e.xclient.format = 32;
+ e.xclient.message_type = type;
+ e.xclient.window = about;
+ e.xclient.data.l[0] = data;
+ e.xclient.data.l[1] = data1;
+ e.xclient.data.l[2] = data2;
+ e.xclient.data.l[3] = data3;
+ e.xclient.data.l[4] = data4;
+
+ XSendEvent(**otk::display, target, false,
+ SubstructureRedirectMask | SubstructureNotifyMask,
+ &e);
+}
+
+void execute(const std::string &bin, int screen)
+{
+ if (screen >= ScreenCount(**otk::display))
+ screen = 0;
+ otk::bexec(bin, otk::display->screenInfo(screen)->displayString());
+}
+
+%};
+
+// globals
+%pythoncode %{
+openbox = cvar.openbox;
+%}