placement: Stop detecting screen objects using `type(o.geometry)`.

All object type will now use tables instead of function, so this
check will break.
This commit is contained in:
Emmanuel Lepage Vallee 2019-10-20 01:11:23 -04:00
parent d2b7d292b0
commit 36999de123
1 changed files with 22 additions and 24 deletions

View File

@ -392,10 +392,12 @@ local function geometry_common(obj, args, new_geo, ignore_border_width)
and obj.coords(new_geo) or obj.coords()
return {x=coords.x, y=coords.y, width=0, height=0}
elseif obj.geometry then
local geo = obj.geometry
if obj.get_bounding_geometry then
-- It is a screen, it doesn't support setting new sizes.
return obj:get_bounding_geometry(args)
end
-- It is either a drawable or something that implement its API
if type(geo) == "function" then
local dgeo = area_common(
obj, fix_new_geometry(new_geo, args), ignore_border_width, args
)
@ -413,10 +415,6 @@ local function geometry_common(obj, args, new_geo, ignore_border_width)
end
return dgeo
end
-- It is a screen, it doesn't support setting new sizes.
return obj:get_bounding_geometry(args)
else
assert(false, "Invalid object")
end
@ -1462,7 +1460,7 @@ function placement.next_to(d, args)
args = add_context(args, "next_to")
d = d or capi.client.focus
local osize = type(d.geometry) == "function" and d:geometry() or nil
local osize = type(d.geometry) == "function" and d:geometry() or d.geometry
local original_pos, original_anchors = args.preferred_positions, args.preferred_anchors
if type(original_pos) == "string" then