+ if (key == _resetkey.key && modifiers == _resetkey.modifiers) {
+ reset(this);
+ } else {
+ KeyBindingTree *p = _curpos->first_child;
+ while (p) {
+ if (p->binding.key == key && p->binding.modifiers == modifiers) {
+ if (p->chain) {
+ _timer.start(); // start/restart the timer
+ grabKeys(false);
+ _curpos = p;
+ grabKeys(true);
+ } else {
+ Window win = None;
+ OBClient *c = Openbox::instance->focusedClient();
+ if (c) win = c->window();
+ KeyData *data = new_key_data(win, time, modifiers, key);
+ python_callback(p->callback, (PyObject*)data);
+ Py_DECREF((PyObject*)data);
+ reset(this);
+ }
+ break;
+ }
+ p = p->next_sibling;
+ }
+ }
+}
+
+void OBBindings::reset(OBBindings *self)
+{
+ self->_timer.stop();
+ self->grabKeys(false);
+ self->_curpos = &self->_keytree;
+ self->grabKeys(true);
+}
+
+
+bool OBBindings::addButton(const std::string &but, MouseContext context,
+ MouseAction action, PyObject *callback)
+{
+ assert(context >= 0 && context < NUM_MOUSE_CONTEXT);
+
+ Binding b(0,0);
+ if (!translate(but, b, false))
+ return false;