focus works
Dana Jansens danakj@orodu.net
4 files changed,
33 insertions(+),
6 deletions(-)
M
scripts/clicks.py
→
scripts/clicks.py
@@ -33,6 +33,7 @@ def def_click_root(action, win, type, modifiers, button, time):
if type == Type_Root: if button == Button1: print "nothing probly.." + OBClient_unfocus(Openbox_focusedClient(openbox)) elif button == Button2: print "workspace menu" elif button == Button3:
M
src/client.cc
→
src/client.cc
@@ -866,10 +866,19 @@
bool OBClient::focus() { - if (!_can_focus) return false; + if (!_can_focus || _focused) return false; XSetInputFocus(otk::OBDisplay::display, _window, RevertToNone, CurrentTime); return true; +} + + +void OBClient::unfocus() +{ + if (!_focused) return; + + assert(Openbox::instance->focusedClient() == this); + Openbox::instance->setFocusedClient(0); }@@ -887,11 +896,8 @@ {
frame->unfocus(); _focused = false; - if (Openbox::instance->focusedClient() == this) { - printf("UNFOCUSING\n"); + if (Openbox::instance->focusedClient() == this) Openbox::instance->setFocusedClient(0); - } else - printf("UNFOCUSED ALREADY COULDNT UNFOCUS\n"); }
M
src/client.hh
→
src/client.hh
@@ -436,6 +436,9 @@ void close();
//! Attempt to focus the client window bool focus(); + + //! Remove focus from the client window + void unfocus(); virtual void focusHandler(const XFocusChangeEvent &e); virtual void unfocusHandler(const XFocusChangeEvent &e);
M
src/openbox_wrap.cc
→
src/openbox_wrap.cc
@@ -1,6 +1,6 @@
/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.17u-20021222-0248 + * Version 1.3.17u-20021226-0459 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make@@ -2260,6 +2260,22 @@ return NULL;
} +static PyObject *_wrap_OBClient_unfocus(PyObject *self, PyObject *args) { + PyObject *resultobj; + ob::OBClient *arg1 = (ob::OBClient *) 0 ; + PyObject * obj0 = 0 ; + + if(!PyArg_ParseTuple(args,(char *)"O:OBClient_unfocus",&obj0)) goto fail; + if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__OBClient,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; + (arg1)->unfocus(); + + Py_INCREF(Py_None); resultobj = Py_None; + return resultobj; + fail: + return NULL; +} + + static PyObject *_wrap_OBClient_focusHandler(PyObject *self, PyObject *args) { PyObject *resultobj; ob::OBClient *arg1 = (ob::OBClient *) 0 ;@@ -2580,6 +2596,7 @@ { (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_focus", _wrap_OBClient_focus, METH_VARARGS }, + { (char *)"OBClient_unfocus", _wrap_OBClient_unfocus, METH_VARARGS }, { (char *)"OBClient_focusHandler", _wrap_OBClient_focusHandler, METH_VARARGS }, { (char *)"OBClient_unfocusHandler", _wrap_OBClient_unfocusHandler, METH_VARARGS }, { (char *)"OBClient_propertyHandler", _wrap_OBClient_propertyHandler, METH_VARARGS },