]> Dogcows Code - chaz/openbox/blob - src/openbox.i
use the new non-static display
[chaz/openbox] / src / openbox.i
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2
3 %module openbox
4
5 %{
6 #ifdef HAVE_CONFIG_H
7 # include "../config.h"
8 #endif
9
10 #include "openbox.hh"
11 #include "screen.hh"
12 #include "client.hh"
13 #include "bindings.hh"
14 #include "actions.hh"
15 #include "python.hh"
16 #include "otk/otk.hh"
17 %}
18
19 %include "stl.i"
20 //%include std_list.i
21 //%template(ClientList) std::list<Client*>;
22
23 %ignore ob::openbox;
24 %inline %{
25 ob::Openbox *Openbox_instance() { return ob::openbox; }
26 %};
27
28 %{
29 namespace ob {
30 void python_callback(PyObject *func, MouseData *data)
31 {
32 PyObject *arglist;
33 PyObject *result;
34
35 arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data,
36 SWIGTYPE_p_ob__MouseData,
37 0));
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;
53 PyObject *result;
54
55 arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data,
56 SWIGTYPE_p_ob__EventData,
57 0));
58
59 // call the callback
60 result = PyEval_CallObject(func, arglist);
61 if (!result || PyErr_Occurred()) {
62 // an exception occured in the script, display it
63 PyErr_Print();
64 }
65
66 Py_XDECREF(result);
67 Py_DECREF(arglist);
68 }
69
70 void python_callback(PyObject *func, KeyData *data)
71 {
72 PyObject *arglist;
73 PyObject *result;
74
75 arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data,
76 SWIGTYPE_p_ob__KeyData,
77 0));
78
79 // call the callback
80 result = PyEval_CallObject(func, arglist);
81 if (!result || PyErr_Occurred()) {
82 // an exception occured in the script, display it
83 PyErr_Print();
84 }
85
86 Py_XDECREF(result);
87 Py_DECREF(arglist);
88 }
89
90 }
91 %}
92
93 #ignore ob::openbox;
94
95 %ignore ob::Screen::clients;
96 %{
97 #include <iterator>
98 %}
99 %extend ob::Screen {
100 Client *client(int i) {
101 if (i < 0 || i >= (int)self->clients.size())
102 return NULL;
103 ob::Client::List::iterator it = self->clients.begin();
104 std::advance(it,i);
105 return *it;
106 }
107 int clientCount() const {
108 return (int) self->clients.size();
109 }
110 };
111
112 %ignore otk::display;
113
114 %include "../otk/ustring.i"
115
116 %include "../otk/display.hh"
117 %include "../otk/point.hh"
118 %include "../otk/property.hh"
119 %include "../otk/rect.hh"
120 %include "../otk/screeninfo.hh"
121 %include "../otk/strut.hh"
122
123 %include "../otk/eventhandler.hh"
124 %include "../otk/eventdispatcher.hh"
125
126 %import "widgetbase.hh"
127 %import "actions.hh"
128
129 %include "openbox.hh"
130 %include "screen.hh"
131 %include "client.hh"
132 %include "python.hh"
133
134 // for Mod1Mask etc
135 %include "X11/X.h"
This page took 0.039418 seconds and 4 git commands to generate.