rm the obsetroot tool and the wrap shit from swig
This commit is contained in:
parent
a52a6d96d7
commit
b2babc8b0a
29 changed files with 0 additions and 1325 deletions
|
@ -1,5 +0,0 @@
|
|||
.libs
|
||||
.deps
|
||||
obsetroot
|
||||
Makefile.in
|
||||
Makefile
|
|
@ -1,10 +0,0 @@
|
|||
bin_PROGRAMS=obsetroot
|
||||
|
||||
obsetroot_LDADD=$(XFT_LIBS) -L../otk -lotk @LIBINTL@
|
||||
obsetroot_CPPFLAGS=$(XFT_CFLAGS) -I..
|
||||
obsetroot_SOURCES=obsetroot.cc
|
||||
|
||||
MAINTAINERCLEANFILES=Makefile.in
|
||||
|
||||
distclean-local:
|
||||
$(RM) *\~ *.orig *.rej .\#*
|
|
@ -1,66 +0,0 @@
|
|||
#include <otk/otk.hh>
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
otk::initialize();
|
||||
|
||||
int screen = DefaultScreen(**otk::display);
|
||||
|
||||
Pixmap old;
|
||||
Window root = otk::display->screenInfo(screen)->rootWindow();
|
||||
|
||||
otk::Surface *s = new otk::Surface(screen,
|
||||
otk::display->screenInfo(screen)->size());
|
||||
otk::RenderTexture *tx = new otk::RenderTexture(screen, false,
|
||||
otk::RenderTexture::Flat,
|
||||
otk::RenderTexture::Bevel1,
|
||||
false,
|
||||
otk::RenderTexture::Solid,
|
||||
false, 0x202020, 0x0000ff,
|
||||
0, 0);
|
||||
otk::display->renderControl(screen)->drawBackground(*s, *tx);
|
||||
|
||||
otk::display->grab();
|
||||
|
||||
otk::display->setIgnoreErrors(true);
|
||||
// get the current pixmap and free it
|
||||
if (otk::Property::get(root, otk::Property::atoms.rootpmapid,
|
||||
otk::Property::atoms.pixmap, &old) && old) {
|
||||
XKillClient(**otk::display, old);
|
||||
XSync(**otk::display, false);
|
||||
XFreePixmap(**otk::display, old);
|
||||
}
|
||||
if (otk::Property::get(root, otk::Property::atoms.esetrootid,
|
||||
otk::Property::atoms.pixmap, &old) && old)
|
||||
XFreePixmap(**otk::display, old);
|
||||
otk::display->setIgnoreErrors(false);
|
||||
|
||||
// XSetWindowBackground(**display, root, color.pixel());
|
||||
|
||||
// don't kill us when someone wants to change the background!!
|
||||
Pixmap pixmap = XCreatePixmap(**otk::display, root, s->size().width(),
|
||||
s->size().height(),
|
||||
otk::display->screenInfo(screen)->depth());
|
||||
XCopyArea(**otk::display, s->pixmap(), pixmap,
|
||||
DefaultGC(**otk::display, screen), 0, 0,
|
||||
s->size().width(), s->size().height(), 0, 0);
|
||||
|
||||
// set the new pixmap
|
||||
XSetWindowBackgroundPixmap(**otk::display, root, pixmap);
|
||||
XClearWindow(**otk::display, root);
|
||||
|
||||
otk::Property::set(root, otk::Property::atoms.rootpmapid,
|
||||
otk::Property::atoms.pixmap, pixmap);
|
||||
otk::Property::set(root, otk::Property::atoms.esetrootid,
|
||||
otk::Property::atoms.pixmap, pixmap);
|
||||
|
||||
otk::display->ungrab();
|
||||
|
||||
delete tx;
|
||||
delete s;
|
||||
|
||||
XSetCloseDownMode(**otk::display, RetainPermanent);
|
||||
XKillClient(**otk::display, AllTemporary);
|
||||
|
||||
otk::destroy();
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
Makefile
|
||||
Makefile.in
|
||||
otk.py
|
||||
.deps
|
||||
.libs
|
||||
otkpy.la
|
||||
otkpy_la-wrap_otk.lo
|
||||
otkpy_la-wrap_otk.o
|
||||
wrap_otk.cc
|
||||
ob.py
|
||||
obpy.la
|
||||
obpy_la-wrap_ob.lo
|
||||
wrap_ob.cc
|
||||
wrap_ob.lo
|
||||
wrap_otk.lo
|
|
@ -1,49 +0,0 @@
|
|||
oblibdir = $(libdir)/openbox
|
||||
|
||||
#pythondir = $(oblibdir)/python
|
||||
obpythondir = $(oblibdir)/python
|
||||
|
||||
CPPFLAGS = -I$(srcdir)/../otk -I$(srcdir)/../src $(XFT_CFLAGS) $(SWIG_PYTHON_CFLAGS) @CPPFLAGS@
|
||||
CXXFLAGS = $(filter-out -W -Wall,@CXXFLAGS@)
|
||||
LDFLAGS = -module -avoid-version
|
||||
|
||||
obpython_LTLIBRARIES = otkpy.la obpy.la
|
||||
obpython_PYTHON = otk.py ob.py
|
||||
|
||||
otkpy_la_SOURCES = wrap_otk.cc
|
||||
#otkpy_la_LIBADD = ../otk/libotk.la # do this for the global version of otk
|
||||
|
||||
obpy_la_SOURCES = wrap_ob.cc
|
||||
|
||||
EXTRA_DIST = otk.i ob.i callback.i
|
||||
|
||||
CLEANFILES = wrap_* *.py
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
install-exec-hook:
|
||||
$(mkinstalldirs) "$(DESTDIR)$(obpythondir)"
|
||||
cd "$(DESTDIR)$(obpythondir)" && \
|
||||
$(RM) -f _otk.so && $(LN_S) otkpy.so _otk.so
|
||||
$(mkinstalldirs) "$(DESTDIR)$(obpythondir)"
|
||||
cd "$(DESTDIR)$(obpythondir)" && \
|
||||
$(RM) -f _ob.so && $(LN_S) obpy.so _ob.so
|
||||
|
||||
uninstall-am:
|
||||
$(RM) "$(DESTDIR)$(obpythondir)/_otk.so"
|
||||
$(RM) "$(DESTDIR)$(obpythondir)/_ob.so"
|
||||
-rmdir -p $(obpythondir)
|
||||
|
||||
%.py: wrap_%.cc
|
||||
|
||||
otk.i: $(wildcard ../otk/*.hh)
|
||||
@touch $@
|
||||
|
||||
ob.i: $(addprefix ../src/,openbox.hh screen.hh client.hh python.hh frame.hh)
|
||||
@touch $@
|
||||
|
||||
wrap_otk.cc: otk.i otk_point.i otk_rect.i otk_size.i otk_rendercolor.i otk_rendertexture.i otk_ustring.i otk_font.i otk_renderstyle.i otk_widget.i otk_label.i otk_button.i otk_appwidget.i otk_application.i otk_strut.i otk_property.i otk_timer.i
|
||||
$(SWIG) $(SWIG_PYTHON_OPT) $(filter -I%,$(CPPFLAGS)) -nodefault -o $@ $<
|
||||
|
||||
wrap_ob.cc: ob.i ob_callback.i ob_client.i ob_screen.i ob_openbox.i ob_frame.i ob_python.i
|
||||
$(SWIG) $(SWIG_PYTHON_OPT) $(filter -I%,$(CPPFLAGS)) -nodefault -o $@ $<
|
||||
|
64
wrap/ob.i
64
wrap/ob.i
|
@ -1,64 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module ob
|
||||
|
||||
%{
|
||||
#include <X11/Xlib.h>
|
||||
#include "otk/display.hh"
|
||||
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);
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%include "ob_openbox.i"
|
||||
%include "ob_screen.i"
|
||||
%include "ob_client.i"
|
||||
%include "ob_frame.i"
|
||||
%include "ob_python.i"
|
||||
%include "ob_callback.i"
|
||||
|
||||
// for Window etc
|
||||
%import "X11/X.h"
|
||||
|
||||
%inline %{
|
||||
#include <string>
|
||||
#include "bindings.hh"
|
||||
#include "otk/display.hh"
|
||||
#include "otk/screeninfo.hh"
|
||||
#include "otk/util.hh"
|
||||
|
||||
void set_reset_key(const std::string &key)
|
||||
{
|
||||
ob::openbox->bindings()->setResetKey(key);
|
||||
}
|
||||
|
||||
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;
|
||||
%}
|
|
@ -1,206 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module ob_callback
|
||||
|
||||
%include "std_string.i"
|
||||
|
||||
%{
|
||||
/*
|
||||
Calls a python callback for the MouseCallback function type
|
||||
*/
|
||||
static void PythonMouseCallback(ob::MouseData *data, void *pyfunc)
|
||||
{
|
||||
PyObject *arglist, *pdata, *result;
|
||||
|
||||
pdata = SWIG_NewPointerObj((void *) data, SWIGTYPE_p_ob__MouseData, 0);
|
||||
arglist = Py_BuildValue("(O)", pdata);
|
||||
Py_DECREF(pdata);
|
||||
|
||||
// call the callback
|
||||
result = PyEval_CallObject((PyObject*)pyfunc, arglist);
|
||||
if (!result || PyErr_Occurred()) {
|
||||
// an exception occured in the script, display it
|
||||
PyErr_Print();
|
||||
}
|
||||
|
||||
Py_XDECREF(result);
|
||||
Py_DECREF(arglist);
|
||||
}
|
||||
|
||||
/*
|
||||
Calls a python callback for the KeyCallback function type
|
||||
*/
|
||||
static void PythonKeyCallback(ob::KeyData *data, void *pyfunc)
|
||||
{
|
||||
PyObject *arglist, *pdata, *result;
|
||||
|
||||
pdata = SWIG_NewPointerObj((void *) data, SWIGTYPE_p_ob__KeyData, 0);
|
||||
arglist = Py_BuildValue("(O)", pdata);
|
||||
Py_DECREF(pdata);
|
||||
|
||||
// call the callback
|
||||
result = PyEval_CallObject((PyObject*)pyfunc, arglist);
|
||||
if (!result || PyErr_Occurred()) {
|
||||
// an exception occured in the script, display it
|
||||
PyErr_Print();
|
||||
}
|
||||
|
||||
Py_XDECREF(result);
|
||||
Py_DECREF(arglist);
|
||||
}
|
||||
|
||||
/*
|
||||
Calls a python callback for the EventCallback function type
|
||||
*/
|
||||
static void PythonEventCallback(ob::EventData *data, void *pyfunc)
|
||||
{
|
||||
PyObject *arglist, *pdata, *result;
|
||||
|
||||
pdata = SWIG_NewPointerObj((void *) data, SWIGTYPE_p_ob__EventData, 0);
|
||||
arglist = Py_BuildValue("(O)", pdata);
|
||||
Py_DECREF(pdata);
|
||||
|
||||
// call the callback
|
||||
result = PyEval_CallObject((PyObject*)pyfunc, arglist);
|
||||
if (!result || PyErr_Occurred()) {
|
||||
// an exception occured in the script, display it
|
||||
PyErr_Print();
|
||||
}
|
||||
|
||||
Py_XDECREF(result);
|
||||
Py_DECREF(arglist);
|
||||
}
|
||||
%}
|
||||
|
||||
// for all of these, PyErr_SetString is called before they return a false!
|
||||
%exception mbind {
|
||||
$action
|
||||
if (!result) return NULL;
|
||||
}
|
||||
%exception kbind {
|
||||
$action
|
||||
if (!result) return NULL;
|
||||
}
|
||||
%exception ebind {
|
||||
$action
|
||||
if (!result) return NULL;
|
||||
}
|
||||
%exception kgrab {
|
||||
$action
|
||||
if (!result) return NULL;
|
||||
}
|
||||
%exception mgrab {
|
||||
$action
|
||||
if (!result) return NULL;
|
||||
}
|
||||
|
||||
// Grab a Python function object as a Python object.
|
||||
%typemap(python,in) PyObject *func {
|
||||
if (!PyCallable_Check($input)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Excepting a callable object.");
|
||||
return NULL;
|
||||
}
|
||||
$1 = $input;
|
||||
}
|
||||
|
||||
%inline %{
|
||||
#include "bindings.hh"
|
||||
|
||||
bool mbind(const std::string &button, ob::MouseContext::MC context,
|
||||
ob::MouseAction::MA action, PyObject *func)
|
||||
{
|
||||
if(context < 0 || context >= ob::MouseContext::NUM_MOUSE_CONTEXT) {
|
||||
PyErr_SetString(PyExc_ValueError, "Invalid MouseContext");
|
||||
return false;
|
||||
}
|
||||
if(action < 0 || action >= ob::MouseAction::NUM_MOUSE_ACTION) {
|
||||
PyErr_SetString(PyExc_ValueError, "Invalid MouseAction");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ob::openbox->bindings()->addButton(button, context,
|
||||
action, PythonMouseCallback, func)) {
|
||||
PyErr_SetString(PyExc_RuntimeError,"Unable to add binding.");
|
||||
return false;
|
||||
}
|
||||
Py_INCREF(func); // the func is never decreffed... XXX
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ebind(ob::EventAction::EA action, PyObject *func)
|
||||
{
|
||||
if(action < 0 || action >= ob::EventAction::NUM_EVENT_ACTION) {
|
||||
PyErr_SetString(PyExc_ValueError, "Invalid EventAction");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ob::openbox->bindings()->addEvent(action, PythonEventCallback, func)) {
|
||||
PyErr_SetString(PyExc_RuntimeError,"Unable to add binding.");
|
||||
return false;
|
||||
}
|
||||
Py_INCREF(func); // the func is never decreffed... XXX
|
||||
return true;
|
||||
}
|
||||
|
||||
bool kgrab(int screen, PyObject *func)
|
||||
{
|
||||
if (!ob::openbox->bindings()->grabKeyboard(screen,
|
||||
PythonKeyCallback, func)) {
|
||||
PyErr_SetString(PyExc_RuntimeError,"Unable to grab keybaord.");
|
||||
return false;
|
||||
}
|
||||
Py_INCREF(func); // the func is never decreffed... XXX
|
||||
return true;
|
||||
}
|
||||
|
||||
void kungrab()
|
||||
{
|
||||
ob::openbox->bindings()->ungrabKeyboard();
|
||||
}
|
||||
|
||||
bool mgrab(int screen)
|
||||
{
|
||||
if (!ob::openbox->bindings()->grabPointer(screen)) {
|
||||
PyErr_SetString(PyExc_RuntimeError,"Unable to grab pointer.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void mungrab()
|
||||
{
|
||||
ob::openbox->bindings()->ungrabPointer();
|
||||
}
|
||||
|
||||
bool kbind(PyObject *keylist, ob::KeyContext::KC context, PyObject *func)
|
||||
{
|
||||
if (!PyList_Check(keylist)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid keylist. Not a list.");
|
||||
return false;
|
||||
}
|
||||
if(context < 0 || context >= ob::KeyContext::NUM_KEY_CONTEXT) {
|
||||
PyErr_SetString(PyExc_ValueError, "Invalid KeyContext");
|
||||
return false;
|
||||
}
|
||||
|
||||
ob::Bindings::StringVect vectkeylist;
|
||||
for (int i = 0, end = PyList_Size(keylist); i < end; ++i) {
|
||||
PyObject *str = PyList_GetItem(keylist, i);
|
||||
if (!PyString_Check(str)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"Invalid keylist. It must contain only strings.");
|
||||
return false;
|
||||
}
|
||||
vectkeylist.push_back(PyString_AsString(str));
|
||||
}
|
||||
|
||||
(void)context; // XXX use this sometime!
|
||||
if (!ob::openbox->bindings()->addKey(vectkeylist, PythonKeyCallback, func)) {
|
||||
PyErr_SetString(PyExc_RuntimeError,"Unable to add binding.");
|
||||
return false;
|
||||
}
|
||||
Py_INCREF(func); // the func is never decreffed... XXX
|
||||
return true;
|
||||
}
|
||||
|
||||
%};
|
158
wrap/ob_client.i
158
wrap/ob_client.i
|
@ -1,158 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module ob_client
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "client.hh"
|
||||
%}
|
||||
|
||||
%include "otk_size.i"
|
||||
%include "otk_ustring.i"
|
||||
%include "std_string.i"
|
||||
|
||||
namespace ob {
|
||||
|
||||
%immutable Client::frame;
|
||||
|
||||
%ignore Client::event_mask;
|
||||
%ignore Client::no_propagate_mask;
|
||||
%ignore Client::ignore_unmaps;
|
||||
%ignore Client::Client(int, Window);
|
||||
%ignore Client::~Client();
|
||||
%ignore Client::icon(const otk::Size &) const;
|
||||
%ignore Client::pixmapIcon() const;
|
||||
%ignore Client::pixmapIconMask() const;
|
||||
%ignore Client::showhide();
|
||||
%ignore Client::focus();
|
||||
%ignore Client::unfocus() const;
|
||||
%ignore Client::validate() const;
|
||||
%ignore Client::installColormap(bool) const;
|
||||
%ignore Client::focusHandler(const XFocusChangeEvent &);
|
||||
%ignore Client::unfocusHandler(const XFocusChangeEvent &);
|
||||
%ignore Client::propertyHandler(const XPropertyEvent &);
|
||||
%ignore Client::clientMessageHandler(const XClientMessageEvent &);
|
||||
%ignore Client::configureRequestHandler(const XConfigureRequestEvent &);
|
||||
%ignore Client::unmapHandler(const XUnmapEvent &);
|
||||
%ignore Client::destroyHandler(const XDestroyWindowEvent &);
|
||||
%ignore Client::reparentHandler(const XReparentEvent &);
|
||||
%ignore Client::mapRequestHandler(const XMapRequestEvent &);
|
||||
%ignore Client::shapeHandler(const XShapeEvent &);
|
||||
|
||||
|
||||
%extend Client {
|
||||
void focus(bool unshade = false, bool raise = false) {
|
||||
Window root = otk::display->screenInfo(self->screen())->rootWindow();
|
||||
send_client_msg(root, otk::Property::atoms.openbox_active_window,
|
||||
self->window(), unshade ? 1 : 0, raise ? 1 : 0);
|
||||
}
|
||||
|
||||
bool __cmp__(const Client *o) { return self->window() != o->window(); }
|
||||
|
||||
void raiseWindow() {
|
||||
Window root = RootWindow(**otk::display, self->screen());
|
||||
send_client_msg(root, otk::Property::atoms.openbox_restack_window,
|
||||
self->window(), 0);
|
||||
}
|
||||
void lowerWindow() {
|
||||
Window root = RootWindow(**otk::display, self->screen());
|
||||
send_client_msg(root, otk::Property::atoms.openbox_restack_window,
|
||||
self->window(), 1);
|
||||
}
|
||||
|
||||
void setDesktop(unsigned int desktop) {
|
||||
Window root = RootWindow(**otk::display, self->screen());
|
||||
send_client_msg(root, otk::Property::atoms.net_wm_desktop,
|
||||
self->window(), desktop);
|
||||
}
|
||||
|
||||
void iconify(bool icon = true) {
|
||||
Window root = RootWindow(**otk::display, self->screen());
|
||||
send_client_msg(root, otk::Property::atoms.wm_change_state,
|
||||
self->window(), icon ? IconicState : NormalState);
|
||||
}
|
||||
|
||||
void close() {
|
||||
Window root = RootWindow(**otk::display, self->screen());
|
||||
send_client_msg(root, otk::Property::atoms.net_close_window,
|
||||
self->window(), 0);
|
||||
}
|
||||
|
||||
void shade(bool shade = true) {
|
||||
Window root = RootWindow(**otk::display, self->screen());
|
||||
send_client_msg(root, otk::Property::atoms.net_wm_state,
|
||||
self->window(),
|
||||
(shade ? otk::Property::atoms.net_wm_state_add :
|
||||
otk::Property::atoms.net_wm_state_remove),
|
||||
otk::Property::atoms.net_wm_state_shaded);
|
||||
}
|
||||
|
||||
void maximize(bool max = true) {
|
||||
Window root = RootWindow(**otk::display, self->screen());
|
||||
send_client_msg(root, otk::Property::atoms.net_wm_state,
|
||||
self->window(),
|
||||
(max ? otk::Property::atoms.net_wm_state_add :
|
||||
otk::Property::atoms.net_wm_state_remove),
|
||||
otk::Property::atoms.net_wm_state_maximized_horz,
|
||||
otk::Property::atoms.net_wm_state_maximized_vert);
|
||||
}
|
||||
|
||||
void maximizeHorizontal(bool max = true) {
|
||||
Window root = RootWindow(**otk::display, self->screen());
|
||||
send_client_msg(root, otk::Property::atoms.net_wm_state,
|
||||
self->window(),
|
||||
(max ? otk::Property::atoms.net_wm_state_add :
|
||||
otk::Property::atoms.net_wm_state_remove),
|
||||
otk::Property::atoms.net_wm_state_maximized_horz);
|
||||
}
|
||||
|
||||
void maximizeVertical(bool max = true) {
|
||||
Window root = RootWindow(**otk::display, self->screen());
|
||||
send_client_msg(root, otk::Property::atoms.net_wm_state,
|
||||
self->window(),
|
||||
(max ? otk::Property::atoms.net_wm_state_add :
|
||||
otk::Property::atoms.net_wm_state_remove),
|
||||
otk::Property::atoms.net_wm_state_maximized_vert);
|
||||
}
|
||||
|
||||
void setSkipTaskbar(bool skip = true) {
|
||||
Window root = RootWindow(**otk::display, self->screen());
|
||||
send_client_msg(root, otk::Property::atoms.net_wm_state,
|
||||
self->window(),
|
||||
(skip ? otk::Property::atoms.net_wm_state_add :
|
||||
otk::Property::atoms.net_wm_state_remove),
|
||||
otk::Property::atoms.net_wm_state_skip_taskbar);
|
||||
}
|
||||
|
||||
void setSkipPager(bool skip = true) {
|
||||
Window root = RootWindow(**otk::display, self->screen());
|
||||
send_client_msg(root, otk::Property::atoms.net_wm_state,
|
||||
self->window(),
|
||||
(skip ? otk::Property::atoms.net_wm_state_add :
|
||||
otk::Property::atoms.net_wm_state_remove),
|
||||
otk::Property::atoms.net_wm_state_skip_pager);
|
||||
}
|
||||
|
||||
void setAbove(bool above = true) {
|
||||
Window root = RootWindow(**otk::display, self->screen());
|
||||
send_client_msg(root, otk::Property::atoms.net_wm_state,
|
||||
self->window(),
|
||||
(above ? otk::Property::atoms.net_wm_state_add :
|
||||
otk::Property::atoms.net_wm_state_remove),
|
||||
otk::Property::atoms.net_wm_state_above);
|
||||
}
|
||||
|
||||
void setBelow(bool below = true) {
|
||||
Window root = RootWindow(**otk::display, self->screen());
|
||||
send_client_msg(root, otk::Property::atoms.net_wm_state,
|
||||
self->window(),
|
||||
(below ? otk::Property::atoms.net_wm_state_add :
|
||||
otk::Property::atoms.net_wm_state_remove),
|
||||
otk::Property::atoms.net_wm_state_below);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
%import "../otk/eventhandler.hh"
|
||||
%include "client.hh"
|
|
@ -1,39 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module ob_frame
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "frame.hh"
|
||||
%}
|
||||
|
||||
namespace ob {
|
||||
|
||||
%ignore FrameGeometry;
|
||||
|
||||
%ignore Frame::event_mask;
|
||||
%ignore Frame::Frame(Client*);
|
||||
%ignore Frame::~Frame();
|
||||
%ignore Frame::styleChanged(const otk::RenderStyle &);
|
||||
%ignore Frame::grabClient();
|
||||
%ignore Frame::releaseClient();
|
||||
%ignore Frame::adjustSize();
|
||||
%ignore Frame::adjustPosition();
|
||||
%ignore Frame::adjustShape();
|
||||
%ignore Frame::adjustState();
|
||||
%ignore Frame::adjustFocus();
|
||||
%ignore Frame::adjustTitle();
|
||||
%ignore Frame::adjustIcon();
|
||||
%ignore Frame::visible();
|
||||
%ignore Frame::show();
|
||||
%ignore Frame::hide();
|
||||
%ignore Frame::buttonPressHandler(const XButtonEvent &);
|
||||
%ignore Frame::buttonReleaseHandler(const XButtonEvent &);
|
||||
%ignore Frame::mouseContext(Window) const;
|
||||
%ignore Frame::allWindows() const;
|
||||
|
||||
}
|
||||
|
||||
%import "../otk/renderstyle.hh"
|
||||
%import "../otk/eventhandler.hh"
|
||||
%include "frame.hh"
|
|
@ -1,35 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module ob_openbox
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "openbox.hh"
|
||||
%}
|
||||
|
||||
%include "ob_screen.i"
|
||||
%include "ob_client.i"
|
||||
%include "std_string.i"
|
||||
|
||||
namespace ob {
|
||||
|
||||
%ignore Cursors;
|
||||
|
||||
%immutable openbox;
|
||||
|
||||
%ignore Openbox::Openbox(int, char **);
|
||||
%ignore Openbox::~Openbox();
|
||||
%ignore Openbox::actions() const;
|
||||
%ignore Openbox::bindings() const;
|
||||
%ignore Openbox::cursors() const;
|
||||
%ignore Openbox::eventLoop();
|
||||
%ignore Openbox::addClient(Window, Client*);
|
||||
%ignore Openbox::removeClient(Window);
|
||||
%ignore Openbox::setFocusedClient(Client*);
|
||||
%ignore Openbox::doRestart() const;
|
||||
%ignore Openbox::restartProgram() const;
|
||||
|
||||
}
|
||||
|
||||
%import "../otk/eventdispatcher.hh"
|
||||
%include "openbox.hh"
|
|
@ -1,28 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module ob_python
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "python.hh"
|
||||
%}
|
||||
|
||||
namespace ob {
|
||||
|
||||
%ignore MouseContext::NUM_MOUSE_CONTEXT;
|
||||
%ignore MouseAction::NUM_MOUSE_ACTION;
|
||||
%ignore KeyContext::NUM_KEY_CONTEXT;
|
||||
%ignore KeyAction::NUM_KEY_ACTION;
|
||||
%ignore EventAction::NUM_EVENT_ACTION;
|
||||
|
||||
%ignore python_init(char*);
|
||||
%ignore python_destroy();
|
||||
%ignore python_exec(const std::string&);
|
||||
|
||||
%ignore python_get_long(const char*, long*);
|
||||
%ignore python_get_string(const char*, otk::ustring*);
|
||||
%ignore python_get_stringlist(const char*, std::vector<otk::ustring>*);
|
||||
|
||||
}
|
||||
|
||||
%include "python.hh"
|
106
wrap/ob_screen.i
106
wrap/ob_screen.i
|
@ -1,106 +0,0 @@
|
|||
// -*- 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"
|
35
wrap/otk.i
35
wrap/otk.i
|
@ -1,35 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk
|
||||
|
||||
%import "eventhandler.hh"
|
||||
%import "eventdispatcher.hh"
|
||||
|
||||
%include "otk_strut.i"
|
||||
%include "otk_point.i"
|
||||
%include "otk_size.i"
|
||||
%include "otk_rect.i"
|
||||
%include "otk_rendercolor.i"
|
||||
%include "otk_rendertexture.i"
|
||||
%include "otk_font.i"
|
||||
%include "otk_ustring.i"
|
||||
%include "otk_renderstyle.i"
|
||||
%include "otk_widget.i"
|
||||
%include "otk_label.i"
|
||||
%include "otk_button.i"
|
||||
%include "otk_application.i"
|
||||
%include "otk_appwidget.i"
|
||||
%include "otk_property.i"
|
||||
%include "otk_timer.i"
|
||||
|
||||
// for Window etc
|
||||
%import "X11/X.h"
|
||||
|
||||
// globals
|
||||
%pythoncode %{
|
||||
atoms = cvar.Property_atoms;
|
||||
|
||||
def style(screen):
|
||||
return RenderStyle_style(screen)
|
||||
|
||||
%}
|
|
@ -1,13 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk_application
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "application.hh"
|
||||
%}
|
||||
|
||||
%include "otk_widget.i"
|
||||
|
||||
%import "../otk/eventdispatcher.hh"
|
||||
%include "application.hh"
|
|
@ -1,20 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk_appwidget
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "appwidget.hh"
|
||||
%}
|
||||
|
||||
%include "otk_widget.i"
|
||||
%include "otk_application.i"
|
||||
|
||||
namespace otk {
|
||||
|
||||
%ignore AppWidget::clientMessageHandler(const XClientMessageEvent &);
|
||||
|
||||
|
||||
}
|
||||
|
||||
%include "appwidget.hh"
|
|
@ -1,22 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk_button
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "button.hh"
|
||||
%}
|
||||
|
||||
%include "otk_widget.i"
|
||||
%include "otk_ustring.i"
|
||||
%include "otk_font.i"
|
||||
%include "otk_renderstyle.i"
|
||||
|
||||
namespace otk {
|
||||
|
||||
%ignore Button::clickHandler(unsigned int);
|
||||
%ignore Button::styleChanged(const RenderStyle &);
|
||||
|
||||
}
|
||||
|
||||
%include "button.hh"
|
|
@ -1,13 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk_rendertexture
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "font.hh"
|
||||
%}
|
||||
|
||||
%include "otk_ustring.i"
|
||||
%include "std_string.i"
|
||||
|
||||
%include "font.hh"
|
|
@ -1,21 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk_label
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "label.hh"
|
||||
%}
|
||||
|
||||
%include "otk_widget.i"
|
||||
%include "otk_ustring.i"
|
||||
%include "otk_font.i"
|
||||
%include "otk_renderstyle.i"
|
||||
|
||||
namespace otk {
|
||||
|
||||
%ignore Label::renderForeground(Surface &);
|
||||
|
||||
}
|
||||
|
||||
%include "label.hh"
|
|
@ -1,10 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk_point
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "point.hh"
|
||||
%}
|
||||
|
||||
%include "point.hh"
|
|
@ -1,170 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk_property
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "property.hh"
|
||||
%}
|
||||
|
||||
%include "otk_ustring.i"
|
||||
|
||||
%typemap(python,in) const otk::Property::StringVect & (otk::Property::StringVect temp) {
|
||||
if (PyList_Check($input)) {
|
||||
int s = PyList_Size($input);
|
||||
temp = otk::Property::StringVect(s);
|
||||
for (int i = 0; i < s; ++i) {
|
||||
PyObject *o = PyList_GetItem($input, i);
|
||||
if (PyString_Check(o)) {
|
||||
temp[i] = PyString_AsString(o);
|
||||
} else {
|
||||
SWIG_exception(SWIG_TypeError, "list of strings expected");
|
||||
}
|
||||
}
|
||||
$1 = &temp;
|
||||
} else {
|
||||
SWIG_exception(SWIG_TypeError, "list expected");
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(python,in) unsigned long value[] (unsigned long *temp) {
|
||||
if (PyList_Check($input)) {
|
||||
int s = PyList_Size($input);
|
||||
temp = new unsigned long[s];
|
||||
for (int i = 0; i < s; ++i) {
|
||||
PyObject *o = PyList_GetItem($input, i);
|
||||
if (PyInt_Check(o)) {
|
||||
temp[i] = PyInt_AsLong(o);
|
||||
} else if (PyLong_Check(o)) {
|
||||
temp[i] = PyLong_AsLong(o);
|
||||
} else {
|
||||
SWIG_exception(SWIG_TypeError, "list of numbers expected");
|
||||
}
|
||||
}
|
||||
$1 = temp;
|
||||
} else {
|
||||
SWIG_exception(SWIG_TypeError, "list expected");
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(python,freearg) unsigned long value[] {
|
||||
delete [] $1;
|
||||
}
|
||||
|
||||
%typemap(python,in,numinputs=0) otk::ustring *value (otk::ustring temp) {
|
||||
$1 = &temp;
|
||||
}
|
||||
|
||||
%typemap(python,argout) otk::ustring *value {
|
||||
PyObject *tuple;
|
||||
int s;
|
||||
if (PyTuple_Check($result)) {
|
||||
s = PyTuple_Size($result);
|
||||
_PyTuple_Resize(&$result, s + 1);
|
||||
tuple = $result;
|
||||
} else {
|
||||
tuple = PyTuple_New(2);
|
||||
PyTuple_SET_ITEM(tuple, 0, $result);
|
||||
Py_INCREF($result);
|
||||
s = 1;
|
||||
}
|
||||
|
||||
PyTuple_SET_ITEM(tuple, s, PyString_FromString($1->c_str()));
|
||||
$result = tuple;
|
||||
}
|
||||
|
||||
%typemap(python,in,numinputs=0) unsigned long *value (unsigned long temp) {
|
||||
$1 = &temp;
|
||||
}
|
||||
|
||||
%typemap(python,argout) unsigned long *value {
|
||||
PyObject *s = PyLong_FromLong(*$1);
|
||||
$result = s;
|
||||
}
|
||||
|
||||
%typemap(python,in,numinputs=0) unsigned long *nelements (unsigned long temp) {
|
||||
$1 = &temp;
|
||||
}
|
||||
|
||||
%typemap(python,in) unsigned long *nelements (unsigned long temp) {
|
||||
temp = (unsigned)PyLong_AsLong($input);
|
||||
$1 = &temp;
|
||||
}
|
||||
|
||||
%typemap(python,in,numinputs=0) unsigned long **value (unsigned long *temp) {
|
||||
$1 = &temp;
|
||||
}
|
||||
|
||||
%typemap(python,argout) (unsigned long *nelements, unsigned long **value) {
|
||||
PyObject *tuple;
|
||||
int s;
|
||||
if (PyTuple_Check($result)) {
|
||||
s = PyTuple_Size($result);
|
||||
_PyTuple_Resize(&$result, s + 2);
|
||||
tuple = $result;
|
||||
} else {
|
||||
tuple = PyTuple_New(3);
|
||||
PyTuple_SET_ITEM(tuple, 0, $result);
|
||||
Py_INCREF($result);
|
||||
s = 1;
|
||||
}
|
||||
|
||||
int sz = *$1;
|
||||
|
||||
PyTuple_SET_ITEM(tuple, s++, PyLong_FromLong(sz));
|
||||
|
||||
PyObject *r = PyList_New(sz);
|
||||
for (int i = 0; i < sz; ++i) {
|
||||
PyList_SET_ITEM(r, i, PyLong_FromLong((*$2)[i]));
|
||||
}
|
||||
PyTuple_SET_ITEM(tuple, s, r);
|
||||
$result = tuple;
|
||||
}
|
||||
|
||||
%typemap(python,in,numinputs=0) StringVect *strings (StringVect temp) {
|
||||
$1 = &temp;
|
||||
}
|
||||
|
||||
%typemap(python,argout) (unsigned long *nelements, StringVect *strings) {
|
||||
PyObject *tuple;
|
||||
int s;
|
||||
if (PyTuple_Check($result)) {
|
||||
s = PyTuple_Size($result);
|
||||
_PyTuple_Resize(&$result, s + 2);
|
||||
tuple = $result;
|
||||
} else {
|
||||
tuple = PyTuple_New(3);
|
||||
PyTuple_SET_ITEM(tuple, 0, $result);
|
||||
Py_INCREF($result);
|
||||
s = 1;
|
||||
}
|
||||
|
||||
int sz = *$1;
|
||||
|
||||
PyTuple_SET_ITEM(tuple, s++, PyLong_FromLong(sz));
|
||||
|
||||
PyObject *r = PyList_New(sz);
|
||||
for (int i = 0; i < sz; ++i) {
|
||||
PyList_SET_ITEM(r, i, PyString_FromString((*$2)[i].c_str()));
|
||||
}
|
||||
PyTuple_SET_ITEM(tuple, s, r);
|
||||
$result = tuple;
|
||||
}
|
||||
|
||||
namespace otk {
|
||||
|
||||
%immutable otk::Property::atoms;
|
||||
|
||||
%ignore Property::NUM_STRING_TYPE;
|
||||
%ignore Property::initialize();
|
||||
|
||||
%rename(getNum) Property::get(Window, Atom, Atom, unsigned long*);
|
||||
%rename(getNums) Property::get(Window, Atom, Atom, unsigned long*,
|
||||
unsigned long**);
|
||||
%rename(getString) Property::get(Window, Atom, StringType, ustring*);
|
||||
%rename(getStrings) Property::get(Window, Atom, StringType, unsigned long*,
|
||||
StringVect);
|
||||
|
||||
}
|
||||
|
||||
%include "property.hh"
|
|
@ -1,13 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk_rect
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "rect.hh"
|
||||
%}
|
||||
|
||||
%include "otk_point.i"
|
||||
%include "otk_size.i"
|
||||
|
||||
%include "rect.hh"
|
|
@ -1,17 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk_rendercolor
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "rendercolor.hh"
|
||||
%}
|
||||
|
||||
namespace otk {
|
||||
|
||||
%ignore RenderColor::initialize();
|
||||
%ignore RenderColor::destroy();
|
||||
|
||||
}
|
||||
|
||||
%include "rendercolor.hh"
|
|
@ -1,27 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk_renderstyle
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "renderstyle.hh"
|
||||
%}
|
||||
|
||||
%include "std_string.i"
|
||||
%include "otk_rendercolor.i"
|
||||
%include "otk_rendertexture.i"
|
||||
%include "otk_font.i"
|
||||
|
||||
namespace otk {
|
||||
|
||||
%ignore StyleNotify;
|
||||
|
||||
%ignore RenderStyle::initialize();
|
||||
%ignore RenderStyle::destroy();
|
||||
%ignore RenderStyle::registerNotify(int, StyleNotify*);
|
||||
%ignore RenderStyle::unregisterNotify(int, StyleNotify *);
|
||||
%ignore RenderStyle::~RenderStyle();
|
||||
|
||||
}
|
||||
|
||||
%include "renderstyle.hh"
|
|
@ -1,10 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk_rendertexture
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "rendertexture.hh"
|
||||
%}
|
||||
|
||||
%include "rendertexture.hh"
|
|
@ -1,10 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk_size
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "size.hh"
|
||||
%}
|
||||
|
||||
%include "size.hh"
|
|
@ -1,10 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk_strut
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "strut.hh"
|
||||
%}
|
||||
|
||||
%include "strut.hh"
|
|
@ -1,78 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk_timer
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "timer.hh"
|
||||
%}
|
||||
|
||||
%{
|
||||
struct PythonCallbackData {
|
||||
PyObject *pyfunc;
|
||||
void *data;
|
||||
};
|
||||
|
||||
/*
|
||||
Calls a python callback for the TimeoutHandler function type
|
||||
*/
|
||||
static void PythonCallback(PythonCallbackData *calldata) {
|
||||
PyObject *arglist, *result;
|
||||
|
||||
arglist = Py_BuildValue("(O)", calldata->data);
|
||||
|
||||
// call the callback
|
||||
result = PyEval_CallObject((PyObject*)calldata->pyfunc, arglist);
|
||||
if (!result || PyErr_Occurred()) {
|
||||
// an exception occured in the script, display it
|
||||
PyErr_Print();
|
||||
}
|
||||
|
||||
Py_XDECREF(result);
|
||||
Py_DECREF(arglist);
|
||||
}
|
||||
%}
|
||||
|
||||
// Grab a Python function object as a Python object.
|
||||
%typemap(python,in) PyObject *func {
|
||||
if (!PyCallable_Check($input)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Excepting a callable object.");
|
||||
return NULL;
|
||||
}
|
||||
$1 = $input;
|
||||
}
|
||||
|
||||
namespace otk {
|
||||
|
||||
%ignore Timer::Timer(long, TimeoutHandler, void*);
|
||||
%ignore Timer::operator delete(void*);
|
||||
%ignore Timer::initialize();
|
||||
%ignore Timer::destroy();
|
||||
%ignore Timer::dispatchTimers(bool);
|
||||
%ignore Timer::nearestTimeout(struct timeval&);
|
||||
|
||||
%extend Timer {
|
||||
Timer(long, PyObject*, PyObject*);
|
||||
|
||||
// if you don't call stop() before the object disappears, the timer will
|
||||
// keep firing forever
|
||||
void stop() {
|
||||
delete self;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
%{
|
||||
static otk::Timer *new_otk_Timer(long delay,
|
||||
PyObject *func, PyObject *data) {
|
||||
PythonCallbackData *d = new PythonCallbackData;
|
||||
d->pyfunc = func;
|
||||
d->data = data;
|
||||
return new otk::Timer(delay,
|
||||
(otk::Timer::TimeoutHandler)&PythonCallback, d);
|
||||
// the PythonCallbackData is leaked.. XXX
|
||||
}
|
||||
%}
|
||||
|
||||
%include "timer.hh"
|
|
@ -1,40 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk_rendertexture
|
||||
|
||||
%{
|
||||
#include "otk/ustring.hh"
|
||||
%}
|
||||
|
||||
namespace otk {
|
||||
class ustring;
|
||||
|
||||
/* Overloading check */
|
||||
|
||||
%typemap(typecheck) ustring = char *;
|
||||
%typemap(typecheck) const ustring & = char *;
|
||||
|
||||
%typemap(in) ustring {
|
||||
if (PyString_Check($input))
|
||||
$1 = otk::ustring(PyString_AsString($input));
|
||||
else
|
||||
SWIG_exception(SWIG_TypeError, "string expected");
|
||||
}
|
||||
|
||||
%typemap(in) const ustring & (otk::ustring temp) {
|
||||
if (PyString_Check($input)) {
|
||||
temp = otk::ustring(PyString_AsString($input));
|
||||
$1 = &temp;
|
||||
} else {
|
||||
SWIG_exception(SWIG_TypeError, "string expected");
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(out) ustring {
|
||||
$result = PyString_FromString($1.c_str());
|
||||
}
|
||||
|
||||
%typemap(out) const ustring & {
|
||||
$result = PyString_FromString($1->c_str());
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
|
||||
%module otk_widget
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "widget.hh"
|
||||
%}
|
||||
|
||||
%include "otk_rendercolor.i"
|
||||
|
||||
%typemap(python,out) const std::list<Widget*>& {
|
||||
std::list<Widget*> *v = $1;
|
||||
unsigned int s = v->size();
|
||||
PyObject *l = PyList_New(s);
|
||||
|
||||
std::list<Widget*>::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__Widget,0);
|
||||
PyList_SET_ITEM(l, i, pdata);
|
||||
}
|
||||
$result = l;
|
||||
}
|
||||
|
||||
namespace otk {
|
||||
|
||||
%ignore Widget::exposeHandler(const XExposeEvent &);
|
||||
%ignore Widget::configureHandler(const XConfigureEvent &);
|
||||
%ignore Widget::styleChanged(const RenderStyle &);
|
||||
|
||||
}
|
||||
|
||||
%import "../otk/eventhandler.hh"
|
||||
%import "../otk/renderstyle.hh"
|
||||
%include "widget.hh"
|
Loading…
Reference in a new issue