client = Openbox_findClient(openbox, data.window())
if not client: return
type = OBClient_type(client)
- # these types of windows dont get focus from window enter events
- if data.action() == EventEnterWindow:
- if (type == OBClient_Type_Dock or \
- type == OBClient_Type_Desktop):
- return
+ # !normal windows dont get focus from window enter events
+ if data.action() == EventEnterWindow and not OBClient_normal(client):
+ return
OBClient_focus(client)
def move(data):
client = Openbox_findClient(openbox, data.window())
if not client: return
- type = OBClient_type(client)
- # these types of windows dont get moved
- if type == OBClient_Type_Dock or \
- type == OBClient_Type_Desktop:
- return
+ # !normal windows dont get moved
+ if not OBClient_normal(client): return
dx = data.xroot() - data.pressx()
dy = data.yroot() - data.pressy()
client = Openbox_findClient(openbox, data.window())
if not client: return
- type = OBClient_type(client)
- # these types of windows dont get resized
- if type == OBClient_Type_Dock or \
- type == OBClient_Type_Desktop:
- return
+ # !normal windows dont get moved
+ if not OBClient_normal(client): return
px = data.pressx()
py = data.pressy()
}
+
+void OBClient::setStackLayer(int l)
+{
+ if (l == 0)
+ _above = _below = false; // normal
+ else if (l > 0) {
+ _above = true;
+ _below = false; // above
+ } else {
+ _above = false;
+ _below = true; // below
+ }
+ changeState();
+}
+
+
void OBClient::shade(bool shade)
{
if (shade == _shaded) return; // already done
//! Returns the type of the window, one of the OBClient::WindowType values
inline WindowType type() const { return _type; }
+ //! Returns if the window should be treated as a normal window.
+ /*!
+ Some windows (desktops, docks, splash screens) have special rules applied
+ to them in a number of places regarding focus or user interaction.
+ */
+ inline bool normal() const {
+ return ! (_type == Type_Desktop || _type == Type_Dock ||
+ _type == Type_Splash);
+ }
+
//! Returns the desktop on which the window resides
/*!
This value is a 0-based index.<br>
//! Request the client to close its window.
void close();
+ //! Sets the window's stacking layer
+ /*!
+ @param l An integer specifying the layer.<br>
+ '0' - the normal layer<br>
+ '> 0' - the 'above' layer<br>
+ '< 0' - the 'below' layer
+ */
+ void setStackLayer(int l);
+
//! Shades or unshades the client window
/*!
@param shade true if the window should be shaded; false if it should be
}
+static PyObject *_wrap_OBClient_normal(PyObject *self, PyObject *args) {
+ PyObject *resultobj;
+ ob::OBClient *arg1 = (ob::OBClient *) 0 ;
+ bool result;
+ PyObject * obj0 = 0 ;
+
+ if(!PyArg_ParseTuple(args,(char *)"O:OBClient_normal",&obj0)) goto fail;
+ if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ result = (bool)((ob::OBClient const *)arg1)->normal();
+
+ resultobj = PyInt_FromLong((long)result);
+ return resultobj;
+ fail:
+ return NULL;
+}
+
+
static PyObject *_wrap_OBClient_desktop(PyObject *self, PyObject *args) {
PyObject *resultobj;
ob::OBClient *arg1 = (ob::OBClient *) 0 ;
}
+static PyObject *_wrap_OBClient_setStackLayer(PyObject *self, PyObject *args) {
+ PyObject *resultobj;
+ ob::OBClient *arg1 = (ob::OBClient *) 0 ;
+ int arg2 ;
+ PyObject * obj0 = 0 ;
+
+ if(!PyArg_ParseTuple(args,(char *)"Oi:OBClient_setStackLayer",&obj0,&arg2)) goto fail;
+ if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ (arg1)->setStackLayer(arg2);
+
+ Py_INCREF(Py_None); resultobj = Py_None;
+ return resultobj;
+ fail:
+ return NULL;
+}
+
+
static PyObject *_wrap_OBClient_shade(PyObject *self, PyObject *args) {
PyObject *resultobj;
ob::OBClient *arg1 = (ob::OBClient *) 0 ;
{ (char *)"OBClient_screen", _wrap_OBClient_screen, METH_VARARGS },
{ (char *)"OBClient_window", _wrap_OBClient_window, METH_VARARGS },
{ (char *)"OBClient_type", _wrap_OBClient_type, METH_VARARGS },
+ { (char *)"OBClient_normal", _wrap_OBClient_normal, METH_VARARGS },
{ (char *)"OBClient_desktop", _wrap_OBClient_desktop, METH_VARARGS },
{ (char *)"OBClient_title", _wrap_OBClient_title, METH_VARARGS },
{ (char *)"OBClient_iconTitle", _wrap_OBClient_iconTitle, METH_VARARGS },
{ (char *)"OBClient_move", _wrap_OBClient_move, METH_VARARGS },
{ (char *)"OBClient_resize", _wrap_OBClient_resize, METH_VARARGS },
{ (char *)"OBClient_close", _wrap_OBClient_close, METH_VARARGS },
+ { (char *)"OBClient_setStackLayer", _wrap_OBClient_setStackLayer, METH_VARARGS },
{ (char *)"OBClient_shade", _wrap_OBClient_shade, METH_VARARGS },
{ (char *)"OBClient_focus", _wrap_OBClient_focus, METH_VARARGS },
{ (char *)"OBClient_unfocus", _wrap_OBClient_unfocus, METH_VARARGS },
setClientList();
Openbox::instance->bindings()->grabButtons(true, client);
+
+ // XXX: make this optional or more intelligent
+ client->focus();
}
// pass around focus if this window was focused XXX do this better!
if (Openbox::instance->focusedClient() == client) {
OBClient *newfocus = 0;
- if (!_stacking.empty())
- newfocus = _stacking.front();
- if (! (newfocus && newfocus->focus()))
+ ClientList::iterator it, end = _stacking.end();
+ for (it = _stacking.begin(); it != end; ++it)
+ if ((*it)->normal() && (*it)->focus()) {
+ newfocus = *it;
+ break;
+ }
+ if (!newfocus)
client->unfocus();
}