]> Dogcows Code - chaz/openbox/blob - src/openbox.i
add OBDisplay_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<OBClient*>;
22
23 %ignore ob::Openbox::instance;
24 %inline %{
25 ob::Openbox *Openbox_instance() { return ob::Openbox::instance; }
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::OBScreen::clients;
94 %{
95 #include <iterator>
96 %}
97 %extend ob::OBScreen {
98 OBClient *client(int i) {
99 if (i >= (int)self->clients.size())
100 return NULL;
101 ob::OBClient::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 %ignore otk::OBDisplay::display;
111 %inline %{
112 Display *OBDisplay_display() { return otk::OBDisplay::display; }
113 %};
114
115 %include "../otk/display.hh"
116 %include "../otk/point.hh"
117 %include "../otk/property.hh"
118 %include "../otk/rect.hh"
119 %include "../otk/screeninfo.hh"
120 %include "../otk/strut.hh"
121
122 %rename(itostring_unsigned) itostring(unsigned int);
123 %rename(itostring_long) itostring(long);
124 %rename(itostring_unsigned_long) itostring(unsigned long);
125 %include "../otk/util.hh"
126
127 %include "../otk/eventhandler.hh"
128 %include "../otk/eventdispatcher.hh"
129
130 %import "widgetbase.hh"
131 %import "actions.hh"
132
133 %include "openbox.hh"
134 %include "screen.hh"
135 %include "client.hh"
136 %include "python.hh"
137
138 // for Mod1Mask etc
139 %include "X11/X.h"
This page took 0.047865 seconds and 5 git commands to generate.