-----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?

> @@ -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).

> +function do_slide_down()
[snip]

Same as above

Uli
- --
"Do you know that books smell like nutmeg or some spice from a foreign land?"
                                                  -- Faber in Fahrenheit 451
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iQEcBAEBCAAGBQJKcaORAAoJECLkKOvLj8sGPLsIAIVt/3UItKD5wNrOeQsYthQn
GyNJvGzkvUD5USi0hWgdHLhi/R+Mmv5qyejxAGNEE3+pnqxl9DY4XrpuTahQJDpg
VLvQXPsXu+A0576v5NzOXkyJczVUcJobKRUpkWCcJ5IBLt7cTjhe5G4fOX1dVHIG
Rvhu+L2SEuZTiiB8PCf9p8MU0d17DKPIqOr9BNCJ4w+Xw8Fs935ewfi34qliPcVt
0InyvflXd2da/R4G3Ckae1koiK/3r5ElqbGr9D2tuUZ1AjGpRekFGal81z0JpeYU
gLNQjUMhpM4EV34n0ygwYxQqY/AsxVYFGHrEzzxPaPXpcWnrvmZJF/O/NjRF+ks=
=miNm
-----END PGP SIGNATURE-----

-- 
To unsubscribe, send mail to [email protected].

Reply via email to