On 25.03.2012 17:41, [email protected] wrote:
> From: Corey Thompson <[email protected]>
> 
> * client.c: Previous geometry as argument to property::geometry signal
> * client.lua: Initialize floating_geometry using the previous argumment
> 
> Signed-off-by: Corey Thompson <[email protected]>
> ---
>  client.c                |   16 +++++++++++-----
>  lib/awful/client.lua.in |   14 +++++++++-----
>  2 files changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/client.c b/client.c
> index 1d83c58..73e7dcc 100644
> --- a/client.c
> +++ b/client.c
> @@ -929,6 +929,7 @@ client_resize(client_t *c, area_t geometry, bool hints)
>          c->geometries.internal.height = values[3] = geometry_internal.height;
>  
>          /* Also store geometry including border and titlebar. */
> +        area_t geometry_prev = c->geometry;
>          c->geometry = geometry;
>  
>          titlebar_update_geometry(c);
> @@ -949,12 +950,17 @@ client_resize(client_t *c, area_t geometry, bool hints)
>          hook_property(c, "geometry");
>  
>          luaA_object_push(globalconf.L, c);
> -        luaA_object_emit_signal(globalconf.L, -1, "property::geometry", 0);
> +        int nargs = luaA_pusharea(globalconf.L, geometry_prev);
> +        luaA_object_emit_signal(globalconf.L, -1 - nargs, 
> "property::geometry", nargs);

Here you will always have a table with x, y, width and height as the argument to
this signal, however...

[...]
> diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in
> index cf78c9f..81b107f 100644
> --- a/lib/awful/client.lua.in
> +++ b/lib/awful/client.lua.in
> @@ -578,11 +578,15 @@ end
>  
>  -- Store the initial client geometry.
>  capi.client.add_signal("new", function(c)
> -    local function store_init_geometry(c)
> -        property.set(c, "floating_geometry", c:geometry())
> -        c:remove_signal("property::border_width", store_init_geometry)
> -    end
> -    c:add_signal("property::border_width", store_init_geometry)
> +    local function store_init_geometry(c, p)
> +        -- the first property::geometry signal is emitted before
> +        -- borders and titlebar have been added, so hold off for
> +        -- the second signal and then take the previous geometry
> +        if not p then return end

...here you check if the argument is nil, which will never be the case.

> +        property.set(c, "floating_geometry", p)
> +        c:remove_signal("property::geometry", store_init_geometry)
> +    end
> +    c:add_signal("property::geometry", store_init_geometry)
>  end)

Since this code only cares about c:geometry(), why doesn't it use
property::geometry instead of property::border_width? Shouldn't that solve the
problem, too?

Uli
-- 
"Why make things difficult, when it is possible to make them cryptic
and totally illogical, with just a little bit more effort?" -- A. P. J.

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

Reply via email to