awful.mouse.snap: Add a configurable default distance
This commit is contained in:
parent
2624370cc0
commit
86ca6222e2
|
@ -32,6 +32,11 @@ local mouse = {
|
|||
mouse.client = {}
|
||||
mouse.wibox = {}
|
||||
|
||||
--- The default snap distance.
|
||||
-- @tfield integer awful.mouse.snap.default_distance
|
||||
-- @tparam[opt=8] integer default_distance
|
||||
-- @see awful.mouse.snap
|
||||
|
||||
--- Get the client object under the pointer.
|
||||
-- @return The client object under the pointer, if one can be found.
|
||||
function mouse.client_under_pointer()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
-- @author Julien Danjou <julien@danjou.info>
|
||||
-- @copyright 2008 Julien Danjou
|
||||
-- @release @AWESOME_VERSION@
|
||||
-- @submodule awful.mouse.snap
|
||||
-- @submodule awful.mouse
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
local aclient = require("awful.client")
|
||||
|
@ -17,7 +17,9 @@ local capi = {
|
|||
mousegrabber = mousegrabber,
|
||||
}
|
||||
|
||||
local module = {}
|
||||
local module = {
|
||||
default_distance = 8
|
||||
}
|
||||
|
||||
local function snap_outside(g, sg, snap)
|
||||
if g.x < snap + sg.x + sg.width and g.x > sg.x + sg.width then
|
||||
|
@ -67,7 +69,7 @@ end
|
|||
-- @param fixed_x True if the client isn't allowed to move in the x direction.
|
||||
-- @param fixed_y True if the client isn't allowed to move in the y direction.
|
||||
function module.snap(c, snap, x, y, fixed_x, fixed_y)
|
||||
snap = snap or 8
|
||||
snap = snap or module.default_distance
|
||||
c = c or capi.client.focus
|
||||
local cur_geom = c:geometry()
|
||||
local geom = c:geometry()
|
||||
|
|
Loading…
Reference in New Issue