]> icculus.org git repositories - mikachu/openbox.git/blob - wrap/ob.i
include the .i's in the dist
[mikachu/openbox.git] / wrap / ob.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 %include "callback.i"
24
25 %immutable ob::openbox;
26 /*
27 %ignore ob::openbox;
28 %inline %{
29   ob::Openbox *Openbox_instance() { return ob::openbox; }
30 %};
31 */
32
33 %ignore ob::Screen::clients;
34 %{
35   #include <iterator>
36 %}
37 %extend ob::Screen {
38   Client *client(int i) {
39     if (i < 0 || i >= (int)self->clients.size())
40       return NULL;
41     ob::Client::List::iterator it = self->clients.begin();
42     std::advance(it,i);
43     return *it;
44   }
45   int clientCount() const {
46     return (int) self->clients.size();
47   }
48 };
49
50 %import "otk.i"
51
52 %import "widgetbase.hh"
53 %import "actions.hh"
54
55 %include "openbox.hh"
56 %include "screen.hh"
57 %include "client.hh"
58 %include "frame.hh"
59 %include "python.hh"
60
61 // for Window etc
62 %import "X11/X.h"
63
64 %inline %{
65 void set_reset_key(const std::string &key)
66 {
67   ob::openbox->bindings()->setResetKey(key);
68 }
69
70 void send_client_msg(Window target, Atom type, Window about,
71                      long data=0, long data1=0, long data2=0,
72                      long data3=0, long data4=0)
73 {
74   XEvent e;
75   e.xclient.type = ClientMessage;
76   e.xclient.format = 32;
77   e.xclient.message_type = type;
78   e.xclient.window = about;
79   e.xclient.data.l[0] = data;
80   e.xclient.data.l[1] = data1;
81   e.xclient.data.l[2] = data2;
82   e.xclient.data.l[3] = data3;
83   e.xclient.data.l[4] = data4;
84
85   XSendEvent(**otk::display, target, false,
86              SubstructureRedirectMask | SubstructureNotifyMask,
87              &e);
88 }
89
90 void execute(const std::string &bin, int screen=0)
91 {
92   if (screen >= ScreenCount(**otk::display))
93     screen = 0;
94   otk::bexec(bin, otk::display->screenInfo(screen)->displayString());
95 }
96
97 %};
98
99 // globals
100 %pythoncode %{
101 openbox = cvar.openbox;
102 %}