i dont get how the fuck the key tree is changing..
This commit is contained in:
parent
d4853f108c
commit
dabac4f740
1 changed files with 11 additions and 10 deletions
|
@ -37,9 +37,9 @@ void OBBindings::display()
|
||||||
printf("Key Tree:\n");
|
printf("Key Tree:\n");
|
||||||
print_branch(_keytree.first_child, "");
|
print_branch(_keytree.first_child, "");
|
||||||
}
|
}
|
||||||
if (_mousetree.next_sibling) {
|
if (_mousetree) {
|
||||||
printf("Mouse Tree:\n");
|
printf("Mouse Tree:\n");
|
||||||
BindingTree *p = _mousetree.next_sibling;
|
BindingTree *p = _mousetree;
|
||||||
while (p) {
|
while (p) {
|
||||||
printf("%d %s\n", p->id, p->text.c_str());
|
printf("%d %s\n", p->id, p->text.c_str());
|
||||||
p = p->next_sibling;
|
p = p->next_sibling;
|
||||||
|
@ -180,19 +180,20 @@ bool OBBindings::add_mouse(const std::string &button, int id)
|
||||||
if (!translate(button, n.binding, false))
|
if (!translate(button, n.binding, false))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
BindingTree *p = _mousetree.next_sibling, *last = &_mousetree;
|
BindingTree *p = _mousetree, **newp = &_mousetree;
|
||||||
while (p) {
|
while (p) {
|
||||||
if (p->binding == n.binding)
|
if (p->binding == n.binding)
|
||||||
return false; // conflict
|
return false; // conflict
|
||||||
last = p;
|
|
||||||
p = p->next_sibling;
|
p = p->next_sibling;
|
||||||
|
newp = &p->next_sibling;
|
||||||
}
|
}
|
||||||
display();
|
display();
|
||||||
last->next_sibling = new BindingTree(id);
|
*newp = new BindingTree(id);
|
||||||
display();
|
display();
|
||||||
last->next_sibling->chain = false;
|
(*newp)->text = button;
|
||||||
last->next_sibling->binding.key = n.binding.key;
|
(*newp)->chain = false;
|
||||||
last->next_sibling->binding.modifiers = n.binding.modifiers;
|
(*newp)->binding.key = n.binding.key;
|
||||||
|
(*newp)->binding.modifiers = n.binding.modifiers;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -319,13 +320,13 @@ void OBBindings::remove_all()
|
||||||
remove_branch(_keytree.first_child);
|
remove_branch(_keytree.first_child);
|
||||||
_keytree.first_child = 0;
|
_keytree.first_child = 0;
|
||||||
}
|
}
|
||||||
BindingTree *p = _mousetree.next_sibling;
|
BindingTree *p = _mousetree;
|
||||||
while (p) {
|
while (p) {
|
||||||
BindingTree *n = p->next_sibling;
|
BindingTree *n = p->next_sibling;
|
||||||
delete p;
|
delete p;
|
||||||
p = n;
|
p = n;
|
||||||
}
|
}
|
||||||
_mousetree.next_sibling = 0;
|
_mousetree = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue