Excerpts from Uli Schlachter's message of Thu Jul 30 09:43:46 -0400 2009: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > Andrei Thorp wrote: > > Subject: [PATCH 3/4] Run Prompt: Used Obvious timer hook instead of awful > > diff --git a/popup_run_prompt/init.lua b/popup_run_prompt/init.lua > > index d24a6cc..696a4e6 100644 > > --- a/popup_run_prompt/init.lua > > +++ b/popup_run_prompt/init.lua > > @@ -87,6 +90,19 @@ function set_default(s) > > }) > > end > > > > +function do_slide_up() > > + s = mouse.screen > > + startgeom = runwibox[s]:geometry() > > + runwibox[s]:geometry({ > > + y = startgeom.y - settings.move_amount, > > + }) > > + if runwibox[s]:geometry().y <= screen[s].geometry.y + > > + screen[s].geometry.height - startgeom.height then > > + set_default(mouse.screen) > > + lib.hooks.timer.stop(do_slide_up) > > + end > > +end > > There will be Bad Thinks (tm) happening when you move the mouse to another > screen while this timer is active. Make the screen an argument to the timer > function or something like this. What do you think about timers that are > deleted > when their function returns false?
Good catch! > > @@ -97,25 +113,33 @@ function show_wibox(s) > > }) > > runwibox[s].visible = true > > > > - f = function () > > - startgeom = runwibox[s]:geometry() > > - runwibox[s]:geometry({ > > - y = startgeom.y - settings.move_amount, > > - }) > > - if runwibox[s]:geometry().y <= screen[s].geometry.y + > > - screen[s].geometry.height - startgeom.height then > > - set_default(mouse.screen) > > - awful.hooks.timer.unregister(f) > > - end > > + if lib.hooks.timer.has(do_slide_up) then > > + lib.hooks.timer.start(do_slide_up) > > + else > > + lib.hooks.timer.register(settings.move_speed, > > + settings.move_speed*3, > > + do_slide_up, > > + "popup_run_prompt slide up") > > end > > - > > - awful.hooks.timer.register(settings.move_speed, f) > > I like the old code better which unregisters the timer when it's no longer > needed (or at least get rid of that lib.hooks.timer.has() call somehow). I'll probably register the timer elsewhere and just pause it right away then. Fixes to Timers pushed. -- Andrei Thorp, Developer: Xandros Corp. (http://www.xandros.com) -- To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.