wibox: add property hook on screen and visible changes

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-05-07 14:13:36 +02:00
parent f4e77bcab9
commit 0c564079b5
3 changed files with 11 additions and 1 deletions

View File

@ -13,6 +13,7 @@ local ipairs = ipairs
local table = table local table = table
local math = math local math = math
local setmetatable = setmetatable local setmetatable = setmetatable
local type = type
local capi = local capi =
{ {
client = client, client = client,
@ -575,7 +576,7 @@ hooks.manage.register(function (c)
end) end)
hooks.property.register(function (c, prop) 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()) property.set(c, "floating_geometry", c:geometry())
end end
end) end)

View File

@ -10,6 +10,7 @@ local image = image
local pairs = pairs local pairs = pairs
local type = type local type = type
local setmetatable = setmetatable local setmetatable = setmetatable
local type = type
local capi = local capi =
{ {
wibox = wibox, wibox = wibox,

View File

@ -605,7 +605,10 @@ wibox_setvisible(wibox_t *wibox, bool v)
/* All the other wibox and ourselves need to be repositioned */ /* All the other wibox and ourselves need to be repositioned */
foreach(w, wibox->screen->wiboxes) foreach(w, wibox->screen->wiboxes)
wibox_position_update(*w); wibox_position_update(*w);
} }
hook_property(wibox, wibox, "visible");
} }
} }
@ -640,7 +643,10 @@ wibox_detach(wibox_t *wibox)
break; break;
} }
hook_property(wibox, wibox, "screen");
wibox->screen = NULL; wibox->screen = NULL;
wibox_unref(globalconf.L, wibox); wibox_unref(globalconf.L, wibox);
} }
} }
@ -694,6 +700,8 @@ wibox_attach(screen_t *s)
wibox_map(wibox); wibox_map(wibox);
else else
wibox_need_update(wibox); wibox_need_update(wibox);
hook_property(wibox, wibox, "screen");
} }
/** Create a new wibox. /** Create a new wibox.