diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-01-14 09:54:05 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-01-14 09:54:05 +0000 |
| commit | 96a9196cbb71b7f8d5e3d98a92b2e59bb1b591a8 (patch) | |
| tree | 795fa58db8ecd287d1b77f76818cc260b106db17 /src | |
| parent | 0afb43164484dcac4773ad778c032687da6b01aa (diff) | |
otk::Timer-ng!! thanks ManMower for this shizznit!
Diffstat (limited to 'src')
| -rw-r--r-- | src/bindings.cc | 19 | ||||
| -rw-r--r-- | src/bindings.hh | 2 | ||||
| -rw-r--r-- | src/openbox.cc | 5 | ||||
| -rw-r--r-- | src/openbox.hh | 15 | ||||
| -rw-r--r-- | src/openbox.py | 1 | ||||
| -rw-r--r-- | src/openbox_wrap.cc | 23 | ||||
| -rw-r--r-- | src/screen.cc | 3 |
7 files changed, 20 insertions, 48 deletions
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); diff --git a/src/bindings.hh b/src/bindings.hh index 6ce56706..32f422ff 100644 --- a/src/bindings.hh +++ b/src/bindings.hh @@ -67,7 +67,7 @@ private: Binding _resetkey; // the key which resets the key chain status - otk::Timer _timer; + otk::Timer *_timer; KeyBindingTree *find(KeyBindingTree *search, bool *conflict) const; KeyBindingTree *buildtree(const StringVect &keylist, diff --git a/src/openbox.cc b/src/openbox.cc index 2f089891..f4d11257 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -113,6 +113,7 @@ Openbox::Openbox(int argc, char **argv) sigaction(SIGINT, &action, (struct sigaction *) 0); sigaction(SIGHUP, &action, (struct sigaction *) 0); + otk::Timer::initialize(); _property = new otk::Property(); _actions = new Actions(); _bindings = new Bindings(); @@ -194,6 +195,8 @@ Openbox::~Openbox() // all im gunna do is the same. //otk::display->destroy(); + otk::Timer::destroy(); + if (_restart) { if (!_restart_prog.empty()) { const std::string &dstr = @@ -320,7 +323,7 @@ void Openbox::eventLoop() XFlush(**otk::display); // flush here before we go wait for timers // don't wait if we're to shutdown if (_shutdown) break; - _timermanager.fire(!_sync); // wait if not in sync mode + otk::Timer::dispatchTimers(!_sync); // wait if not in sync mode } } diff --git a/src/openbox.hh b/src/openbox.hh index fe49df15..d53bce0b 100644 --- a/src/openbox.hh +++ b/src/openbox.hh @@ -16,7 +16,6 @@ extern "C" { #include "otk/display.hh" #include "otk/screeninfo.hh" -#include "otk/timerqueuemanager.hh" #include "otk/property.hh" #include "otk/configuration.hh" #include "otk/eventdispatcher.hh" @@ -109,13 +108,6 @@ private: //! A list of all the managed screens ScreenList _screens; - //! Manages all timers for the application - /*! - Use of the otk::TimerQueueManager::fire funtion in this object ensures - that all timers fire when their times elapse. - */ - otk::TimerQueueManager _timermanager; - //! Cached atoms on the display /*! This is a pointer because the Property class uses otk::Display::display @@ -185,13 +177,6 @@ public: //! Returns the state of the window manager (starting, exiting, etc) inline RunState state() const { return _state; } - //! Returns the otk::TimerQueueManager for the application - /*! - All otk::Timer objects used in the application should be made to use this - otk::TimerQueueManager. - */ - inline otk::TimerQueueManager *timerManager() { return &_timermanager; } - //! Returns the otk::Property instance for the window manager inline const otk::Property *property() const { return _property; } diff --git a/src/openbox.py b/src/openbox.py index 1d7e4104..6b70a7ba 100644 --- a/src/openbox.py +++ b/src/openbox.py @@ -446,7 +446,6 @@ class Openbox(EventDispatcher,EventHandler): State_Normal = _openbox.Openbox_State_Normal State_Exiting = _openbox.Openbox_State_Exiting def state(*args): return apply(_openbox.Openbox_state,args) - def timerManager(*args): return apply(_openbox.Openbox_timerManager,args) def property(*args): return apply(_openbox.Openbox_property,args) def actions(*args): return apply(_openbox.Openbox_actions,args) def bindings(*args): return apply(_openbox.Openbox_bindings,args) diff --git a/src/openbox_wrap.cc b/src/openbox_wrap.cc index 4d1136cd..a6386a18 100644 --- a/src/openbox_wrap.cc +++ b/src/openbox_wrap.cc @@ -706,8 +706,7 @@ SWIG_InstallConstants(PyObject *d, swig_const_info constants[]) { #define SWIGTYPE_p_XMotionEvent swig_types[58] #define SWIGTYPE_p_XButtonEvent swig_types[59] #define SWIGTYPE_p_XSelectionEvent swig_types[60] -#define SWIGTYPE_p_otk__TimerQueueManager swig_types[61] -static swig_type_info *swig_types[63]; +static swig_type_info *swig_types[62]; /* -------- TYPES TABLE (END) -------- */ @@ -5073,23 +5072,6 @@ static PyObject *_wrap_Openbox_state(PyObject *self, PyObject *args) { } -static PyObject *_wrap_Openbox_timerManager(PyObject *self, PyObject *args) { - PyObject *resultobj; - ob::Openbox *arg1 = (ob::Openbox *) 0 ; - otk::TimerQueueManager *result; - PyObject * obj0 = 0 ; - - if(!PyArg_ParseTuple(args,(char *)"O:Openbox_timerManager",&obj0)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__Openbox,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - result = (otk::TimerQueueManager *)(arg1)->timerManager(); - - resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_otk__TimerQueueManager, 0); - return resultobj; - fail: - return NULL; -} - - static PyObject *_wrap_Openbox_property(PyObject *self, PyObject *args) { PyObject *resultobj; ob::Openbox *arg1 = (ob::Openbox *) 0 ; @@ -8117,7 +8099,6 @@ static PyMethodDef SwigMethods[] = { { (char *)"Cursors_ur_angle_get", _wrap_Cursors_ur_angle_get, METH_VARARGS }, { (char *)"Cursors_swigregister", Cursors_swigregister, METH_VARARGS }, { (char *)"Openbox_state", _wrap_Openbox_state, METH_VARARGS }, - { (char *)"Openbox_timerManager", _wrap_Openbox_timerManager, METH_VARARGS }, { (char *)"Openbox_property", _wrap_Openbox_property, METH_VARARGS }, { (char *)"Openbox_actions", _wrap_Openbox_actions, METH_VARARGS }, { (char *)"Openbox_bindings", _wrap_Openbox_bindings, METH_VARARGS }, @@ -8353,7 +8334,6 @@ static swig_type_info _swigt__p_p_unsigned_long[] = {{"_p_p_unsigned_long", 0, " static swig_type_info _swigt__p_XMotionEvent[] = {{"_p_XMotionEvent", 0, "XMotionEvent *", 0},{"_p_XMotionEvent"},{0}}; static swig_type_info _swigt__p_XButtonEvent[] = {{"_p_XButtonEvent", 0, "XButtonEvent *", 0},{"_p_XButtonEvent"},{0}}; static swig_type_info _swigt__p_XSelectionEvent[] = {{"_p_XSelectionEvent", 0, "XSelectionEvent *", 0},{"_p_XSelectionEvent"},{0}}; -static swig_type_info _swigt__p_otk__TimerQueueManager[] = {{"_p_otk__TimerQueueManager", 0, "otk::TimerQueueManager *", 0},{"_p_otk__TimerQueueManager"},{0}}; static swig_type_info *swig_types_initial[] = { _swigt__p_otk__Point, @@ -8417,7 +8397,6 @@ _swigt__p_p_unsigned_long, _swigt__p_XMotionEvent, _swigt__p_XButtonEvent, _swigt__p_XSelectionEvent, -_swigt__p_otk__TimerQueueManager, 0 }; diff --git a/src/screen.cc b/src/screen.cc index 2719deea..6158243a 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -75,8 +75,7 @@ Screen::Screen(int screen) openbox->cursors().session); // initialize the shit that is used for all drawing on the screen - _image_control = new otk::ImageControl(openbox->timerManager(), - _info, true); + _image_control = new otk::ImageControl(_info, true); _image_control->installRootColormap(); _root_cmap_installed = True; |
