python interface is working!
This commit is contained in:
parent
fdd5338fc1
commit
fe55bb846d
4 changed files with 35 additions and 22 deletions
|
@ -29,7 +29,7 @@ openbox.i: openbox.hh screen.hh client.hh
|
||||||
touch openbox.i
|
touch openbox.i
|
||||||
|
|
||||||
openbox_wrap.cc: openbox.i
|
openbox_wrap.cc: openbox.i
|
||||||
swig -python -c++ -nodefault -module openbox -o openbox_wrap.cc openbox.i
|
swig -python -c++ -nodefault -o openbox_wrap.cc openbox.i
|
||||||
# swig -guile -c++ -nodefault -o openbox_wrap.cc openbox.i
|
# swig -guile -c++ -nodefault -o openbox_wrap.cc openbox.i
|
||||||
|
|
||||||
# local dependencies
|
# local dependencies
|
||||||
|
|
|
@ -12,17 +12,32 @@
|
||||||
#include "client.hh"
|
#include "client.hh"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%immutable ob::Openbox::instance;
|
%include stl.i
|
||||||
|
//%include std_list.i
|
||||||
|
//%template(ClientList) std::list<OBClient*>;
|
||||||
|
|
||||||
|
|
||||||
|
%ignore ob::Openbox::instance;
|
||||||
|
%ignore ob::OBScreen::clients;
|
||||||
|
|
||||||
%include "openbox.hh"
|
%include "openbox.hh"
|
||||||
%include "screen.hh"
|
%include "screen.hh"
|
||||||
%include "client.hh"
|
%include "client.hh"
|
||||||
|
|
||||||
|
%inline %{
|
||||||
%include stl.i
|
ob::Openbox *Openbox_instance() { return ob::Openbox::instance; }
|
||||||
%include std_list.i
|
%};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
class OBClient;
|
#include <iterator>
|
||||||
%}
|
%}
|
||||||
%template(ClientList) std::list<OBClient*>;
|
%extend ob::OBScreen {
|
||||||
|
OBClient *client(int i) {
|
||||||
|
ob::OBScreen::ClientList::iterator it = self->clients.begin();
|
||||||
|
std::advance(it,i);
|
||||||
|
return *it;
|
||||||
|
}
|
||||||
|
int clientCount() const {
|
||||||
|
return (int) self->clients.size();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
@ -101,8 +101,8 @@ OBScreen::~OBScreen()
|
||||||
if (! _managed) return;
|
if (! _managed) return;
|
||||||
|
|
||||||
// unmanage all windows
|
// unmanage all windows
|
||||||
while (!_clients.empty())
|
while (!clients.empty())
|
||||||
unmanageWindow(_clients.front());
|
unmanageWindow(clients.front());
|
||||||
|
|
||||||
delete _image_control;
|
delete _image_control;
|
||||||
}
|
}
|
||||||
|
@ -243,13 +243,13 @@ void OBScreen::setClientList()
|
||||||
Window *windows;
|
Window *windows;
|
||||||
|
|
||||||
// create an array of the window ids
|
// create an array of the window ids
|
||||||
if (_clients.size() > 0) {
|
if (clients.size() > 0) {
|
||||||
Window *win_it;
|
Window *win_it;
|
||||||
|
|
||||||
windows = new Window[_clients.size()];
|
windows = new Window[clients.size()];
|
||||||
win_it = windows;
|
win_it = windows;
|
||||||
ClientList::const_iterator it = _clients.begin();
|
ClientList::const_iterator it = clients.begin();
|
||||||
const ClientList::const_iterator end = _clients.end();
|
const ClientList::const_iterator end = clients.end();
|
||||||
for (; it != end; ++it, ++win_it)
|
for (; it != end; ++it, ++win_it)
|
||||||
*win_it = (*it)->window();
|
*win_it = (*it)->window();
|
||||||
} else
|
} else
|
||||||
|
@ -258,9 +258,9 @@ void OBScreen::setClientList()
|
||||||
Openbox::instance->property()->set(_info->rootWindow(),
|
Openbox::instance->property()->set(_info->rootWindow(),
|
||||||
otk::OBProperty::net_client_list,
|
otk::OBProperty::net_client_list,
|
||||||
otk::OBProperty::Atom_Window,
|
otk::OBProperty::Atom_Window,
|
||||||
windows, _clients.size());
|
windows, clients.size());
|
||||||
|
|
||||||
if (_clients.size())
|
if (clients.size())
|
||||||
delete [] windows;
|
delete [] windows;
|
||||||
|
|
||||||
setStackingList();
|
setStackingList();
|
||||||
|
@ -389,7 +389,7 @@ void OBScreen::manageWindow(Window window)
|
||||||
otk::OBDisplay::ungrab();
|
otk::OBDisplay::ungrab();
|
||||||
|
|
||||||
// add to the screen's list
|
// add to the screen's list
|
||||||
_clients.push_back(client);
|
clients.push_back(client);
|
||||||
// update the root properties
|
// update the root properties
|
||||||
setClientList();
|
setClientList();
|
||||||
}
|
}
|
||||||
|
@ -432,7 +432,7 @@ void OBScreen::unmanageWindow(OBClient *client)
|
||||||
client->frame = 0;
|
client->frame = 0;
|
||||||
|
|
||||||
// remove from the screen's list
|
// remove from the screen's list
|
||||||
_clients.remove(client);
|
clients.remove(client);
|
||||||
delete client;
|
delete client;
|
||||||
|
|
||||||
// update the root properties
|
// update the root properties
|
||||||
|
|
|
@ -43,6 +43,9 @@ public:
|
||||||
ButtonPressMask |
|
ButtonPressMask |
|
||||||
ButtonReleaseMask;
|
ButtonReleaseMask;
|
||||||
|
|
||||||
|
//! All managed clients on the screen
|
||||||
|
ClientList clients;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Was %Openbox able to manage the screen?
|
//! Was %Openbox able to manage the screen?
|
||||||
bool _managed;
|
bool _managed;
|
||||||
|
@ -64,9 +67,6 @@ private:
|
||||||
//! Is the root colormap currently installed?
|
//! Is the root colormap currently installed?
|
||||||
bool _root_cmap_installed;
|
bool _root_cmap_installed;
|
||||||
|
|
||||||
//! All managed clients on the screen
|
|
||||||
ClientList _clients;
|
|
||||||
|
|
||||||
//! Area usable for placement etc (total - struts)
|
//! Area usable for placement etc (total - struts)
|
||||||
otk::Rect _area;
|
otk::Rect _area;
|
||||||
|
|
||||||
|
@ -114,8 +114,6 @@ public:
|
||||||
//! Returns the style in use on the screen
|
//! Returns the style in use on the screen
|
||||||
inline const otk::Style *style() const { return &_style; }
|
inline const otk::Style *style() const { return &_style; }
|
||||||
|
|
||||||
inline ClientList clients() { return _clients; }
|
|
||||||
|
|
||||||
//! Adds a window's strut to the screen's list of reserved spaces
|
//! Adds a window's strut to the screen's list of reserved spaces
|
||||||
void addStrut(otk::Strut *strut);
|
void addStrut(otk::Strut *strut);
|
||||||
//! Removes a window's strut from the screen's list of reserved spaces
|
//! Removes a window's strut from the screen's list of reserved spaces
|
||||||
|
|
Loading…
Reference in a new issue