bindings work again. yay
This commit is contained in:
parent
7e9fb9fb25
commit
db1fb534b8
2 changed files with 6 additions and 19 deletions
|
@ -211,7 +211,6 @@ void OBBindings::assimilate(BindingTree *node)
|
||||||
{
|
{
|
||||||
BindingTree *a, *b, *tmp, *last;
|
BindingTree *a, *b, *tmp, *last;
|
||||||
|
|
||||||
printf("node=%lx\n", (long)node);
|
|
||||||
if (!_keytree.first_child) {
|
if (!_keytree.first_child) {
|
||||||
// there are no nodes at this level yet
|
// there are no nodes at this level yet
|
||||||
_keytree.first_child = node;
|
_keytree.first_child = node;
|
||||||
|
@ -220,7 +219,6 @@ void OBBindings::assimilate(BindingTree *node)
|
||||||
last = a;
|
last = a;
|
||||||
b = node;
|
b = node;
|
||||||
while (a) {
|
while (a) {
|
||||||
printf("in while.. b=%lx\n", (long)b);
|
|
||||||
last = a;
|
last = a;
|
||||||
if (a->binding != b->binding) {
|
if (a->binding != b->binding) {
|
||||||
a = a->next_sibling;
|
a = a->next_sibling;
|
||||||
|
@ -231,20 +229,18 @@ void OBBindings::assimilate(BindingTree *node)
|
||||||
a = a->first_child;
|
a = a->first_child;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("after while.. b=%lx\n", (long)b);
|
|
||||||
if (last->binding != b->binding)
|
if (last->binding != b->binding)
|
||||||
last->next_sibling = b;
|
last->next_sibling = b;
|
||||||
else
|
else {
|
||||||
last->first_child = b->first_child;
|
last->first_child = b->first_child;
|
||||||
delete b;
|
delete b;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int OBBindings::find_key(BindingTree *search) const {
|
int OBBindings::find_key(BindingTree *search) const {
|
||||||
BindingTree *a, *b;
|
BindingTree *a, *b;
|
||||||
print_branch(&_keytree, " Searching:");
|
|
||||||
print_branch(search, " for...");
|
|
||||||
a = _keytree.first_child;
|
a = _keytree.first_child;
|
||||||
b = search;
|
b = search;
|
||||||
while (a && b) {
|
while (a && b) {
|
||||||
|
@ -253,11 +249,9 @@ int OBBindings::find_key(BindingTree *search) const {
|
||||||
} else {
|
} else {
|
||||||
if (a->chain == b->chain) {
|
if (a->chain == b->chain) {
|
||||||
if (!a->chain) {
|
if (!a->chain) {
|
||||||
printf("Match found with %s\n", a->text.c_str());
|
|
||||||
return a->id; // found it! (return the actual id, not the search's)
|
return a->id; // found it! (return the actual id, not the search's)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("Conflict found with %s\n", a->text.c_str());
|
|
||||||
return -2; // the chain status' don't match (conflict!)
|
return -2; // the chain status' don't match (conflict!)
|
||||||
}
|
}
|
||||||
b = b->first_child;
|
b = b->first_child;
|
||||||
|
@ -274,11 +268,8 @@ bool OBBindings::add_key(const StringVect &keylist, int id)
|
||||||
if (!(tree = buildtree(keylist, id)))
|
if (!(tree = buildtree(keylist, id)))
|
||||||
return false; // invalid binding requested
|
return false; // invalid binding requested
|
||||||
|
|
||||||
print_branch(tree, " Adding: ");
|
|
||||||
|
|
||||||
if (find_key(tree) != -1) {
|
if (find_key(tree) != -1) {
|
||||||
// conflicts with another binding
|
// conflicts with another binding
|
||||||
printf("Conflict\n");
|
|
||||||
destroytree(tree);
|
destroytree(tree);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -286,10 +277,6 @@ bool OBBindings::add_key(const StringVect &keylist, int id)
|
||||||
// assimilate this built tree into the main tree
|
// assimilate this built tree into the main tree
|
||||||
assimilate(tree); // assimilation destroys/uses the tree
|
assimilate(tree); // assimilation destroys/uses the tree
|
||||||
|
|
||||||
printf("Added!\n");
|
|
||||||
print_branch(&_keytree, "");
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,10 +163,10 @@ Openbox::Openbox(int argc, char **argv)
|
||||||
v.push_back("C-a");
|
v.push_back("C-a");
|
||||||
_bindings->add_key(v, 3);
|
_bindings->add_key(v, 3);
|
||||||
|
|
||||||
// _bindings->add_mouse("A-1", 1);
|
_bindings->add_mouse("A-1", 1);
|
||||||
|
|
||||||
// printf("CHAINS:\n");
|
printf("CHAINS:\n");
|
||||||
// _bindings->display();
|
_bindings->display();
|
||||||
::exit(0);
|
::exit(0);
|
||||||
|
|
||||||
setMasterHandler(_actions); // set as the master event handler
|
setMasterHandler(_actions); // set as the master event handler
|
||||||
|
|
Loading…
Reference in a new issue