awful.placement: fix no_overlap (FS#335)
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
a4224193d8
commit
df843a8452
|
@ -50,16 +50,15 @@ end
|
||||||
-- @param elem Area to remove.
|
-- @param elem Area to remove.
|
||||||
-- @return The new area list.
|
-- @return The new area list.
|
||||||
local function area_remove(areas, elem)
|
local function area_remove(areas, elem)
|
||||||
local newareas = areas
|
for i = #areas, 1, -1 do
|
||||||
for i, r in ipairs(areas) do
|
|
||||||
-- Check if the 'elem' intersect
|
-- Check if the 'elem' intersect
|
||||||
if area_intersect_area(r, elem) then
|
if area_intersect_area(areas[i], elem) then
|
||||||
-- It does? remove it
|
-- It does? remove it
|
||||||
table.remove(areas, i)
|
local r = table.remove(areas, i)
|
||||||
local inter = area_intersect_area_get(r, elem)
|
local inter = area_intersect_area_get(r, elem)
|
||||||
|
|
||||||
if inter.x > r.x then
|
if inter.x > r.x then
|
||||||
table.insert(newareas, {
|
table.insert(areas, {
|
||||||
x = r.x,
|
x = r.x,
|
||||||
y = r.y,
|
y = r.y,
|
||||||
width = inter.x - r.x,
|
width = inter.x - r.x,
|
||||||
|
@ -68,7 +67,7 @@ local function area_remove(areas, elem)
|
||||||
end
|
end
|
||||||
|
|
||||||
if inter.y > r.y then
|
if inter.y > r.y then
|
||||||
table.insert(newareas, {
|
table.insert(areas, {
|
||||||
x = r.x,
|
x = r.x,
|
||||||
y = r.y,
|
y = r.y,
|
||||||
width = r.width,
|
width = r.width,
|
||||||
|
@ -77,7 +76,7 @@ local function area_remove(areas, elem)
|
||||||
end
|
end
|
||||||
|
|
||||||
if inter.x + inter.width < r.x + r.width then
|
if inter.x + inter.width < r.x + r.width then
|
||||||
table.insert(newareas, {
|
table.insert(areas, {
|
||||||
x = inter.x + inter.width,
|
x = inter.x + inter.width,
|
||||||
y = r.y,
|
y = r.y,
|
||||||
width = (r.x + r.width) - (inter.x + inter.width),
|
width = (r.x + r.width) - (inter.x + inter.width),
|
||||||
|
@ -86,7 +85,7 @@ local function area_remove(areas, elem)
|
||||||
end
|
end
|
||||||
|
|
||||||
if inter.y + inter.height < r.y + r.height then
|
if inter.y + inter.height < r.y + r.height then
|
||||||
table.insert(newareas, {
|
table.insert(areas, {
|
||||||
x = r.x,
|
x = r.x,
|
||||||
y = inter.y + inter.height,
|
y = inter.y + inter.height,
|
||||||
width = r.width,
|
width = r.width,
|
||||||
|
@ -96,7 +95,7 @@ local function area_remove(areas, elem)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return newareas
|
return areas
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Place the client without it being outside the screen.
|
--- Place the client without it being outside the screen.
|
||||||
|
|
Loading…
Reference in New Issue