titlebar: resize client when adding/removing so total size remains the same

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Maarten Maathuis 2008-12-10 21:07:34 +01:00 committed by Julien Danjou
parent f655e8bcf4
commit 630ef295a1
1 changed files with 9 additions and 0 deletions

View File

@ -112,8 +112,14 @@ function add(c, args)
tb.widgets = { appicon = appicon, title = title, tb.widgets = { appicon = appicon, title = title,
closef = closef, close = close } closef = closef, close = close }
-- Store old geometry (including borders)
local old_geom = c:fullgeometry()
c.titlebar = tb c.titlebar = tb
-- Resize the client so the same amount of space is occupied as before.
c:fullgeometry(old_geom)
update(c) update(c)
update(c, "geometry") update(c, "geometry")
end end
@ -161,8 +167,11 @@ end
--- Remove a titlebar from a client. --- Remove a titlebar from a client.
-- @param c The client. -- @param c The client.
function remove(c) function remove(c)
local old_geom = c:fullgeometry()
c.titlebar = nil c.titlebar = nil
data[c] = nil data[c] = nil
-- Resize the client so the same amount of space is occupied as before.
c:fullgeometry(old_geom)
end end
-- Register standards hooks -- Register standards hooks