awful.mouse.move: Fix snapping support
This commit is contained in:
parent
86ca6222e2
commit
baec2efe2d
|
@ -84,7 +84,11 @@ function mouse.client.move(c, snap, finished_cb) --luacheck: no unused args
|
||||||
y = geo.y - coords.y,
|
y = geo.y - coords.y,
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse.resize(c, "mouse.move", {placement=aplace.under_mouse, offset=offset})
|
mouse.resize(c, "mouse.move", {
|
||||||
|
placement = aplace.under_mouse,
|
||||||
|
offset = offset,
|
||||||
|
snap = snap
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
mouse.client.dragtotag = { }
|
mouse.client.dragtotag = { }
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
local aclient = require("awful.client")
|
local aclient = require("awful.client")
|
||||||
|
local resize = require("awful.mouse.resize")
|
||||||
|
|
||||||
local capi = {
|
local capi = {
|
||||||
root = root,
|
root = root,
|
||||||
|
@ -121,5 +122,15 @@ function module.snap(c, snap, x, y, fixed_x, fixed_y)
|
||||||
return geom
|
return geom
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Enable edge snapping
|
||||||
|
resize.add_move_callback(function(c, geo, args)
|
||||||
|
if args and (args.snap == nil or args.snap) then
|
||||||
|
local ngeo = module.snap(c, args.snap, geo.x, geo.y)
|
||||||
|
ngeo.x = ngeo.x + (2 * c.border_width)
|
||||||
|
ngeo.y = ngeo.y + (2 * c.border_width)
|
||||||
|
return ngeo
|
||||||
|
end
|
||||||
|
end, "mouse.move")
|
||||||
|
|
||||||
return setmetatable(module, {__call = function(_, ...) return module.snap(...) end})
|
return setmetatable(module, {__call = function(_, ...) return module.snap(...) end})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue