client: Prevent an error when using the "after" mode

Fix: #2101
This commit is contained in:
Emmanuel Lepage Vallee 2017-11-05 20:29:47 +01:00
parent 8ebea11df0
commit 3ffbe4c03b
1 changed files with 9 additions and 6 deletions

View File

@ -156,11 +156,12 @@ local function handler(_, client, context, args) --luacheck: no unused_args
capi.mousegrabber.run(function (_mouse) capi.mousegrabber.run(function (_mouse)
if not client.valid then return end if not client.valid then return end
-- Resize everytime the mouse moves (default behavior). -- Resize everytime the mouse moves (default behavior) in live mode,
if args.mode == "live" then -- otherwise keep the current geometry
-- Get the new geometry geo = setmetatable(
geo = setmetatable(args.placement(client, args), {__index=args}) args.mode == "live" and args.placement(client, args) or client:geometry(),
end {__index=args}
)
-- Execute the move callbacks. This can be used to add features such as -- Execute the move callbacks. This can be used to add features such as
-- snap or adding fancy graphical effects. -- snap or adding fancy graphical effects.
@ -182,7 +183,9 @@ local function handler(_, client, context, args) --luacheck: no unused_args
end end
-- In case it was modified -- In case it was modified
setmetatable(geo,{__index=args}) if geo then
setmetatable(geo, {__index=args})
end
if args.mode == "live" then if args.mode == "live" then
-- Ask the resizing handler to resize the client -- Ask the resizing handler to resize the client