]> Dogcows Code - chaz/openbox/commitdiff
you can bind buttons already about, and itll replace them
authorDana Jansens <danakj@orodu.net>
Fri, 3 Jan 2003 06:55:04 +0000 (06:55 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 3 Jan 2003 06:55:04 +0000 (06:55 +0000)
scripts/config.py
src/bindings.cc
src/bindings.hh
src/frame.cc
src/frame.hh

index c3c43754b180139d7164e023159d13c98f6fe25e..c1f60ba04fe3edd37ff8a742fcd189309654a2ba 100644 (file)
@@ -17,18 +17,10 @@ theme = "/usr/local/share/openbox/styles/nyz"
 ### behaviors.                                                            ###
 #############################################################################
 
-# click_focus - '1' if clicking in a client will cause it to focus in the
-#               default hook functions; else '0'.
-click_focus = 0
-# click_raise - '1' if clicking in a client will cause it to raise to the
-#               top of its stacking layer; else '0'.
-click_raise = 0
-# enter_focus - '1' if entering a client window will cause it to focus in the
-#               default hook functions; else '0'.
-enter_focus = 1
-# leave_unfocus - '1' if leaving a client window will cause it to unfocus in
-#                 the default hook functions; else '0'.
-leave_unfocus = 1
+# resize_nearest - 1 to resize from the corner nearest where the mouse is, 0
+#                  to resize always from the bottom right corner
+resize_nearest = 1
+
 
 
 print "Loaded config.py"
index 943a9acc8e32db98bc115c4bfad027b1c8e50e95..3e9358d5bd33edcc4829f2f6f6c161066e7fd90d 100644 (file)
@@ -386,11 +386,8 @@ bool OBBindings::addButton(const std::string &but, MouseContext context,
   for (it = _buttons[context].begin(); it != end; ++it)
     if ((*it)->binding.key == b.key &&
         (*it)->binding.modifiers == b.modifiers) {
-      ButtonBinding::CallbackList::iterator c_it,
-        c_end = (*it)->callback[action].end();
-      for (c_it = (*it)->callback[action].begin(); c_it != c_end; ++c_it)
-        if (*c_it == callback)
-          return true; // already bound
+      if ((*it)->callback[action] == callback)
+        return true; // already bound
       break;
     }
 
@@ -402,11 +399,11 @@ bool OBBindings::addButton(const std::string &but, MouseContext context,
     bind->binding.key = b.key;
     bind->binding.modifiers = b.modifiers;
     _buttons[context].push_back(bind);
-    printf("adding %d.%d to %d\n", b.key, b.modifiers, context);
     // XXX GRAB the new button everywhere!
   } else
     bind = *it;
-  bind->callback[action].push_back(callback);
+  Py_XDECREF(bind->callback[action]); // if it was already bound, unbind it
+  bind->callback[action] = callback;
   Py_INCREF(callback);
   return true;
 }
@@ -450,10 +447,8 @@ void OBBindings::fire(ButtonData *data)
   for (it = _buttons[data->context].begin(); it != end; ++it)
     if ((*it)->binding.key == data->button &&
         (*it)->binding.modifiers == data->state) {
-      ButtonBinding::CallbackList::iterator c_it,
-        c_end = (*it)->callback[data->action].end();
-      for (c_it = (*it)->callback[data->action].begin(); c_it != c_end; ++c_it)
-        python_callback(*c_it, (PyObject*)data);
+      if ((*it)->callback[data->action])
+        python_callback((*it)->callback[data->action], (PyObject*)data);
     }
 }
 
index 5d1df29b97e6c9a8b4344c698208df1ac2986fc1..1ca46df72e8d2d19cca99d5e99377a6022f17323 100644 (file)
@@ -52,9 +52,9 @@ typedef struct KeyBindingTree {
 
 typedef struct ButtonBinding {
   Binding binding;
-  typedef std::list<PyObject*> CallbackList;
-  CallbackList callback[NUM_MOUSE_ACTION];
+  PyObject *callback[NUM_MOUSE_ACTION];
   ButtonBinding() : binding(0, 0) {
+    for(int i=0; i<NUM_MOUSE_ACTION; ++i) callback[i] = 0;
   }
 };
 
index e7f310a0f69721cfeddd9761f34b9e9fb3b01ab5..6f4bba0061db8d5bb25dece4e6066a0c8f8e1219 100644 (file)
@@ -58,44 +58,15 @@ OBFrame::OBFrame(OBClient *client, otk::Style *style)
   _plate.show(); // the other stuff is shown based on decor settings
   
   grabClient();
-
-  grabButtons(true);
 }
 
 
 OBFrame::~OBFrame()
 {
-  grabButtons(false);
   releaseClient(false);
 }
 
 
-void OBFrame::grabButtons(bool grab)
-{
-/*  _plate.grabButtons(grab);
-
-  // grab any requested buttons on the entire frame
-  std::vector<std::string> grabs;
-  if (python_get_stringlist("client_buttons", &grabs)) {
-    std::vector<std::string>::iterator grab_it, grab_end = grabs.end();
-    for (grab_it = grabs.begin(); grab_it != grab_end; ++grab_it) {
-      Binding b;
-      if (!Openbox::instance->bindings()->translate(*grab_it, b, false))
-        continue;
-      printf("grabbing %d %d\n", b.key, b.modifiers);
-      if (grab) {
-        otk::OBDisplay::grabButton(b.key, b.modifiers, _window, true,
-                                   ButtonPressMask | ButtonMotionMask |
-                                   ButtonReleaseMask, GrabModeAsync,
-                                   GrabModeAsync, _window, None, false);
-      } else {
-        otk::OBDisplay::ungrabButton(b.key, b.modifiers, _window);
-      }
-    }
-    }*/
-}
-
-  
 void OBFrame::setTitle(const std::string &text)
 {
   _label.setText(text);
index 7313c3a12dfe8013b03fcb8cf3005f12b5f1ade4..ab1e1b0347eb5c82e4a90fa42cfbc5bc453e76fb 100644 (file)
@@ -80,9 +80,6 @@ private:
   //! Shape the frame window to the client window
   void adjustShape();
 
-  //! Grabs or ungrabs buttons on the frame
-  void grabButtons(bool grab);
-  
 public:
   //! Constructs an OBFrame object, and reparents the client to itself
   /*!
This page took 0.027142 seconds and 4 git commands to generate.