summaryrefslogtreecommitdiff
path: root/src/bindings.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-12-31 19:15:24 +0000
committerDana Jansens <danakj@orodu.net>2002-12-31 19:15:24 +0000
commit745e840547b5443ecfb9b6f0a4f14b0d035d59c2 (patch)
treee20da017ab6d93775136f0cd2267a25f7c83f8d6 /src/bindings.cc
parent1161a90a70b21d3064a9dee62c72dd4be3025ada (diff)
load config options from the python environment
Diffstat (limited to 'src/bindings.cc')
-rw-r--r--src/bindings.cc27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/bindings.cc b/src/bindings.cc
index ef14d585..42a92591 100644
--- a/src/bindings.cc
+++ b/src/bindings.cc
@@ -134,8 +134,13 @@ BindingTree *OBBindings::buildtree(const StringVect &keylist, int id) const
OBBindings::OBBindings()
- : _curpos(&_tree), _resetkey(0,0)
+ : _curpos(&_tree),
+ _resetkey(0,0),
+ _timer(Openbox::instance->timerManager(),
+ (otk::OBTimeoutHandler)reset, this)
{
+ _timer.setTimeout(5000); // chains reset after 5 seconds
+
setResetKey("C-g"); // set the default reset key
}
@@ -299,10 +304,11 @@ void OBBindings::grabKeys(bool grab)
BindingTree *p = _curpos->first_child;
while (p) {
- if (grab)
+ if (grab) {
otk::OBDisplay::grabKey(p->binding.key, p->binding.modifiers,
root, false, GrabModeAsync, GrabModeAsync,
false);
+ }
else
otk::OBDisplay::ungrabKey(p->binding.key, p->binding.modifiers,
root);
@@ -324,22 +330,19 @@ void OBBindings::fire(Window window, unsigned int modifiers, unsigned int key,
Time time)
{
if (key == _resetkey.key && modifiers == _resetkey.modifiers) {
- grabKeys(false);
- _curpos = &_tree;
- grabKeys(true);
+ reset(this);
} else {
BindingTree *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 {
python_callback_binding(p->id, window, modifiers, key, time);
- grabKeys(false);
- _curpos = &_tree;
- grabKeys(true);
+ reset(this);
}
break;
}
@@ -348,4 +351,12 @@ void OBBindings::fire(Window window, unsigned int modifiers, unsigned int key,
}
}
+void OBBindings::reset(OBBindings *self)
+{
+ self->_timer.stop();
+ self->grabKeys(false);
+ self->_curpos = &self->_tree;
+ self->grabKeys(true);
+}
+
}