]> Dogcows Code - chaz/openbox/blob - wrap/ob.i
show desktop mode works!
[chaz/openbox] / wrap / ob.i
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2
3 %module ob
4
5 %{
6 #include "config.h"
7
8 #include "frame.hh"
9 #include "openbox.hh"
10 #include "screen.hh"
11 #include "client.hh"
12 #include "bindings.hh"
13 #include "actions.hh"
14 #include "python.hh"
15 #include "otk/otk.hh"
16 %}
17
18 %include "stl.i"
19 //%include std_list.i
20 //%template(ClientList) std::list<Client*>;
21 %include "callback.i"
22
23 %immutable ob::openbox;
24 /*
25 %ignore ob::openbox;
26 %inline %{
27 ob::Openbox *Openbox_instance() { return ob::openbox; }
28 %};
29 */
30
31 %ignore ob::Screen::clients;
32 %{
33 #include <iterator>
34 %}
35 %extend ob::Screen {
36 Client *client(int i) {
37 if (i < 0 || i >= (int)self->clients.size())
38 return NULL;
39 ob::Client::List::iterator it = self->clients.begin();
40 std::advance(it,i);
41 return *it;
42 }
43 int clientCount() const {
44 return (int) self->clients.size();
45 }
46 };
47
48 %import "otk.i"
49
50 %import "actions.hh"
51
52 %include "openbox.hh"
53 %include "screen.hh"
54 %include "client.hh"
55 %include "frame.hh"
56 %include "python.hh"
57
58 // for Window etc
59 %import "X11/X.h"
60
61 %inline %{
62 void set_reset_key(const std::string &key)
63 {
64 ob::openbox->bindings()->setResetKey(key);
65 }
66
67 void send_client_msg(Window target, Atom type, Window about,
68 long data=0, long data1=0, long data2=0,
69 long data3=0, long data4=0)
70 {
71 XEvent e;
72 e.xclient.type = ClientMessage;
73 e.xclient.format = 32;
74 e.xclient.message_type = type;
75 e.xclient.window = about;
76 e.xclient.data.l[0] = data;
77 e.xclient.data.l[1] = data1;
78 e.xclient.data.l[2] = data2;
79 e.xclient.data.l[3] = data3;
80 e.xclient.data.l[4] = data4;
81
82 XSendEvent(**otk::display, target, false,
83 SubstructureRedirectMask | SubstructureNotifyMask,
84 &e);
85 }
86
87 void execute(const std::string &bin, int screen=0)
88 {
89 if (screen >= ScreenCount(**otk::display))
90 screen = 0;
91 otk::bexec(bin, otk::display->screenInfo(screen)->displayString());
92 }
93
94 %};
95
96 // globals
97 %pythoncode %{
98 openbox = cvar.openbox;
99 %}
This page took 0.036962 seconds and 4 git commands to generate.