}
+const ScreenInfo* OBDisplay::findScreen(Window root)
+{
+ ScreenInfoList::iterator it, end = _screenInfoList.end();
+ for (it = _screenInfoList.begin(); it != end; ++it)
+ if (it->rootWindow() == root)
+ return &(*it);
+ return 0;
+}
+
+
void OBDisplay::grab()
{
if (_grab_count == 0)
*/
static const ScreenInfo* screenInfo(int snum);
+ static const ScreenInfo* findScreen(Window root);
+
//! Returns if the display has the shape extention available
inline static bool shape() { return _shape; }
//! Returns the shape extension's event base
}
+static PyObject *_wrap_OBDisplay_findScreen(PyObject *self, PyObject *args) {
+ PyObject *resultobj;
+ Window arg1 ;
+ otk::ScreenInfo *result;
+ Window *argp1 ;
+ PyObject * obj0 = 0 ;
+
+ if(!PyArg_ParseTuple(args,(char *)"O:OBDisplay_findScreen",&obj0)) goto fail;
+ if ((SWIG_ConvertPtr(obj0,(void **) &argp1, SWIGTYPE_p_Window,SWIG_POINTER_EXCEPTION) == -1)) SWIG_fail;
+ arg1 = *argp1;
+ result = (otk::ScreenInfo *)otk::OBDisplay::findScreen(arg1);
+
+ resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_otk__ScreenInfo, 0);
+ return resultobj;
+ fail:
+ return NULL;
+}
+
+
static PyObject *_wrap_OBDisplay_shape(PyObject *self, PyObject *args) {
PyObject *resultobj;
bool result;
{ (char *)"OBDisplay_destroy", _wrap_OBDisplay_destroy, METH_VARARGS },
{ (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_shape", _wrap_OBDisplay_shape, METH_VARARGS },
{ (char *)"OBDisplay_shapeEventBase", _wrap_OBDisplay_shapeEventBase, METH_VARARGS },
{ (char *)"OBDisplay_xinerama", _wrap_OBDisplay_xinerama, METH_VARARGS },
client = Openbox_findClient(openbox, data.window())
if not client: return
OBClient_shade(client, 0)
+
+def next_desktop(data):
+ screen = Openbox_screen(openbox, data.screen())
+ d = OBScreen_desktop(screen)
+ n = OBScreen_numDesktops(screen)
+ if (d == (n-1)):
+ d = 0
+ else:
+ d = d + 1
+ OBScreen_changeDesktop(screen, d)
+
+def prev_desktop(data):
+ screen = Openbox_screen(openbox, data.screen())
+ d = OBScreen_desktop(screen)
+ n = OBScreen_numDesktops(screen)
+ if (d > 0):
+ d = d - 1
+ else:
+ d = n - 1
+ OBScreen_changeDesktop(screen, d)
#########################################
### Convenience functions for scripts ###
// 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(e.window, e.time, state, e.button,
- w->mcontext(), MousePress);
+ ButtonData *data =
+ new_button_data(otk::OBDisplay::findScreen(e.root)->screen(),
+ e.window, e.time, state, e.button, w->mcontext(),
+ MousePress);
Openbox::instance->bindings()->fireButton(data);
Py_DECREF((PyObject*)data);
// 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(e.window, e.time, state, e.button,
- w->mcontext(), MouseClick);
+ ButtonData *data =
+ new_button_data(otk::OBDisplay::findScreen(e.root)->screen(),
+ e.window, e.time, state, e.button, w->mcontext(),
+ MouseClick);
Openbox::instance->bindings()->fireButton(data);
OtkEventHandler::enterHandler(e);
// run the ENTER python hook
- EventData *data = new_event_data(e.window, EventEnterWindow, e.state);
+ 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);
}
OtkEventHandler::leaveHandler(e);
// run the LEAVE python hook
- EventData *data = new_event_data(e.window, EventLeaveWindow, e.state);
+ 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);
}
// kill off the Button1Mask etc, only want the modifiers
unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask |
Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask);
- Openbox::instance->bindings()->fireKey(state, e.keycode, e.time);
+ Openbox::instance->bindings()->
+ fireKey(otk::OBDisplay::findScreen(e.root)->screen(),
+ state, e.keycode, e.time);
}
unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask |
Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask);
unsigned int button = _posqueue[0]->button;
- MotionData *data = new_motion_data(e.window, e.time, state, button,
- w->mcontext(), MouseMotion,
- x_root, y_root, _posqueue[0]->pos,
- _posqueue[0]->clientarea);
+ 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);
}
}
-void OBBindings::fireKey(unsigned int modifiers, unsigned int key, Time time)
+void OBBindings::fireKey(int screen, unsigned int modifiers, unsigned int key,
+ Time time)
{
if (key == _resetkey.key && modifiers == _resetkey.modifiers) {
resetChains(this);
Window win = None;
OBClient *c = Openbox::instance->focusedClient();
if (c) win = c->window();
- KeyData *data = new_key_data(win, time, modifiers, key);
+ KeyData *data = new_key_data(screen, win, time, modifiers, key);
CallbackList::iterator it, end = p->callbacks.end();
for (it = p->callbacks.begin(); it != end; ++it)
python_callback(*it, (PyObject*)data);
//! Removes all key bindings
void removeAllKeys();
- void fireKey(unsigned int modifiers,unsigned int key, Time time);
+ void fireKey(int screen, unsigned int modifiers,unsigned int key, Time time);
void setResetKey(const std::string &key);
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;
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 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,
}
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,
}
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,
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(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 *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;
return data;
}
-ButtonData *new_button_data(Window window, Time time, unsigned int state,
- unsigned int button, MouseContext context,
- MouseAction action)
+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;
return data;
}
-EventData *new_event_data(Window window, EventAction action,
+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(Window window, Time time, unsigned int state,
- unsigned int key)
+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;
// *** MotionData can be (and is) cast ButtonData!! (in actions.cc) *** //
typedef struct {
PyObject_HEAD;
+ int screen;
Window window;
Time time;
unsigned int state;
// *** MotionData can be (and is) cast ButtonData!! (in actions.cc) *** //
typedef struct {
PyObject_HEAD;
+ int screen;
Window window;
Time time;
unsigned int state;
typedef struct {
PyObject_HEAD;
+ int screen;
Window window;
unsigned int state;
EventAction action;
typedef struct {
PyObject_HEAD;
+ int screen;
Window window;
Time time;
unsigned int state;
void python_destroy();
bool python_exec(const std::string &path);
-MotionData *new_motion_data(Window window, Time time, unsigned int state,
- unsigned int button, MouseContext context,
- MouseAction action, int xroot, int yroot,
- const otk::Point &initpos,
+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(Window window, Time time, unsigned int state,
- unsigned int button, MouseContext context,
- MouseAction action);
-EventData *new_event_data(Window window, EventAction action,
- unsigned int state);
-KeyData *new_key_data(Window window, Time time, unsigned int state,
+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);
}
// call the python NEWWINDOW binding
- EventData *data = new_event_data(window, EventNewWindow, 0);
+ EventData *data = new_event_data(_number, window, EventNewWindow, 0);
Openbox::instance->bindings()->fireEvent(data);
Py_DECREF((PyObject*)data);
OBFrame *frame = client->frame;
// call the python CLOSEWINDOW binding
- EventData *data = new_event_data(client->window(), EventCloseWindow, 0);
+ EventData *data = new_event_data(_number, client->window(),
+ EventCloseWindow, 0);
Openbox::instance->bindings()->fireEvent(data);
Py_DECREF((PyObject*)data);