20ca98288d970f297819ad33a3818d040292bf9d
[dana/openbox.git] / wrap / ob_screen.i
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2
3 %module ob_screen
4
5 %{
6 #include "config.h"
7 #include "screen.hh"
8 #include "otk/display.hh"
9 #include "otk/property.hh"
10 %}
11
12 %include "ob_client.i"
13 %include "otk_rect.i"
14 %include "otk_ustring.i"
15 %include "otk_size.i"
16 %include "std_vector.i"
17
18 %typemap(python,out) const otk::Property::StringVect& {
19   otk::Property::StringVect *v = $1;
20   unsigned int s = v->size();
21   PyObject *l = PyList_New(s);
22
23   otk::Property::StringVect::const_iterator it = v->begin(), end = v->end();
24   for (unsigned int i = 0; i < s; ++i, ++it) {
25     PyObject *pdata = PyString_FromString(it->c_str());
26     PyList_SET_ITEM(l, i, pdata);
27   }
28   $result = l;
29 }
30
31 %typemap(python,out) std::list<ob::Client*> {
32   unsigned int s = $1.size();
33   PyObject *l = PyList_New(s);
34
35   std::list<ob::Client*>::const_iterator it = $1.begin(), end = $1.end();
36   for (unsigned int i = 0; i < s; ++i, ++it) {
37     PyObject *pdata = SWIG_NewPointerObj((void*)*it,SWIGTYPE_p_ob__Client,0);
38     PyList_SET_ITEM(l, i, pdata);
39   }
40   $result = l;
41 }
42
43 %typemap(python,out) const std::vector<otk::Rect>& {
44   std::vector<otk::Rect> *v = $1;
45   unsigned int s = v->size();
46   PyObject *l = PyList_New(s);
47
48   std::vector<otk::Rect>::const_iterator it = v->begin(), end = v->end();
49   for (unsigned int i = 0; i < s; ++i, ++it) {
50     PyObject *pdata = SWIG_NewPointerObj((void*)&(*it),SWIGTYPE_p_otk__Rect,0);
51     PyList_SET_ITEM(l, i, pdata);
52   }
53   $result = l;
54 }
55
56 namespace ob {
57
58 %extend Screen {
59   void showDesktop(bool show) {
60     Window root = RootWindow(**otk::display, self->number());
61     send_client_msg(root, otk::Property::atoms.net_showing_desktop,
62                     root, show);
63   }
64
65   void changeDesktop(unsigned int desktop) {
66     Window root = RootWindow(**otk::display, self->number());
67     send_client_msg(root, otk::Property::atoms.net_current_desktop,
68                     root, desktop);
69   }
70
71   const otk::Size& size() {
72     return otk::display->screenInfo(self->number())->size();
73   }
74
75   const std::vector<otk::Rect> &xineramaAreas() {
76     return otk::display->screenInfo(self->number())->xineramaAreas();
77   }
78
79   Window rootWindow() {
80     return otk::display->screenInfo(self->number())->rootWindow();
81   }
82 }
83
84 %immutable Screen::clients;
85
86 %ignore Screen::event_mask;
87 %ignore Screen::Screen(int);
88 %ignore Screen::~Screen();
89 %ignore Screen::focuswindow() const;
90 %ignore Screen::managed() const;
91 %rename(ignored_showDesktop) Screen::showDesktop(bool show);
92 %ignore Screen::ignored_showDesktop(bool show);
93 %ignore Screen::updateStruts();
94 %ignore Screen::manageExisting();
95 %ignore Screen::manageWindow(Window);
96 %ignore Screen::unmanageWindow(Client*);
97 %ignore Screen::raiseWindow(Client*);
98 %ignore Screen::lowerWindow(Client*);
99 %ignore Screen::installColormap(bool) const;
100 %ignore Screen::propertyHandler(const XPropertyEvent &);
101 %ignore Screen::clientMessageHandler(const XClientMessageEvent &);
102 %ignore Screen::mapRequestHandler(const XMapRequestEvent &);
103
104 }
105
106 %include "screen.hh"