]> Dogcows Code - chaz/openbox/blob - wrap/ob.i
more user friendly net_showing_desktop support
[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 // do this through events
49 %ignore ob::Screen::showDesktop(bool);
50
51 %import "otk.i"
52
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 %}
This page took 0.041403 seconds and 5 git commands to generate.