all repos — openbox @ a7d17188a4d98ec9a30bf980079fd12f8313d9b3

openbox fork - make it a bit more like ryudo

wrap/ob.i (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-

%module ob

%{
#include "config.h"

#include "frame.hh"
#include "openbox.hh"
#include "screen.hh"
#include "client.hh"
#include "bindings.hh"
#include "actions.hh"
#include "python.hh"
#include "otk/otk.hh"
%}

%include "stl.i"
%include "callback.i"

%immutable ob::openbox;
/*
%ignore ob::openbox;
%inline %{
  ob::Openbox *Openbox_instance() { return ob::openbox; }
%};
*/

%typemap(python,out) std::list<ob::Client*> {
  unsigned int s = $1.size();
  PyObject *l = PyList_New(s);

  std::list<ob::Client*>::const_iterator it = $1.begin(), end = $1.end();
  for (unsigned int i = 0; i < s; ++i, ++it) {
    PyObject *pdata = SWIG_NewPointerObj((void *) *it,
                                         SWIGTYPE_p_ob__Client, 0);
    PyList_SET_ITEM(l, i, pdata);
 }
  $result = l;
}
 
// do this through events
%ignore ob::Screen::showDesktop(bool);

%ignore ob::Screen::managed;
%ignore ob::Screen::config;

%import "otk.i"

%import "actions.hh"

%include "openbox.hh"
%include "screen.hh"
%include "client.hh"
%include "frame.hh"
%include "python.hh"

// for Window etc
%import "X11/X.h"

%inline %{
void set_reset_key(const std::string &key)
{
  ob::openbox->bindings()->setResetKey(key);
}

void send_client_msg(Window target, Atom type, Window about,
                     long data=0, long data1=0, long data2=0,
                     long data3=0, long data4=0)
{
  XEvent e;
  e.xclient.type = ClientMessage;
  e.xclient.format = 32;
  e.xclient.message_type = type;
  e.xclient.window = about;
  e.xclient.data.l[0] = data;
  e.xclient.data.l[1] = data1;
  e.xclient.data.l[2] = data2;
  e.xclient.data.l[3] = data3;
  e.xclient.data.l[4] = data4;

  XSendEvent(**otk::display, target, false,
             SubstructureRedirectMask | SubstructureNotifyMask,
             &e);
}

void execute(const std::string &bin, int screen=0)
{
  if (screen >= ScreenCount(**otk::display))
    screen = 0;
  otk::bexec(bin, otk::display->screenInfo(screen)->displayString());
}

%};

// globals
%pythoncode %{
openbox = cvar.openbox;
%}