From ff47b0d0c4f523f5b10ce4425a4606d49aab86e6 Mon Sep 17 00:00:00 2001 From: Luke Bonham Date: Mon, 30 Jan 2017 13:42:54 +0100 Subject: [PATCH] object/client.c: added position and size properties added client signals connection added comments doc --- lib/awful/client/shape.lua | 4 ++-- objects/client.c | 34 ++++++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/lib/awful/client/shape.lua b/lib/awful/client/shape.lua index e51d873a1..f688b8c51 100644 --- a/lib/awful/client/shape.lua +++ b/lib/awful/client/shape.lua @@ -85,8 +85,8 @@ end capi.client.connect_signal("property::shape_client_bounding", shape.update.bounding) capi.client.connect_signal("property::shape_client_clip", shape.update.clip) -capi.client.connect_signal("property::width", shape.update.all) -capi.client.connect_signal("property::height", shape.update.all) +capi.client.connect_signal("property::size", shape.update.all) +capi.client.connect_signal("property::border_width", shape.update.all) return shape diff --git a/objects/client.c b/objects/client.c index ec4ab424b..159e554dc 100644 --- a/objects/client.c +++ b/objects/client.c @@ -733,6 +733,16 @@ * @param tag */ +/** When the height or width changed. + * @signal property::size + * @see client.geometry + */ + +/** When the x or y coordinate changed. + * @signal property::position + * @see client.geometry + */ + /** * The border color when the client is focused. * @@ -1647,14 +1657,22 @@ client_resize_do(client_t *c, area_t geometry) luaA_object_push(L, c); if (!AREA_EQUAL(old_geometry, geometry)) luaA_object_emit_signal(L, -1, "property::geometry", 0); - if (old_geometry.x != geometry.x) - luaA_object_emit_signal(L, -1, "property::x", 0); - if (old_geometry.y != geometry.y) - luaA_object_emit_signal(L, -1, "property::y", 0); - if (old_geometry.width != geometry.width) - luaA_object_emit_signal(L, -1, "property::width", 0); - if (old_geometry.height != geometry.height) - luaA_object_emit_signal(L, -1, "property::height", 0); + if (old_geometry.x != geometry.x || old_geometry.y != geometry.y) + { + luaA_object_emit_signal(L, -1, "property::position", 0); + if (old_geometry.x != geometry.x) + luaA_object_emit_signal(L, -1, "property::x", 0); + else + luaA_object_emit_signal(L, -1, "property::y", 0); + } + if (old_geometry.width != geometry.width || old_geometry.height != geometry.height) + { + luaA_object_emit_signal(L, -1, "property::size", 0); + if (old_geometry.width != geometry.width) + luaA_object_emit_signal(L, -1, "property::width", 0); + else + luaA_object_emit_signal(L, -1, "property::height", 0); + } lua_pop(L, 1); screen_client_moveto(c, new_screen, false);