- if (_keytree.first_child) {
- remove_branch(_keytree.first_child);
- _keytree.first_child = 0;
- }
- BindingTree *p = _mousetree;
- while (p) {
- BindingTree *n = p->next_sibling;
- delete p;
- p = n;
- }
- _mousetree = 0;
-}
-
-
-void OBBindings::process(unsigned int modifiers, unsigned int key)
-{
- BindingTree *c = _curpos->first_child;
-
- while (c) {
- if (c->binding.key == key && c->binding.modifiers == modifiers) {
- _curpos = c;
- break;
- }
- }
- if (c) {
- if (!_curpos->chain) {
- // XXX execute command for _curpos->id
- _curpos = &_keytree; // back to the start
- }
- }
-}
-
-
-void OBBindings::grabMouse(bool grab, const OBClient *client)
-{
- BindingTree *p = _mousetree;
- while (p) {
- if (grab)
- otk::OBDisplay::grabButton(p->binding.key, p->binding.modifiers,
- client->frame->window(), false,
- ButtonMotionMask | ButtonPressMask |
- ButtonReleaseMask, GrabModeAsync,
- GrabModeAsync, None, None, false);
- else
- otk::OBDisplay::ungrabButton(p->binding.key, p->binding.modifiers,
- client->frame->window());
- p = p->next_sibling;
- }
-}
-
-
-void OBBindings::grabMouseOnAll(bool grab)
-{
- for (int i = 0; i < Openbox::instance->screenCount(); ++i) {
- OBScreen *s = Openbox::instance->screen(i);
- assert(s);
- OBScreen::ClientList::iterator it, end = s->clients.end();
- for (it = s->clients.begin(); it != end; ++it)
- grabMouse(grab, *it);