all repos — openbox @ 6e29605d41cab8fd7e8ad6f28d6132bbd521f106

openbox fork - make it a bit more like ryudo

wrap/ob_screen.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
100
101
102
103
104
105
106
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-

%module ob_screen

%{
#include "config.h"
#include "screen.hh"
#include "otk/display.hh"
#include "otk/property.hh"
%}

%include "ob_client.i"
%include "otk_rect.i"
%include "otk_ustring.i"
%include "otk_size.i"
%include "std_vector.i"

%typemap(python,out) const otk::Property::StringVect& {
  otk::Property::StringVect *v = $1;
  unsigned int s = v->size();
  PyObject *l = PyList_New(s);

  otk::Property::StringVect::const_iterator it = v->begin(), end = v->end();
  for (unsigned int i = 0; i < s; ++i, ++it) {
    PyObject *pdata = PyString_FromString(it->c_str());
    PyList_SET_ITEM(l, i, pdata);
  }
  $result = l;
}

%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;
}

%typemap(python,out) const std::vector<otk::Rect>& {
  std::vector<otk::Rect> *v = $1;
  unsigned int s = v->size();
  PyObject *l = PyList_New(s);

  std::vector<otk::Rect>::const_iterator it = v->begin(), end = v->end();
  for (unsigned int i = 0; i < s; ++i, ++it) {
    PyObject *pdata = SWIG_NewPointerObj((void*)&(*it),SWIGTYPE_p_otk__Rect,0);
    PyList_SET_ITEM(l, i, pdata);
  }
  $result = l;
}

namespace ob {

%extend Screen {
  void showDesktop(bool show) {
    Window root = RootWindow(**otk::display, self->number());
    send_client_msg(root, otk::Property::atoms.net_showing_desktop,
                    root, show);
  }

  void changeDesktop(unsigned int desktop) {
    Window root = RootWindow(**otk::display, self->number());
    send_client_msg(root, otk::Property::atoms.net_current_desktop,
                    root, desktop);
  }

  const otk::Size& size() {
    return otk::display->screenInfo(self->number())->size();
  }

  const std::vector<otk::Rect> &xineramaAreas() {
    return otk::display->screenInfo(self->number())->xineramaAreas();
  }

  Window rootWindow() {
    return otk::display->screenInfo(self->number())->rootWindow();
  }
}

%immutable Screen::clients;

%ignore Screen::event_mask;
%ignore Screen::Screen(int);
%ignore Screen::~Screen();
%ignore Screen::focuswindow() const;
%ignore Screen::managed() const;
%rename(ignored_showDesktop) Screen::showDesktop(bool show);
%ignore Screen::ignored_showDesktop(bool show);
%ignore Screen::updateStruts();
%ignore Screen::manageExisting();
%ignore Screen::manageWindow(Window);
%ignore Screen::unmanageWindow(Client*);
%ignore Screen::raiseWindow(Client*);
%ignore Screen::lowerWindow(Client*);
%ignore Screen::installColormap(bool) const;
%ignore Screen::propertyHandler(const XPropertyEvent &);
%ignore Screen::clientMessageHandler(const XClientMessageEvent &);
%ignore Screen::mapRequestHandler(const XMapRequestEvent &);

}

%include "screen.hh"