From: Corey Thompson <cmt...@gmail.com>

* client.c: Previous geometry as argument to property::geometry signal
* client.lua: Initialize floating_geometry using the previous argumment

Conflicts:

        lib/awful/client.lua.in
        objects/client.c

Signed-off-by: Corey Thompson <cmt...@gmail.com>
---
 lib/awful/client.lua.in |   14 +++++++++-----
 objects/client.c        |   23 ++++++++++++++++++-----
 2 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in
index 03dcfab..ed84b41 100644
--- a/lib/awful/client.lua.in
+++ b/lib/awful/client.lua.in
@@ -586,11 +586,15 @@ end
 
 -- Store the initial client geometry.
 capi.client.connect_signal("new", function(c)
-    local function store_init_geometry(c)
-        property.set(c, "floating_geometry", c:geometry())
-        c:disconnect_signal("property::border_width", store_init_geometry)
-    end
-    c:connect_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
+        property.set(c, "floating_geometry", p)
+        c:disconnect_signal("property::geometry", store_init_geometry)
+    end
+    c:connect_signal("property::geometry", store_init_geometry)
 end)
 
 capi.client.connect_signal("manage", function(c)
diff --git a/objects/client.c b/objects/client.c
index 452f801..7ac860b 100644
--- a/objects/client.c
+++ b/objects/client.c
@@ -619,15 +619,28 @@ client_resize(client_t *c, area_t geometry)
         screen_client_moveto(c, new_screen, false);
 
         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);
         if (old_geometry.x != geometry.x)
-            luaA_object_emit_signal(globalconf.L, -1, "property::x", 0);
+        {
+            lua_pushnumber(globalconf.L, geometry_prev.x);
+            luaA_object_emit_signal(globalconf.L, -2, "property::x", 1);
+        }
         if (old_geometry.y != geometry.y)
-            luaA_object_emit_signal(globalconf.L, -1, "property::y", 0);
+        {
+            lua_pushnumber(globalconf.L, geometry_prev.y);
+            luaA_object_emit_signal(globalconf.L, -2, "property::y", 1);
+        }
         if (old_geometry.width != geometry.width)
-            luaA_object_emit_signal(globalconf.L, -1, "property::width", 0);
+        {
+            lua_pushnumber(globalconf.L, geometry_prev.width);
+            luaA_object_emit_signal(globalconf.L, -2, "property::width", 1);
+        }
         if (old_geometry.height != geometry.height)
-            luaA_object_emit_signal(globalconf.L, -1, "property::height", 0);
+        {
+            lua_pushnumber(globalconf.L, geometry_prev.height);
+            luaA_object_emit_signal(globalconf.L, -2, "property::height", 1);
+        }
         lua_pop(globalconf.L, 1);
 
         return true;
-- 
1.7.9.4


-- 
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.

Reply via email to