new python callbacks data, infrastructure. going to rework bindings code. cvs wont work for shit now. but thats life.
This commit is contained in:
parent
b1739374a6
commit
345d957e1e
14 changed files with 1798 additions and 493 deletions
|
@ -11,6 +11,10 @@
|
|||
extern "C" {
|
||||
#include <X11/keysym.h>
|
||||
|
||||
#ifdef XKB
|
||||
#include <X11/XKBlib.h>
|
||||
#endif // XKB
|
||||
|
||||
#ifdef SHAPE
|
||||
#include <X11/extensions/shape.h>
|
||||
#endif // SHAPE
|
||||
|
@ -44,6 +48,8 @@ namespace otk {
|
|||
|
||||
|
||||
Display *OBDisplay::display = (Display*) 0;
|
||||
bool OBDisplay::_xkb = false;
|
||||
int OBDisplay::_xkb_event_basep = 0;
|
||||
bool OBDisplay::_shape = false;
|
||||
int OBDisplay::_shape_event_basep = 0;
|
||||
bool OBDisplay::_xinerama = false;
|
||||
|
@ -107,6 +113,11 @@ line argument.\n\n"));
|
|||
}
|
||||
|
||||
// find the availability of X extensions we like to use
|
||||
#ifdef XKB
|
||||
_xkb = XkbQueryExtension(display, &junk, &_xkb_event_basep, &junk, NULL,
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
#ifdef SHAPE
|
||||
_shape = XShapeQueryExtension(display, &_shape_event_basep, &junk);
|
||||
#endif
|
||||
|
|
|
@ -29,14 +29,19 @@ public:
|
|||
typedef std::vector<ScreenInfo> ScreenInfoList;
|
||||
|
||||
private:
|
||||
//! Does the display have the Shape extention?
|
||||
//! Does the display have the XKB extension?
|
||||
static bool _xkb;
|
||||
//! Base for events for the XKB extension
|
||||
static int _xkb_event_basep;
|
||||
|
||||
//! Does the display have the Shape extension?
|
||||
static bool _shape;
|
||||
//! Base for events for the Shape extention
|
||||
//! Base for events for the Shape extension
|
||||
static int _shape_event_basep;
|
||||
|
||||
//! Does the display have the Xinerama extention?
|
||||
//! Does the display have the Xinerama extension?
|
||||
static bool _xinerama;
|
||||
//! Base for events for the Xinerama extention
|
||||
//! Base for events for the Xinerama extension
|
||||
static int _xinerama_event_basep;
|
||||
|
||||
//! A list of all possible combinations of keyboard lock masks
|
||||
|
@ -99,11 +104,16 @@ public:
|
|||
//! Find a ScreenInfo based on a root window
|
||||
static const ScreenInfo* findScreen(Window root);
|
||||
|
||||
//! Returns if the display has the shape extention available
|
||||
//! Returns if the display has the xkb extension available
|
||||
inline static bool xkb() { return _xkb; }
|
||||
//! Returns the xkb extension's event base
|
||||
inline static int xkbEventBase() { return _xkb_event_basep; }
|
||||
|
||||
//! Returns if the display has the shape extension available
|
||||
inline static bool shape() { return _shape; }
|
||||
//! Returns the shape extension's event base
|
||||
inline static int shapeEventBase() { return _shape_event_basep; }
|
||||
//! Returns if the display has the xinerama extention available
|
||||
//! Returns if the display has the xinerama extension available
|
||||
inline static bool xinerama() { return _xinerama; }
|
||||
|
||||
inline static unsigned int numLockMask() { return _numLockMask; }
|
||||
|
|
|
@ -91,6 +91,10 @@ void OtkEventHandler::handle(const XEvent &e)
|
|||
if (e.type == otk::OBDisplay::shapeEventBase())
|
||||
return shapeHandler((*(XShapeEvent*)&e));
|
||||
#endif // SHAPE
|
||||
#ifdef XKB
|
||||
if (e.type == otk::OBDisplay::xkbEventBase())
|
||||
return xkbHandler((*(XkbEvent*)&e));
|
||||
#endif // XKB
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,11 @@ extern "C" {
|
|||
#ifdef SHAPE
|
||||
#include <X11/extensions/shape.h>
|
||||
#endif // SHAPE
|
||||
|
||||
#ifdef XKB
|
||||
#include <X11/XKBlib.h>
|
||||
#endif // XKB
|
||||
|
||||
}
|
||||
|
||||
namespace otk {
|
||||
|
@ -120,10 +125,15 @@ public:
|
|||
virtual void clientMessageHandler(const XClientMessageEvent &);
|
||||
|
||||
#if defined(SHAPE) || defined(DOXYGEN_IGNORE)
|
||||
//! Called when a shape extention event fires
|
||||
//! Called when a shape extension event fires
|
||||
virtual void shapeHandler(const XShapeEvent &) {}
|
||||
#endif // SHAPE
|
||||
|
||||
#if defined(XKB) || defined(DOXYGEN_IGNORE)
|
||||
//! Called when an xkb extension event fires
|
||||
virtual void xkbHandler(const XkbEvent &) {}
|
||||
#endif // XKB
|
||||
|
||||
virtual ~OtkEventHandler();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -5481,6 +5481,34 @@ static PyObject *_wrap_OBDisplay_findScreen(PyObject *self, PyObject *args) {
|
|||
}
|
||||
|
||||
|
||||
static PyObject *_wrap_OBDisplay_xkb(PyObject *self, PyObject *args) {
|
||||
PyObject *resultobj;
|
||||
bool result;
|
||||
|
||||
if(!PyArg_ParseTuple(args,(char *)":OBDisplay_xkb")) goto fail;
|
||||
result = (bool)otk::OBDisplay::xkb();
|
||||
|
||||
resultobj = PyInt_FromLong((long)result);
|
||||
return resultobj;
|
||||
fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static PyObject *_wrap_OBDisplay_xkbEventBase(PyObject *self, PyObject *args) {
|
||||
PyObject *resultobj;
|
||||
int result;
|
||||
|
||||
if(!PyArg_ParseTuple(args,(char *)":OBDisplay_xkbEventBase")) goto fail;
|
||||
result = (int)otk::OBDisplay::xkbEventBase();
|
||||
|
||||
resultobj = PyInt_FromLong((long)result);
|
||||
return resultobj;
|
||||
fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static PyObject *_wrap_OBDisplay_shape(PyObject *self, PyObject *args) {
|
||||
PyObject *resultobj;
|
||||
bool result;
|
||||
|
@ -12960,6 +12988,8 @@ static PyMethodDef SwigMethods[] = {
|
|||
{ (char *)"OBDisplay_gcCache", _wrap_OBDisplay_gcCache, METH_VARARGS },
|
||||
{ (char *)"OBDisplay_screenInfo", _wrap_OBDisplay_screenInfo, METH_VARARGS },
|
||||
{ (char *)"OBDisplay_findScreen", _wrap_OBDisplay_findScreen, METH_VARARGS },
|
||||
{ (char *)"OBDisplay_xkb", _wrap_OBDisplay_xkb, METH_VARARGS },
|
||||
{ (char *)"OBDisplay_xkbEventBase", _wrap_OBDisplay_xkbEventBase, METH_VARARGS },
|
||||
{ (char *)"OBDisplay_shape", _wrap_OBDisplay_shape, METH_VARARGS },
|
||||
{ (char *)"OBDisplay_shapeEventBase", _wrap_OBDisplay_shapeEventBase, METH_VARARGS },
|
||||
{ (char *)"OBDisplay_xinerama", _wrap_OBDisplay_xinerama, METH_VARARGS },
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "widget.hh"
|
||||
#include "openbox.hh"
|
||||
#include "client.hh"
|
||||
#include "screen.hh"
|
||||
#include "python.hh"
|
||||
#include "bindings.hh"
|
||||
#include "otk/display.hh"
|
||||
|
@ -74,12 +75,15 @@ void OBActions::buttonPressHandler(const XButtonEvent &e)
|
|||
// kill off the Button1Mask etc, only want the modifiers
|
||||
unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask |
|
||||
Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask);
|
||||
ButtonData *data =
|
||||
new_button_data(otk::OBDisplay::findScreen(e.root)->screen(),
|
||||
e.window, e.time, state, e.button, w->mcontext(),
|
||||
int screen;
|
||||
OBClient *c = Openbox::instance->findClient(e.window);
|
||||
if (c)
|
||||
screen = c->screen();
|
||||
else
|
||||
screen = otk::OBDisplay::findScreen(e.root)->screen();
|
||||
ButtonData data(screen, c, e.time, state, e.button, w->mcontext(),
|
||||
MousePress);
|
||||
Openbox::instance->bindings()->fireButton(data);
|
||||
Py_DECREF((PyObject*)data);
|
||||
Openbox::instance->bindings()->fireButton(&data);
|
||||
|
||||
if (_button) return; // won't count toward CLICK events
|
||||
|
||||
|
@ -114,11 +118,15 @@ void OBActions::buttonReleaseHandler(const XButtonEvent &e)
|
|||
// kill off the Button1Mask etc, only want the modifiers
|
||||
unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask |
|
||||
Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask);
|
||||
ButtonData *data =
|
||||
new_button_data(otk::OBDisplay::findScreen(e.root)->screen(),
|
||||
e.window, e.time, state, e.button, w->mcontext(),
|
||||
int screen;
|
||||
OBClient *c = Openbox::instance->findClient(e.window);
|
||||
if (c)
|
||||
screen = c->screen();
|
||||
else
|
||||
screen = otk::OBDisplay::findScreen(e.root)->screen();
|
||||
ButtonData data(screen, c, e.time, state, e.button, w->mcontext(),
|
||||
MouseClick);
|
||||
Openbox::instance->bindings()->fireButton(data);
|
||||
Openbox::instance->bindings()->fireButton(&data);
|
||||
|
||||
|
||||
// XXX: dont load this every time!!@*
|
||||
|
@ -130,8 +138,8 @@ void OBActions::buttonReleaseHandler(const XButtonEvent &e)
|
|||
_release.win == e.window && _release.button == e.button) {
|
||||
|
||||
// run the DOUBLECLICK python hook
|
||||
data->action = MouseDoubleClick;
|
||||
Openbox::instance->bindings()->fireButton(data);
|
||||
data.action = MouseDoubleClick;
|
||||
Openbox::instance->bindings()->fireButton(&data);
|
||||
|
||||
// reset so you cant triple click for 2 doubleclicks
|
||||
_release.win = 0;
|
||||
|
@ -143,8 +151,6 @@ void OBActions::buttonReleaseHandler(const XButtonEvent &e)
|
|||
_release.button = e.button;
|
||||
_release.time = e.time;
|
||||
}
|
||||
|
||||
Py_DECREF((PyObject*)data);
|
||||
}
|
||||
|
||||
|
||||
|
@ -153,11 +159,14 @@ void OBActions::enterHandler(const XCrossingEvent &e)
|
|||
OtkEventHandler::enterHandler(e);
|
||||
|
||||
// run the ENTER python hook
|
||||
EventData *data =
|
||||
new_event_data(otk::OBDisplay::findScreen(e.root)->screen(),
|
||||
e.window, EventEnterWindow, e.state);
|
||||
Openbox::instance->bindings()->fireEvent(data);
|
||||
Py_DECREF((PyObject*)data);
|
||||
int screen;
|
||||
OBClient *c = Openbox::instance->findClient(e.window);
|
||||
if (c)
|
||||
screen = c->screen();
|
||||
else
|
||||
screen = otk::OBDisplay::findScreen(e.root)->screen();
|
||||
EventData data(screen, c, EventEnterWindow, e.state);
|
||||
Openbox::instance->bindings()->fireEvent(&data);
|
||||
}
|
||||
|
||||
|
||||
|
@ -166,11 +175,14 @@ void OBActions::leaveHandler(const XCrossingEvent &e)
|
|||
OtkEventHandler::leaveHandler(e);
|
||||
|
||||
// run the LEAVE python hook
|
||||
EventData *data =
|
||||
new_event_data(otk::OBDisplay::findScreen(e.root)->screen(),
|
||||
e.window, EventLeaveWindow, e.state);
|
||||
Openbox::instance->bindings()->fireEvent(data);
|
||||
Py_DECREF((PyObject*)data);
|
||||
int screen;
|
||||
OBClient *c = Openbox::instance->findClient(e.window);
|
||||
if (c)
|
||||
screen = c->screen();
|
||||
else
|
||||
screen = otk::OBDisplay::findScreen(e.root)->screen();
|
||||
EventData data(screen, c, EventLeaveWindow, e.state);
|
||||
Openbox::instance->bindings()->fireEvent(&data);
|
||||
}
|
||||
|
||||
|
||||
|
@ -216,13 +228,15 @@ void OBActions::motionHandler(const XMotionEvent &e)
|
|||
unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask |
|
||||
Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask);
|
||||
unsigned int button = _posqueue[0]->button;
|
||||
MotionData *data =
|
||||
new_motion_data(otk::OBDisplay::findScreen(e.root)->screen(),
|
||||
e.window, e.time, state, button, w->mcontext(),
|
||||
MouseMotion, x_root, y_root, _posqueue[0]->pos,
|
||||
_posqueue[0]->clientarea);
|
||||
Openbox::instance->bindings()->fireButton((ButtonData*)data);
|
||||
Py_DECREF((PyObject*)data);
|
||||
int screen;
|
||||
OBClient *c = Openbox::instance->findClient(e.window);
|
||||
if (c)
|
||||
screen = c->screen();
|
||||
else
|
||||
screen = otk::OBDisplay::findScreen(e.root)->screen();
|
||||
MotionData data(screen, c, e.time, state, button, w->mcontext(), MouseMotion,
|
||||
x_root, y_root, _posqueue[0]->pos, _posqueue[0]->clientarea);
|
||||
Openbox::instance->bindings()->fireButton((ButtonData*)&data);
|
||||
}
|
||||
|
||||
void OBActions::mapRequestHandler(const XMapRequestEvent &e)
|
||||
|
@ -243,4 +257,28 @@ void OBActions::destroyHandler(const XDestroyWindowEvent &e)
|
|||
// do this in OBScreen::unmanageWindow
|
||||
}
|
||||
|
||||
#ifdef XKB
|
||||
void OBActions::xkbHandler(const XkbEvent &e)
|
||||
{
|
||||
Window w;
|
||||
int screen;
|
||||
|
||||
OtkEventHandler::xkbHandler(e);
|
||||
|
||||
switch (((XkbAnyEvent*)&e)->xkb_type) {
|
||||
case XkbBellNotify:
|
||||
w = ((XkbBellNotifyEvent*)&e)->window;
|
||||
OBClient *c = Openbox::instance->findClient(w);
|
||||
if (c)
|
||||
screen = c->screen();
|
||||
else
|
||||
screen = Openbox::instance->focusedScreen()->number();
|
||||
EventData data(screen, c, EventBell, 0);
|
||||
Openbox::instance->bindings()->fireEvent(&data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif // XKB
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,10 @@ public:
|
|||
virtual void unmapHandler(const XUnmapEvent &e);
|
||||
virtual void destroyHandler(const XDestroyWindowEvent &e);
|
||||
|
||||
#ifdef XKB
|
||||
virtual void xkbHandler(const XkbEvent &e);
|
||||
#endif // XKB
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -387,14 +387,11 @@ void OBBindings::fireKey(int screen, unsigned int modifiers, unsigned int key,
|
|||
grabKeys(true);
|
||||
otk::OBDisplay::ungrab();
|
||||
} else {
|
||||
Window win = None;
|
||||
OBClient *c = Openbox::instance->focusedClient();
|
||||
if (c) win = c->window();
|
||||
KeyData *data = new_key_data(screen, win, time, modifiers, key);
|
||||
KeyData data(screen, c, time, modifiers, key);
|
||||
CallbackList::iterator it, end = p->callbacks.end();
|
||||
for (it = p->callbacks.begin(); it != end; ++it)
|
||||
python_callback(*it, (PyObject*)data);
|
||||
Py_XDECREF((PyObject*)data);
|
||||
python_callback(*it, &data);
|
||||
resetChains(this);
|
||||
}
|
||||
break;
|
||||
|
@ -540,7 +537,11 @@ bool OBBindings::addEvent(EventAction action, PyObject *callback)
|
|||
if (action < 0 || action >= NUM_EVENTS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef XKB
|
||||
if (action == EventBell && _eventlist[action].empty())
|
||||
XkbSelectEvents(otk::OBDisplay::display, XkbUseCoreKbd,
|
||||
XkbBellNotifyMask, XkbBellNotifyMask);
|
||||
#endif // XKB
|
||||
_eventlist[action].push_back(callback);
|
||||
Py_INCREF(callback);
|
||||
return true;
|
||||
|
@ -558,6 +559,11 @@ bool OBBindings::removeEvent(EventAction action, PyObject *callback)
|
|||
if (it != _eventlist[action].end()) {
|
||||
Py_XDECREF(*it);
|
||||
_eventlist[action].erase(it);
|
||||
#ifdef XKB
|
||||
if (action == EventBell && _eventlist[action].empty())
|
||||
XkbSelectEvents(otk::OBDisplay::display, XkbUseCoreKbd,
|
||||
XkbBellNotifyMask, 0);
|
||||
#endif // XKB
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -577,7 +583,7 @@ void OBBindings::fireEvent(EventData *data)
|
|||
{
|
||||
CallbackList::iterator c_it, c_end = _eventlist[data->action].end();
|
||||
for (c_it = _eventlist[data->action].begin(); c_it != c_end; ++c_it)
|
||||
python_callback(*c_it, (PyObject*)data);
|
||||
python_callback(*c_it, data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -288,7 +288,8 @@ void Openbox::showHelp()
|
|||
printf(_("Compile time options:\n\
|
||||
Debugging: %s\n\
|
||||
Shape: %s\n\
|
||||
Xinerama: %s\n"),
|
||||
Xinerama: %s\n\
|
||||
Xkb: %s\n"),
|
||||
#ifdef DEBUG
|
||||
_("yes"),
|
||||
#else // !DEBUG
|
||||
|
@ -302,10 +303,16 @@ void Openbox::showHelp()
|
|||
#endif // SHAPE
|
||||
|
||||
#ifdef XINERAMA
|
||||
_("yes")
|
||||
_("yes"),
|
||||
#else // !XINERAMA
|
||||
_("no")
|
||||
_("no"),
|
||||
#endif // XINERAMA
|
||||
|
||||
#ifdef XKB
|
||||
_("yes")
|
||||
#else // !XKB
|
||||
_("no")
|
||||
#endif // XKB
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -368,11 +375,8 @@ void Openbox::setFocusedClient(OBClient *c)
|
|||
}
|
||||
|
||||
// call the python Focus callbacks
|
||||
EventData *data = new_event_data(_focused_screen->number(),
|
||||
c ? c->window() : 0,
|
||||
EventFocus, 0);
|
||||
Openbox::instance->bindings()->fireEvent(data);
|
||||
Py_XDECREF((PyObject*)data);
|
||||
EventData data(_focused_screen->number(), c, EventFocus, 0);
|
||||
Openbox::instance->bindings()->fireEvent(&data);
|
||||
}
|
||||
|
||||
void Openbox::execute(int screen, const std::string &bin)
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include "client.hh"
|
||||
#include "bindings.hh"
|
||||
#include "actions.hh"
|
||||
#include "python.hh"
|
||||
#include "otk/display.hh"
|
||||
%}
|
||||
|
||||
%include "stl.i"
|
||||
|
@ -23,6 +25,91 @@
|
|||
ob::Openbox *Openbox_instance() { return ob::Openbox::instance; }
|
||||
%};
|
||||
|
||||
%{
|
||||
namespace ob {
|
||||
void python_callback(PyObject *func, MotionData *data)
|
||||
{
|
||||
PyObject *arglist;
|
||||
PyObject *result;
|
||||
|
||||
arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data,
|
||||
SWIGTYPE_p_ob__MotionData,
|
||||
0));
|
||||
|
||||
// call the callback
|
||||
result = PyEval_CallObject(func, arglist);
|
||||
if (!result || PyErr_Occurred()) {
|
||||
// an exception occured in the script, display it
|
||||
PyErr_Print();
|
||||
}
|
||||
|
||||
Py_XDECREF(result);
|
||||
Py_DECREF(arglist);
|
||||
}
|
||||
|
||||
void python_callback(PyObject *func, ButtonData *data)
|
||||
{
|
||||
PyObject *arglist;
|
||||
PyObject *result;
|
||||
|
||||
arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data,
|
||||
SWIGTYPE_p_ob__ButtonData,
|
||||
0));
|
||||
|
||||
// call the callback
|
||||
result = PyEval_CallObject(func, arglist);
|
||||
if (!result || PyErr_Occurred()) {
|
||||
// an exception occured in the script, display it
|
||||
PyErr_Print();
|
||||
}
|
||||
|
||||
Py_XDECREF(result);
|
||||
Py_DECREF(arglist);
|
||||
}
|
||||
|
||||
void python_callback(PyObject *func, EventData *data)
|
||||
{
|
||||
PyObject *arglist;
|
||||
PyObject *result;
|
||||
|
||||
arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data,
|
||||
SWIGTYPE_p_ob__EventData,
|
||||
0));
|
||||
|
||||
// call the callback
|
||||
result = PyEval_CallObject(func, arglist);
|
||||
if (!result || PyErr_Occurred()) {
|
||||
// an exception occured in the script, display it
|
||||
PyErr_Print();
|
||||
}
|
||||
|
||||
Py_XDECREF(result);
|
||||
Py_DECREF(arglist);
|
||||
}
|
||||
|
||||
void python_callback(PyObject *func, KeyData *data)
|
||||
{
|
||||
PyObject *arglist;
|
||||
PyObject *result;
|
||||
|
||||
arglist = Py_BuildValue("(O)", SWIG_NewPointerObj((void *) data,
|
||||
SWIGTYPE_p_ob__KeyData,
|
||||
0));
|
||||
|
||||
// call the callback
|
||||
result = PyEval_CallObject(func, arglist);
|
||||
if (!result || PyErr_Occurred()) {
|
||||
// an exception occured in the script, display it
|
||||
PyErr_Print();
|
||||
}
|
||||
|
||||
Py_XDECREF(result);
|
||||
Py_DECREF(arglist);
|
||||
}
|
||||
|
||||
}
|
||||
%}
|
||||
|
||||
%ignore ob::OBScreen::clients;
|
||||
%{
|
||||
#include <iterator>
|
||||
|
|
1465
src/openbox_wrap.cc
1465
src/openbox_wrap.cc
File diff suppressed because it is too large
Load diff
368
src/python.cc
368
src/python.cc
|
@ -18,350 +18,6 @@ namespace ob {
|
|||
|
||||
static PyObject *obdict = NULL;
|
||||
|
||||
// ************************************************************* //
|
||||
// Define some custom types which are passed to python callbacks //
|
||||
// ************************************************************* //
|
||||
|
||||
static void dealloc(PyObject *self)
|
||||
{
|
||||
PyObject_Del(self);
|
||||
}
|
||||
|
||||
PyObject *MotionData_screen(MotionData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":screen")) return NULL;
|
||||
return PyLong_FromLong(self->screen);
|
||||
}
|
||||
|
||||
PyObject *MotionData_window(MotionData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":window")) return NULL;
|
||||
return PyLong_FromLong(self->window);
|
||||
}
|
||||
|
||||
PyObject *MotionData_context(MotionData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":context")) return NULL;
|
||||
return PyLong_FromLong((int)self->context);
|
||||
}
|
||||
|
||||
PyObject *MotionData_action(MotionData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":action")) return NULL;
|
||||
return PyLong_FromLong((int)self->action);
|
||||
}
|
||||
|
||||
PyObject *MotionData_modifiers(MotionData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":modifiers")) return NULL;
|
||||
return PyLong_FromUnsignedLong(self->state);
|
||||
}
|
||||
|
||||
PyObject *MotionData_button(MotionData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":button")) return NULL;
|
||||
int b = 0;
|
||||
switch (self->button) {
|
||||
case Button5: b++;
|
||||
case Button4: b++;
|
||||
case Button3: b++;
|
||||
case Button2: b++;
|
||||
case Button1: b++;
|
||||
default: ;
|
||||
}
|
||||
return PyLong_FromLong(b);
|
||||
}
|
||||
|
||||
PyObject *MotionData_xroot(MotionData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":xroot")) return NULL;
|
||||
return PyLong_FromLong(self->xroot);
|
||||
}
|
||||
|
||||
PyObject *MotionData_yroot(MotionData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":yroot")) return NULL;
|
||||
return PyLong_FromLong(self->yroot);
|
||||
}
|
||||
|
||||
PyObject *MotionData_pressx(MotionData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":pressx")) return NULL;
|
||||
return PyLong_FromLong(self->pressx);
|
||||
}
|
||||
|
||||
PyObject *MotionData_pressy(MotionData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":pressy")) return NULL;
|
||||
return PyLong_FromLong(self->pressy);
|
||||
}
|
||||
|
||||
|
||||
PyObject *MotionData_press_clientx(MotionData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":press_clientx")) return NULL;
|
||||
return PyLong_FromLong(self->press_clientx);
|
||||
}
|
||||
|
||||
PyObject *MotionData_press_clienty(MotionData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":press_clienty")) return NULL;
|
||||
return PyLong_FromLong(self->press_clienty);
|
||||
}
|
||||
|
||||
PyObject *MotionData_press_clientwidth(MotionData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":press_clientwidth")) return NULL;
|
||||
return PyLong_FromLong(self->press_clientwidth);
|
||||
}
|
||||
|
||||
PyObject *MotionData_press_clientheight(MotionData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":press_clientheight")) return NULL;
|
||||
return PyLong_FromLong(self->press_clientheight);
|
||||
}
|
||||
|
||||
PyObject *MotionData_time(MotionData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":time")) return NULL;
|
||||
return PyLong_FromLong(self->time);
|
||||
}
|
||||
|
||||
static PyMethodDef MotionData_methods[] = {
|
||||
{"action", (PyCFunction)MotionData_action, METH_VARARGS,
|
||||
"Return the action being executed."},
|
||||
{"screen", (PyCFunction)MotionData_screen, METH_VARARGS,
|
||||
"Return the number of the screen the event is on."},
|
||||
{"window", (PyCFunction)MotionData_window, METH_VARARGS,
|
||||
"Return the client window id."},
|
||||
{"context", (PyCFunction)MotionData_context, METH_VARARGS,
|
||||
"Return the context that the action is occuring in."},
|
||||
{"modifiers", (PyCFunction)MotionData_modifiers, METH_VARARGS,
|
||||
"Return the modifier keys state."},
|
||||
{"button", (PyCFunction)MotionData_button, METH_VARARGS,
|
||||
"Return the number of the pressed button (1-5)."},
|
||||
{"xroot", (PyCFunction)MotionData_xroot, METH_VARARGS,
|
||||
"Return the X-position of the mouse cursor on the root window."},
|
||||
{"yroot", (PyCFunction)MotionData_yroot, METH_VARARGS,
|
||||
"Return the Y-position of the mouse cursor on the root window."},
|
||||
{"pressx", (PyCFunction)MotionData_pressx, METH_VARARGS,
|
||||
"Return the X-position of the mouse cursor at the start of the drag."},
|
||||
{"pressy", (PyCFunction)MotionData_pressy, METH_VARARGS,
|
||||
"Return the Y-position of the mouse cursor at the start of the drag."},
|
||||
{"press_clientx", (PyCFunction)MotionData_press_clientx, METH_VARARGS,
|
||||
"Return the X-position of the client at the start of the drag."},
|
||||
{"press_clienty", (PyCFunction)MotionData_press_clienty, METH_VARARGS,
|
||||
"Return the Y-position of the client at the start of the drag."},
|
||||
{"press_clientwidth", (PyCFunction)MotionData_press_clientwidth,
|
||||
METH_VARARGS,
|
||||
"Return the width of the client at the start of the drag."},
|
||||
{"press_clientheight", (PyCFunction)MotionData_press_clientheight,
|
||||
METH_VARARGS,
|
||||
"Return the height of the client at the start of the drag."},
|
||||
{"time", (PyCFunction)MotionData_time, METH_VARARGS,
|
||||
"Return the time at which the event occured."},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
static PyMethodDef ButtonData_methods[] = {
|
||||
{"action", (PyCFunction)MotionData_action, METH_VARARGS,
|
||||
"Return the action being executed."},
|
||||
{"context", (PyCFunction)MotionData_context, METH_VARARGS,
|
||||
"Return the context that the action is occuring in."},
|
||||
{"screen", (PyCFunction)MotionData_screen, METH_VARARGS,
|
||||
"Return the number of the screen the event is on."},
|
||||
{"window", (PyCFunction)MotionData_window, METH_VARARGS,
|
||||
"Return the client window id."},
|
||||
{"modifiers", (PyCFunction)MotionData_modifiers, METH_VARARGS,
|
||||
"Return the modifier keys state."},
|
||||
{"button", (PyCFunction)MotionData_button, METH_VARARGS,
|
||||
"Return the number of the pressed button (1-5)."},
|
||||
{"time", (PyCFunction)MotionData_time, METH_VARARGS,
|
||||
"Return the time at which the event occured."},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
PyObject *EventData_action(EventData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":action")) return NULL;
|
||||
return PyLong_FromLong((int)self->action);
|
||||
}
|
||||
|
||||
PyObject *EventData_modifiers(EventData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":modifiers")) return NULL;
|
||||
return PyLong_FromUnsignedLong(self->state);
|
||||
}
|
||||
|
||||
static PyMethodDef EventData_methods[] = {
|
||||
{"screen", (PyCFunction)MotionData_screen, METH_VARARGS,
|
||||
"Return the number of the screen the event is on."},
|
||||
{"window", (PyCFunction)MotionData_window, METH_VARARGS,
|
||||
"Return the client window id."},
|
||||
{"action", (PyCFunction)EventData_action, METH_VARARGS,
|
||||
"Return the action being executed."},
|
||||
{"modifiers", (PyCFunction)EventData_modifiers, METH_VARARGS,
|
||||
"Return the modifier keys state."},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
PyObject *KeyData_key(KeyData *self, PyObject *args)
|
||||
{
|
||||
if(!PyArg_ParseTuple(args,":key")) return NULL;
|
||||
return PyString_FromString(
|
||||
XKeysymToString(XKeycodeToKeysym(otk::OBDisplay::display, self->key, 0)));
|
||||
|
||||
}
|
||||
|
||||
static PyMethodDef KeyData_methods[] = {
|
||||
{"screen", (PyCFunction)MotionData_screen, METH_VARARGS,
|
||||
"Return the number of the screen the event is on."},
|
||||
{"window", (PyCFunction)MotionData_window, METH_VARARGS,
|
||||
"Return the client window id."},
|
||||
{"modifiers", (PyCFunction)MotionData_modifiers, METH_VARARGS,
|
||||
"Return the modifier keys state."},
|
||||
{"key", (PyCFunction)KeyData_key, METH_VARARGS,
|
||||
"Return the name of the pressed key."},
|
||||
{"time", (PyCFunction)MotionData_time, METH_VARARGS,
|
||||
"Return the time at which the event occured."},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
static PyObject *MotionDataGetAttr(PyObject *obj, char *name)
|
||||
{
|
||||
return Py_FindMethod(MotionData_methods, obj, name);
|
||||
}
|
||||
|
||||
static PyObject *ButtonDataGetAttr(PyObject *obj, char *name)
|
||||
{
|
||||
return Py_FindMethod(ButtonData_methods, obj, name);
|
||||
}
|
||||
|
||||
static PyObject *EventDataGetAttr(PyObject *obj, char *name)
|
||||
{
|
||||
return Py_FindMethod(EventData_methods, obj, name);
|
||||
}
|
||||
|
||||
static PyObject *KeyDataGetAttr(PyObject *obj, char *name)
|
||||
{
|
||||
return Py_FindMethod(KeyData_methods, obj, name);
|
||||
}
|
||||
|
||||
static PyTypeObject MotionData_Type = {
|
||||
PyObject_HEAD_INIT(NULL)
|
||||
0,
|
||||
"MotionData",
|
||||
sizeof(MotionData),
|
||||
0,
|
||||
dealloc,
|
||||
0,
|
||||
(getattrfunc)MotionDataGetAttr,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
static PyTypeObject ButtonData_Type = {
|
||||
PyObject_HEAD_INIT(NULL)
|
||||
0,
|
||||
"ButtonData",
|
||||
sizeof(ButtonData),
|
||||
0,
|
||||
dealloc,
|
||||
0,
|
||||
(getattrfunc)ButtonDataGetAttr,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
static PyTypeObject EventData_Type = {
|
||||
PyObject_HEAD_INIT(NULL)
|
||||
0,
|
||||
"EventData",
|
||||
sizeof(EventData),
|
||||
0,
|
||||
dealloc,
|
||||
0,
|
||||
(getattrfunc)EventDataGetAttr,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
static PyTypeObject KeyData_Type = {
|
||||
PyObject_HEAD_INIT(NULL)
|
||||
0,
|
||||
"KeyData",
|
||||
sizeof(KeyData),
|
||||
0,
|
||||
dealloc,
|
||||
0,
|
||||
(getattrfunc)KeyDataGetAttr,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
MotionData *new_motion_data(int screen, Window window, Time time,
|
||||
unsigned int state, unsigned int button,
|
||||
MouseContext context, MouseAction action,
|
||||
int xroot, int yroot, const otk::Point &initpos,
|
||||
const otk::Rect &initarea)
|
||||
{
|
||||
MotionData *data = PyObject_New(MotionData, &MotionData_Type);
|
||||
data->screen = screen;
|
||||
data->window = window;
|
||||
data->time = time;
|
||||
data->state = state;
|
||||
data->button = button;
|
||||
data->context= context;
|
||||
data->action = action;
|
||||
data->xroot = xroot;
|
||||
data->yroot = yroot;
|
||||
data->pressx = initpos.x();
|
||||
data->pressy = initpos.y();
|
||||
data->press_clientx = initarea.x();
|
||||
data->press_clienty = initarea.y();
|
||||
data->press_clientwidth = initarea.width();
|
||||
data->press_clientheight = initarea.height();
|
||||
return data;
|
||||
}
|
||||
|
||||
ButtonData *new_button_data(int screen, Window window, Time time,
|
||||
unsigned int state, unsigned int button,
|
||||
MouseContext context, MouseAction action)
|
||||
{
|
||||
ButtonData *data = PyObject_New(ButtonData, &ButtonData_Type);
|
||||
data->screen = screen;
|
||||
data->window = window;
|
||||
data->time = time;
|
||||
data->state = state;
|
||||
data->button = button;
|
||||
data->context= context;
|
||||
data->action = action;
|
||||
return data;
|
||||
}
|
||||
|
||||
EventData *new_event_data(int screen, Window window, EventAction action,
|
||||
unsigned int state)
|
||||
{
|
||||
EventData *data = PyObject_New(EventData, &EventData_Type);
|
||||
data->screen = screen;
|
||||
data->window = window;
|
||||
data->action = action;
|
||||
data->state = state;
|
||||
return data;
|
||||
}
|
||||
|
||||
KeyData *new_key_data(int screen, Window window, Time time, unsigned int state,
|
||||
unsigned int key)
|
||||
{
|
||||
KeyData *data = PyObject_New(KeyData, &KeyData_Type);
|
||||
data->screen = screen;
|
||||
data->window = window;
|
||||
data->time = time;
|
||||
data->state = state;
|
||||
data->key = key;
|
||||
return data;
|
||||
}
|
||||
|
||||
// **************** //
|
||||
// End custom types //
|
||||
// **************** //
|
||||
|
||||
void python_init(char *argv0)
|
||||
{
|
||||
Py_SetProgramName(argv0);
|
||||
|
@ -375,16 +31,12 @@ void python_init(char *argv0)
|
|||
/* XXX
|
||||
sys.path.append('stuff')
|
||||
install the .py wrappers, and include their path with this, then import em
|
||||
and ~/.openbox/python/ !!
|
||||
*/
|
||||
|
||||
// set up access to the python global variables
|
||||
PyObject *obmodule = PyImport_AddModule("__main__");
|
||||
obdict = PyModule_GetDict(obmodule);
|
||||
|
||||
// set up the custom types
|
||||
MotionData_Type.ob_type = &PyType_Type;
|
||||
ButtonData_Type.ob_type = &PyType_Type;
|
||||
KeyData_Type.ob_type = &PyType_Type;
|
||||
}
|
||||
|
||||
void python_destroy()
|
||||
|
@ -404,24 +56,6 @@ bool python_exec(const std::string &path)
|
|||
return true;
|
||||
}
|
||||
|
||||
void python_callback(PyObject *func, PyObject *data)
|
||||
{
|
||||
PyObject *arglist;
|
||||
PyObject *result;
|
||||
|
||||
arglist = Py_BuildValue("(O)", data);
|
||||
|
||||
// call the callback
|
||||
result = PyEval_CallObject(func, arglist);
|
||||
if (!result || PyErr_Occurred()) {
|
||||
// an exception occured in the script, display it
|
||||
PyErr_Print();
|
||||
}
|
||||
|
||||
Py_XDECREF(result);
|
||||
Py_DECREF(arglist);
|
||||
}
|
||||
|
||||
bool python_get_long(const char *name, long *value)
|
||||
{
|
||||
PyObject *val = PyDict_GetItemString(obdict, const_cast<char*>(name));
|
||||
|
|
120
src/python.hh
120
src/python.hh
|
@ -9,6 +9,7 @@
|
|||
#include "otk/point.hh"
|
||||
#include "otk/rect.hh"
|
||||
#include "otk/property.hh"
|
||||
#include "otk/display.hh"
|
||||
|
||||
extern "C" {
|
||||
#include <X11/Xlib.h>
|
||||
|
@ -20,6 +21,8 @@ extern "C" {
|
|||
|
||||
namespace ob {
|
||||
|
||||
class OBClient;
|
||||
|
||||
enum MouseContext {
|
||||
MC_Frame,
|
||||
MC_Titlebar,
|
||||
|
@ -58,16 +61,15 @@ enum EventAction {
|
|||
EventStartup,
|
||||
EventShutdown,
|
||||
EventFocus,
|
||||
EventBell,
|
||||
NUM_EVENTS
|
||||
};
|
||||
|
||||
#ifndef SWIG
|
||||
|
||||
// *** MotionData can be (and is) cast ButtonData!! (in actions.cc) *** //
|
||||
typedef struct {
|
||||
PyObject_HEAD;
|
||||
class MotionData {
|
||||
public:
|
||||
int screen;
|
||||
Window window;
|
||||
OBClient *client;
|
||||
Time time;
|
||||
unsigned int state;
|
||||
unsigned int button;
|
||||
|
@ -81,60 +83,106 @@ typedef struct {
|
|||
int press_clienty;
|
||||
int press_clientwidth;
|
||||
int press_clientheight;
|
||||
} MotionData;
|
||||
|
||||
MotionData(int screen, OBClient *client, Time time, unsigned int state,
|
||||
unsigned int button, MouseContext context, MouseAction action,
|
||||
int xroot, int yroot, const otk::Point &initpos,
|
||||
const otk::Rect &initarea) {
|
||||
this->screen = screen;
|
||||
this->client = client;
|
||||
this->time = time;
|
||||
this->state = state;
|
||||
this->button = button;
|
||||
this->context= context;
|
||||
this->action = action;
|
||||
this->xroot = xroot;
|
||||
this->yroot = yroot;
|
||||
this->pressx = initpos.x();
|
||||
this->pressy = initpos.y();
|
||||
this->press_clientx = initarea.x();
|
||||
this->press_clienty = initarea.y();
|
||||
this->press_clientwidth = initarea.width();
|
||||
this->press_clientheight = initarea.height();
|
||||
}
|
||||
};
|
||||
|
||||
// *** MotionData can be (and is) cast ButtonData!! (in actions.cc) *** //
|
||||
typedef struct {
|
||||
PyObject_HEAD;
|
||||
class ButtonData {
|
||||
public:
|
||||
int screen;
|
||||
Window window;
|
||||
OBClient *client;
|
||||
Time time;
|
||||
unsigned int state;
|
||||
unsigned int button;
|
||||
MouseContext context;
|
||||
MouseAction action;
|
||||
} ButtonData;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD;
|
||||
ButtonData(int screen, OBClient *client, Time time, unsigned int state,
|
||||
unsigned int button, MouseContext context, MouseAction action) {
|
||||
this->screen = screen;
|
||||
this->client = client;
|
||||
this->time = time;
|
||||
this->state = state;
|
||||
this->button = button;
|
||||
this->context= context;
|
||||
this->action = action;
|
||||
}
|
||||
};
|
||||
|
||||
class EventData {
|
||||
public:
|
||||
int screen;
|
||||
Window window;
|
||||
OBClient *client;
|
||||
unsigned int state;
|
||||
EventAction action;
|
||||
} EventData;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD;
|
||||
EventData(int screen, OBClient *client, EventAction action,
|
||||
unsigned int state) {
|
||||
this->screen = screen;
|
||||
this->client = client;
|
||||
this->action = action;
|
||||
this->state = state;
|
||||
}
|
||||
};
|
||||
|
||||
class KeyData {
|
||||
public:
|
||||
int screen;
|
||||
Window window;
|
||||
OBClient *client;
|
||||
Time time;
|
||||
unsigned int state;
|
||||
unsigned int key;
|
||||
} KeyData;
|
||||
std::string key;
|
||||
|
||||
KeyData(int screen, OBClient *client, Time time, unsigned int state,
|
||||
unsigned int key) {
|
||||
this->screen = screen;
|
||||
this->client = client;
|
||||
this->time = time;
|
||||
this->state = state;
|
||||
this->key = XKeysymToString(XKeycodeToKeysym(otk::OBDisplay::display,
|
||||
key, 0));
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef SWIG
|
||||
|
||||
void python_init(char *argv0);
|
||||
void python_destroy();
|
||||
bool python_exec(const std::string &path);
|
||||
|
||||
MotionData *new_motion_data(int screen, Window window, Time time,
|
||||
unsigned int state, unsigned int button,
|
||||
MouseContext context, MouseAction action,
|
||||
int xroot, int yroot, const otk::Point &initpos,
|
||||
const otk::Rect &initarea);
|
||||
ButtonData *new_button_data(int screen, Window window, Time time,
|
||||
unsigned int state, unsigned int button,
|
||||
MouseContext context, MouseAction action);
|
||||
EventData *new_event_data(int screen, Window window, EventAction action,
|
||||
unsigned int state);
|
||||
KeyData *new_key_data(int screen, Window window, Time time, unsigned int state,
|
||||
unsigned int key);
|
||||
|
||||
void python_callback(PyObject *func, PyObject *data);
|
||||
|
||||
bool python_get_long(const char *name, long *value);
|
||||
bool python_get_string(const char *name, std::string *value);
|
||||
bool python_get_stringlist(const char *name, std::vector<std::string> *value);
|
||||
#endif
|
||||
|
||||
/***********************************************
|
||||
* These are found in openbox.i, not python.cc *
|
||||
***********************************************/
|
||||
void python_callback(PyObject *func, MotionData *data);
|
||||
void python_callback(PyObject *func, ButtonData *data);
|
||||
void python_callback(PyObject *func, EventData *data);
|
||||
void python_callback(PyObject *func, KeyData *data);
|
||||
|
||||
#endif // SWIG
|
||||
|
||||
PyObject *mbind(const std::string &button, ob::MouseContext context,
|
||||
ob::MouseAction action, PyObject *func);
|
||||
|
@ -148,7 +196,7 @@ void set_reset_key(const std::string &key);
|
|||
PyObject *send_client_msg(Window target, int type, Window about,
|
||||
long data, long data1 = 0, long data2 = 0,
|
||||
long data3 = 0, long data4 = 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // __python_hh
|
||||
|
|
|
@ -140,9 +140,8 @@ OBScreen::OBScreen(int screen)
|
|||
Openbox::instance->registerHandler(_info->rootWindow(), this);
|
||||
|
||||
// call the python Startup callbacks
|
||||
EventData *data = new_event_data(_number, 0, EventShutdown, 0);
|
||||
Openbox::instance->bindings()->fireEvent(data);
|
||||
Py_XDECREF((PyObject*)data);
|
||||
EventData data(_number, 0, EventShutdown, 0);
|
||||
Openbox::instance->bindings()->fireEvent(&data);
|
||||
}
|
||||
|
||||
|
||||
|
@ -157,9 +156,8 @@ OBScreen::~OBScreen()
|
|||
unmanageWindow(clients.front());
|
||||
|
||||
// call the python Shutdown callbacks
|
||||
EventData *data = new_event_data(_number, 0, EventShutdown, 0);
|
||||
Openbox::instance->bindings()->fireEvent(data);
|
||||
Py_XDECREF((PyObject*)data);
|
||||
EventData data(_number, 0, EventShutdown, 0);
|
||||
Openbox::instance->bindings()->fireEvent(&data);
|
||||
|
||||
XDestroyWindow(otk::OBDisplay::display, _focuswindow);
|
||||
XDestroyWindow(otk::OBDisplay::display, _supportwindow);
|
||||
|
@ -497,9 +495,8 @@ void OBScreen::manageWindow(Window window)
|
|||
client->positionRequested())) {
|
||||
// position the window intelligenty .. hopefully :)
|
||||
// call the python PLACEWINDOW binding
|
||||
EventData *data = new_event_data(_number, window, EventPlaceWindow, 0);
|
||||
Openbox::instance->bindings()->fireEvent(data);
|
||||
Py_DECREF((PyObject*)data);
|
||||
EventData data(_number, client, EventPlaceWindow, 0);
|
||||
Openbox::instance->bindings()->fireEvent(&data);
|
||||
}
|
||||
|
||||
// create the decoration frame for the client window
|
||||
|
@ -542,9 +539,8 @@ void OBScreen::manageWindow(Window window)
|
|||
Openbox::instance->bindings()->grabButtons(true, client);
|
||||
|
||||
// call the python NEWWINDOW binding
|
||||
EventData *data = new_event_data(_number, window, EventNewWindow, 0);
|
||||
Openbox::instance->bindings()->fireEvent(data);
|
||||
Py_DECREF((PyObject*)data);
|
||||
EventData data(_number, client, EventNewWindow, 0);
|
||||
Openbox::instance->bindings()->fireEvent(&data);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Managed window 0x%lx\n", window);
|
||||
|
@ -557,10 +553,8 @@ void OBScreen::unmanageWindow(OBClient *client)
|
|||
OBFrame *frame = client->frame;
|
||||
|
||||
// call the python CLOSEWINDOW binding
|
||||
EventData *data = new_event_data(_number, client->window(),
|
||||
EventCloseWindow, 0);
|
||||
Openbox::instance->bindings()->fireEvent(data);
|
||||
Py_DECREF((PyObject*)data);
|
||||
EventData data(_number, client, EventCloseWindow, 0);
|
||||
Openbox::instance->bindings()->fireEvent(&data);
|
||||
|
||||
Openbox::instance->bindings()->grabButtons(false, client);
|
||||
|
||||
|
|
Loading…
Reference in a new issue