From 9d87edec24dd2b21f5dd49a52cff9dfd052969bd Mon Sep 17 00:00:00 2001 From: Xinhao Yuan Date: Mon, 14 Oct 2019 23:42:45 -0400 Subject: [PATCH] minor fixes; added flags to switch behaviors when moving clients with mouse --- layout.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/layout.lua b/layout.lua index 9004ae9..b9b1d99 100644 --- a/layout.lua +++ b/layout.lua @@ -11,6 +11,7 @@ local DEBUG = -1 local module = { log_level = WARNING, default_cmd = "dw66.", + allowing_shrinking_by_mouse_moving = false, } local function log(level, msg) @@ -75,7 +76,7 @@ end local function find_lu(c, regions, rd) local lu = nil for i, a in ipairs(regions) do - if rd == nil or (a.x < regions[rd].x + regions[rd].width and a.y < regions[lu].y + regions[lu].height) then + if rd == nil or (a.x < regions[rd].x + regions[rd].width and a.y < regions[rd].y + regions[rd].height) then if lu == nil or distance(c.x, c.y, a.x, a.y) < distance(c.x, c.y, regions[lu].x, regions[lu].y) then lu = i end @@ -239,12 +240,12 @@ function module.create(name, editor) hh.height = c.full_height_before_move rd = find_rd(hh, regions, lu) - if rd ~= nil and + if rd ~= nil and not module.allowing_shrinking_by_mouse_moving and (regions[rd].x + regions[rd].width - regions[lu].x < c.full_width_before_move or regions[rd].y + regions[rd].height - regions[lu].y < c.full_height_before_move) then hh.x = regions[rd].x + regions[rd].width - c.full_width_before_move hh.y = regions[rd].y + regions[rd].height - c.full_height_before_move - lu = find_lu(hh, regions) + lu = find_lu(hh, regions, rd) end else local hh = {}