all repos — openbox @ 056ff3b50cddd39b6f45969c17611dc3bf396ae9

openbox fork - make it a bit more like ryudo

better focus passing around for now
Dana Jansens danakj@orodu.net
commit

056ff3b50cddd39b6f45969c17611dc3bf396ae9

parent

ee1130f8ecd9ddc94eca535fa129809d840b8219

5 files changed, 88 insertions(+), 18 deletions(-)

jump to
M scripts/builtins.pyscripts/builtins.py

@@ -12,11 +12,9 @@ """Focuses the window on which the event occured"""

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):

@@ -25,11 +23,8 @@ MouseMotion events"""

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()

@@ -41,11 +36,8 @@ MouseMotion events"""

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()
M src/client.ccsrc/client.cc

@@ -966,6 +966,22 @@ otk::OBProperty::Atom_Atom, netstate, num);

} + +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
M src/client.hhsrc/client.hh

@@ -352,6 +352,16 @@ inline Window window() const { return _window; }

//! 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 @@

//! 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
M src/openbox_wrap.ccsrc/openbox_wrap.cc

@@ -1853,6 +1853,23 @@ return NULL;

} +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 @@ return NULL;

} +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 @@ { (char *)"OBClient_ignore_unmaps_get", _wrap_OBClient_ignore_unmaps_get, METH_VARARGS },

{ (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 @@ { (char *)"OBClient_strut", _wrap_OBClient_strut, 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 },
M src/screen.ccsrc/screen.cc

@@ -518,6 +518,9 @@ // update the root properties

setClientList(); Openbox::instance->bindings()->grabButtons(true, client); + + // XXX: make this optional or more intelligent + client->focus(); }

@@ -533,9 +536,13 @@

// 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(); }