]> icculus.org git repositories - dana/openbox.git/blob - src/openbox.i
notify the frame when the desktop changes
[dana/openbox.git] / src / openbox.i
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2
3 %module ob
4
5 %{
6 #ifdef HAVE_CONFIG_H
7 #  include "../config.h"
8 #endif
9
10 #include "frame.hh"
11 #include "openbox.hh"
12 #include "screen.hh"
13 #include "client.hh"
14 #include "bindings.hh"
15 #include "actions.hh"
16 #include "python.hh"
17 #include "otk/otk.hh"
18 %}
19
20 %include "stl.i"
21 //%include std_list.i
22 //%template(ClientList) std::list<Client*>;
23
24 %ignore ob::openbox;
25 %inline %{
26   ob::Openbox *Openbox_instance() { return ob::openbox; }
27 %};
28
29 %{
30 namespace ob {
31 void python_callback(PyObject *func, MouseData *data)
32 {
33   PyObject *arglist, *result, *pdata;
34
35   pdata = SWIG_NewPointerObj((void *) data, SWIGTYPE_p_ob__MouseData, 0);
36   arglist = Py_BuildValue("(O)", pdata);
37   Py_DECREF(pdata);
38   
39   // call the callback
40   result = PyEval_CallObject(func, arglist);
41   if (!result || PyErr_Occurred()) {
42     // an exception occured in the script, display it
43     PyErr_Print();
44   }
45
46   Py_XDECREF(result);
47   Py_DECREF(arglist);
48 }
49
50 void python_callback(PyObject *func, EventData *data)
51 {
52   PyObject *arglist, *result, *pdata;
53
54   pdata = SWIG_NewPointerObj((void *) data, SWIGTYPE_p_ob__EventData, 0);
55   arglist = Py_BuildValue("(O)", pdata);
56   Py_DECREF(pdata);
57   
58   // call the callback
59   result = PyEval_CallObject(func, arglist);
60   if (!result || PyErr_Occurred()) {
61     // an exception occured in the script, display it
62     PyErr_Print();
63   }
64
65   Py_XDECREF(result);
66   Py_DECREF(arglist);
67 }
68
69 void python_callback(PyObject *func, KeyData *data)
70 {
71   PyObject *arglist, *result, *pdata;
72
73   pdata = SWIG_NewPointerObj((void *) data, SWIGTYPE_p_ob__KeyData, 0);
74   arglist = Py_BuildValue("(O)", pdata);
75   Py_DECREF(pdata);
76   
77   // call the callback
78   result = PyEval_CallObject(func, arglist);
79   if (!result || PyErr_Occurred()) {
80     // an exception occured in the script, display it
81     PyErr_Print();
82   }
83
84   Py_XDECREF(result);
85   Py_DECREF(arglist);
86 }
87
88 }
89 %}
90
91 #ignore ob::openbox;
92
93 %ignore ob::Screen::clients;
94 %{
95   #include <iterator>
96 %}
97 %extend ob::Screen {
98   Client *client(int i) {
99     if (i < 0 || i >= (int)self->clients.size())
100       return NULL;
101     ob::Client::List::iterator it = self->clients.begin();
102     std::advance(it,i);
103     return *it;
104   }
105   int clientCount() const {
106     return (int) self->clients.size();
107   }
108 };
109
110 /*
111 %include "../otk/ustring.i"
112
113 %ignore otk::display;
114 %inline %{
115   otk::Display *Display_instance() { return otk::display; }
116 %};
117
118 %ignore otk::Property::atoms;
119 %inline %{
120   const otk::Atoms& Property_atoms() { return otk::Property::atoms; }
121 %};
122
123 %include "../otk/display.hh"
124 %include "../otk/point.hh"
125 %include "../otk/property.hh"
126 %include "../otk/rect.hh"
127 %include "../otk/screeninfo.hh"
128 %include "../otk/strut.hh"
129
130 %include "../otk/eventhandler.hh"
131 %include "../otk/eventdispatcher.hh"
132
133 %import "../otk/widget.hh"
134 */
135 %import "../otk/otk.i"
136
137 %import "widgetbase.hh"
138 %import "actions.hh"
139
140 %include "openbox.hh"
141 %include "screen.hh"
142 %include "client.hh"
143 %include "frame.hh"
144 %include "python.hh"
145
146 // for Mod1Mask etc
147 %include "X11/X.h"