summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-01-04 08:41:42 +0000
committerDana Jansens <danakj@orodu.net>2003-01-04 08:41:42 +0000
commit056ff3b50cddd39b6f45969c17611dc3bf396ae9 (patch)
treef91ec562c11d9a4ae0a41f963b82ae1c37300df8 /src
parentee1130f8ecd9ddc94eca535fa129809d840b8219 (diff)
better focus passing around for now
Diffstat (limited to 'src')
-rw-r--r--src/client.cc16
-rw-r--r--src/client.hh19
-rw-r--r--src/openbox_wrap.cc36
-rw-r--r--src/screen.cc13
4 files changed, 81 insertions, 3 deletions
diff --git a/src/client.cc b/src/client.cc
index a2106d86..381305f7 100644
--- a/src/client.cc
+++ b/src/client.cc
@@ -966,6 +966,22 @@ void OBClient::changeState()
}
+
+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
diff --git a/src/client.hh b/src/client.hh
index f782a355..b64878ee 100644
--- a/src/client.hh
+++ b/src/client.hh
@@ -352,6 +352,16 @@ public:
//! 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>
@@ -458,6 +468,15 @@ public:
//! 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
diff --git a/src/openbox_wrap.cc b/src/openbox_wrap.cc
index c3d014d6..a60d48e0 100644
--- a/src/openbox_wrap.cc
+++ b/src/openbox_wrap.cc
@@ -1853,6 +1853,23 @@ static PyObject *_wrap_OBClient_type(PyObject *self, PyObject *args) {
}
+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 ;
@@ -2311,6 +2328,23 @@ static PyObject *_wrap_OBClient_close(PyObject *self, PyObject *args) {
}
+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 ;
@@ -2701,6 +2735,7 @@ static PyMethodDef SwigMethods[] = {
{ (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 },
@@ -2726,6 +2761,7 @@ static PyMethodDef SwigMethods[] = {
{ (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 },
diff --git a/src/screen.cc b/src/screen.cc
index bebc82d1..d9067aa0 100644
--- a/src/screen.cc
+++ b/src/screen.cc
@@ -518,6 +518,9 @@ void OBScreen::manageWindow(Window window)
setClientList();
Openbox::instance->bindings()->grabButtons(true, client);
+
+ // XXX: make this optional or more intelligent
+ client->focus();
}
@@ -533,9 +536,13 @@ void OBScreen::unmanageWindow(OBClient *client)
// 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();
}