From 96a9196cbb71b7f8d5e3d98a92b2e59bb1b591a8 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Tue, 14 Jan 2003 09:54:05 +0000 Subject: otk::Timer-ng!! thanks ManMower for this shizznit! --- src/bindings.cc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/bindings.cc') diff --git a/src/bindings.cc b/src/bindings.cc index 83c9913f..054bec25 100644 --- a/src/bindings.cc +++ b/src/bindings.cc @@ -145,17 +145,17 @@ KeyBindingTree *Bindings::buildtree(const StringVect &keylist, Bindings::Bindings() : _curpos(&_keytree), _resetkey(0,0), - _timer(openbox->timerManager(), - (otk::TimeoutHandler)resetChains, this) + _timer((otk::Timer *) 0) { - _timer.setTimeout(5000); // chains reset after 5 seconds - // setResetKey("C-g"); // set the default reset key } Bindings::~Bindings() { + if (_timer) + delete _timer; + grabKeys(false); removeAllKeys(); // removeAllButtons(); XXX @@ -379,7 +379,11 @@ void Bindings::fireKey(int screen, unsigned int modifiers, unsigned int key, while (p) { if (p->binding.key == key && p->binding.modifiers == modifiers) { if (p->chain) { - _timer.start(); // start/restart the timer + if (_timer) + delete _timer; + _timer = new otk::Timer(5000, // 5 second timeout + (otk::Timer::TimeoutHandler)resetChains, + this); // grab the server here to make sure no key pressed go missed otk::display->grab(); grabKeys(false); @@ -403,7 +407,10 @@ void Bindings::fireKey(int screen, unsigned int modifiers, unsigned int key, void Bindings::resetChains(Bindings *self) { - self->_timer.stop(); + if (self->_timer) { + delete self->_timer; + self->_timer = (otk::Timer *) 0; + } // grab the server here to make sure no key pressed go missed otk::display->grab(); self->grabKeys(false); -- cgit v1.2.3