Fix a regression of size adjustments.

This commit is contained in:
Xinhao Yuan 2021-02-27 13:45:03 -05:00
parent 88148f0dee
commit f8ff725e9b
1 changed files with 7 additions and 4 deletions

View File

@ -492,19 +492,22 @@ function module.create(data)
end end
function adjust_shares(c, axis, adj) function adjust_shares(c, axis, adj)
if not c:isvisible() or c.floating or c.immobilized or if not c:isvisible() or c.floating or c.immobilized then
not c.machi or not c.machi.area then
return return
end end
local screen = c.screen local screen = c.screen
local tag = screen.selected_tag local tag = screen.selected_tag
local layout = tag.layout local layout = tag.layout
if not layout.machi_get_instance_data then return end if not layout.machi_get_instance_data then return end
local _cd, _td, areas = layout.machi_get_instace_data(screen, tag) local cd, _td, areas = layout.machi_get_instance_data(screen, tag)
local key_shares = axis.."_shares" local key_shares = axis.."_shares"
local key_spare = axis.."_spare" local key_spare = axis.."_spare"
local key_parent_shares = "parent_"..axis.."_shares" local key_parent_shares = "parent_"..axis.."_shares"
if not cd[c] or not cd[c].area then
return
end
if adj < 0 then if adj < 0 then
if axis == "x" and c.width + adj < data.minimum_size then if axis == "x" and c.width + adj < data.minimum_size then
adj = data.minimum_size - c.width adj = data.minimum_size - c.width
@ -534,7 +537,7 @@ function module.create(data)
end end
end end
local area = c.machi.area local area = cd[c].area
while areas[area].parent_id do while areas[area].parent_id do
if adjust(areas[area].parent_id, areas[area][key_parent_shares], adj) then if adjust(areas[area].parent_id, areas[area][key_parent_shares], adj) then
break break