]> Dogcows Code - chaz/openbox/commitdiff
focus works
authorDana Jansens <danakj@orodu.net>
Thu, 26 Dec 2002 18:15:23 +0000 (18:15 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 26 Dec 2002 18:15:23 +0000 (18:15 +0000)
scripts/clicks.py
src/client.cc
src/client.hh
src/openbox_wrap.cc

index 39effd53462245cff55186c3b1a951a162d4d32d..217fa289e996a3b863f4b7a8a6582f9a636d3c96 100644 (file)
@@ -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:
index 2f966cee0a72fe12bc66607ee9682deebf682f3a..74783eedac3c5e875ed47d9ff489bd1ed6834bd8 100644 (file)
@@ -866,13 +866,22 @@ void OBClient::close()
 
 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);
+}
+
+
 void OBClient::focusHandler(const XFocusChangeEvent &)
 {
   frame->focus();
@@ -887,11 +896,8 @@ void OBClient::unfocusHandler(const XFocusChangeEvent &)
   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");
 }
 
 
index 61f7b0717ce0310ecf027ea5619c01a1287975f4..8f0dc4f1d77cfdf020107e2e58af737d0ec500d1 100644 (file)
@@ -436,6 +436,9 @@ public:
 
   //! 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);
index 12cd7e2096d8de73e6a39b591ca33cbbfddbc9c2..5cf5d8ea62a4298d55c4acedaba6c9cf8dd334d8 100644 (file)
@@ -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 @@ static PyObject *_wrap_OBClient_focus(PyObject *self, PyObject *args) {
 }
 
 
+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 @@ static PyMethodDef SwigMethods[] = {
         { (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 },
This page took 0.033129 seconds and 4 git commands to generate.