From 0c564079b5860a101a4ac921fa48423859dd4098 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 7 May 2009 14:13:36 +0200 Subject: [PATCH] wibox: add property hook on screen and visible changes Signed-off-by: Julien Danjou --- lib/awful/client.lua.in | 3 ++- lib/awful/titlebar.lua.in | 1 + wibox.c | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in index a5acf021..28c2bdb5 100644 --- a/lib/awful/client.lua.in +++ b/lib/awful/client.lua.in @@ -13,6 +13,7 @@ local ipairs = ipairs local table = table local math = math local setmetatable = setmetatable +local type = type local capi = { client = client, @@ -575,7 +576,7 @@ hooks.manage.register(function (c) end) hooks.property.register(function (c, prop) - if prop == "geometry" and floating.get(c) then + if type(c) == "client" and prop == "geometry" and floating.get(c) then property.set(c, "floating_geometry", c:geometry()) end end) diff --git a/lib/awful/titlebar.lua.in b/lib/awful/titlebar.lua.in index f0b7054a..e1a90eed 100644 --- a/lib/awful/titlebar.lua.in +++ b/lib/awful/titlebar.lua.in @@ -10,6 +10,7 @@ local image = image local pairs = pairs local type = type local setmetatable = setmetatable +local type = type local capi = { wibox = wibox, diff --git a/wibox.c b/wibox.c index fb4b51c2..eb95ea36 100644 --- a/wibox.c +++ b/wibox.c @@ -605,7 +605,10 @@ wibox_setvisible(wibox_t *wibox, bool v) /* All the other wibox and ourselves need to be repositioned */ foreach(w, wibox->screen->wiboxes) wibox_position_update(*w); + } + + hook_property(wibox, wibox, "visible"); } } @@ -640,7 +643,10 @@ wibox_detach(wibox_t *wibox) break; } + hook_property(wibox, wibox, "screen"); + wibox->screen = NULL; + wibox_unref(globalconf.L, wibox); } } @@ -694,6 +700,8 @@ wibox_attach(screen_t *s) wibox_map(wibox); else wibox_need_update(wibox); + + hook_property(wibox, wibox, "screen"); } /** Create a new wibox.