mouse: only reserve "docking space" along the largest dimension of the window.
- This avoids a nasty issue with fullheight toolbars. Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
fdee06fe31
commit
93386ff08f
|
@ -64,22 +64,29 @@ local function snap_outside(g, sg, snap)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function snap_inside(g, sg, snap)
|
local function snap_inside(g, sg, snap)
|
||||||
local edge = "none"
|
local edgev = 'none'
|
||||||
|
local edgeh = 'none'
|
||||||
if math.abs(g.x) < snap + sg.x and g.x > sg.x then
|
if math.abs(g.x) < snap + sg.x and g.x > sg.x then
|
||||||
edge = "left"
|
edgev = 'left'
|
||||||
g.x = sg.x
|
g.x = sg.x
|
||||||
elseif math.abs((sg.x + sg.width) - (g.x + g.width)) < snap then
|
elseif math.abs((sg.x + sg.width) - (g.x + g.width)) < snap then
|
||||||
edge = "right"
|
edgev = 'right'
|
||||||
g.x = sg.x + sg.width - g.width
|
g.x = sg.x + sg.width - g.width
|
||||||
end
|
end
|
||||||
if math.abs(g.y) < snap + sg.y and g.y > sg.y then
|
if math.abs(g.y) < snap + sg.y and g.y > sg.y then
|
||||||
edge = "top"
|
edgeh = 'top'
|
||||||
g.y = sg.y
|
g.y = sg.y
|
||||||
elseif math.abs((sg.y + sg.height) - (g.y + g.height)) < snap then
|
elseif math.abs((sg.y + sg.height) - (g.y + g.height)) < snap then
|
||||||
edge = "bottom"
|
edgeh = 'bottom'
|
||||||
g.y = sg.y + sg.height - g.height
|
g.y = sg.y + sg.height - g.height
|
||||||
end
|
end
|
||||||
return g, edge
|
|
||||||
|
-- What is the dominant dimension?
|
||||||
|
if g.width > g.height then
|
||||||
|
return g, edgeh
|
||||||
|
else
|
||||||
|
return g, edgev
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Snap a client to the closest client or screen edge.
|
--- Snap a client to the closest client or screen edge.
|
||||||
|
|
Loading…
Reference in New Issue