doc fixes for awful.mouse.resize, awful.rules, awful.util (#1717)

This commit is contained in:
Daniel Hahler 2017-04-10 21:57:12 +02:00 committed by GitHub
parent 639d6decb4
commit a87387d9f3
3 changed files with 19 additions and 23 deletions

View File

@ -89,7 +89,7 @@ function module.add_leave_callback(cb, context)
table.insert(callbacks.leave[context], cb) table.insert(callbacks.leave[context], cb)
end end
-- Resize, the drawable. --- Resize the drawable.
-- --
-- Valid `args` are: -- Valid `args` are:
-- --
@ -99,9 +99,9 @@ end
-- * *mode*: The resize mode. -- * *mode*: The resize mode.
-- --
-- @function awful.mouse.resize -- @function awful.mouse.resize
-- @tparam client client A client -- @tparam client client A client.
-- @tparam[default=mouse.resize] string context The resizing context -- @tparam[default=mouse.resize] string context The resizing context.
-- @tparam[opt={}] table args A set of `awful.placement` arguments -- @tparam[opt={}] table args A set of `awful.placement` arguments.
local function handler(_, client, context, args) --luacheck: no unused_args local function handler(_, client, context, args) --luacheck: no unused_args
args = args or {} args = args or {}
@ -156,7 +156,7 @@ local function handler(_, client, context, args) --luacheck: no unused_args
capi.mousegrabber.run(function (_mouse) capi.mousegrabber.run(function (_mouse)
if not client.valid then return end if not client.valid then return end
-- Resize everytime the mouse move (default behavior) -- Resize everytime the mouse moves (default behavior).
if args.mode == "live" then if args.mode == "live" then
-- Get the new geometry -- Get the new geometry
geo = setmetatable(args.placement(client, args), {__index=args}) geo = setmetatable(args.placement(client, args), {__index=args})
@ -194,8 +194,8 @@ local function handler(_, client, context, args) --luacheck: no unused_args
if v then return true end if v then return true end
end end
-- Only resize after the mouse is released, this avoid losing content -- Only resize after the mouse is released, this avoids losing content
-- in resize sensitive apps such as XTerm or allow external modules -- in resize sensitive apps such as XTerm or allows external modules
-- to implement custom resizing. -- to implement custom resizing.
if args.mode == "after" then if args.mode == "after" then
-- Get the new geometry -- Get the new geometry

View File

@ -457,28 +457,26 @@ function rules.execute(c, props, callbacks)
end end
-- Some properties need to be handled first. For example, many properties -- Some properties need to be handled first. For example, many properties
-- depend that the client is tagged, this isn't yet the case. -- require that the client is tagged, this isn't yet the case.
for prop, handler in pairs(rules.high_priority_properties) do for prop, handler in pairs(rules.high_priority_properties) do
local value = props[prop] local value = props[prop]
if value ~= nil then if value ~= nil then
if type(value) == "function" then if type(value) == "function" then
value = value(c, props) value = value(c, props)
end end
handler(c, value, props) handler(c, value, props)
end end
end end
-- Make sure the tag is selected before the main rules are called. -- Make sure the tag is selected before the main rules are called.
-- Otherwise properties like "urgent" or "focus" may fail because they -- Otherwise properties like "urgent" or "focus" may fail (if they were
-- will be overiden by various callbacks. -- overridden by other callbacks).
-- Previously, this was done in a second client.manage callback, but caused -- Previously this was done in a second client.manage callback, but caused
-- a race condition where the order the require() would change the output. -- a race condition where the order of modules being loaded would change
-- the outcome.
c:emit_signal("request::tag", nil, {reason="rules"}) c:emit_signal("request::tag", nil, {reason="rules"})
-- By default, rc.lua use no_overlap+no_offscreen placement. This has to -- By default, rc.lua uses no_overlap+no_offscreen placement. This has to
-- be executed before x/y/width/height/geometry as it would otherwise -- be executed before x/y/width/height/geometry as it would otherwise
-- always override the user specified position with the default rule. -- always override the user specified position with the default rule.
if props.placement then if props.placement then
@ -486,13 +484,12 @@ function rules.execute(c, props, callbacks)
rules.extra_properties.placement(c, props.placement, props) rules.extra_properties.placement(c, props.placement, props)
end end
-- Now that the tags and screen are set, handle the geometry -- Handle the geometry (since tags and screen are set).
if props.height or props.width or props.x or props.y or props.geometry then if props.height or props.width or props.x or props.y or props.geometry then
rules.extra_properties.geometry(c, nil, props) rules.extra_properties.geometry(c, nil, props)
end end
-- As most race conditions should now have been avoided, apply the remaining -- Apply the remaining properties (after known race conditions are handled).
-- properties.
for property, value in pairs(props) do for property, value in pairs(props) do
if property ~= "focus" and type(value) == "function" then if property ~= "focus" and type(value) == "function" then
value = value(c, props) value = value(c, props)
@ -523,12 +520,10 @@ function rules.execute(c, props, callbacks)
for prop, handler in pairs(rules.delayed_properties) do for prop, handler in pairs(rules.delayed_properties) do
if not force_ignore[prop] then if not force_ignore[prop] then
local value = props[prop] local value = props[prop]
if value ~= nil then if value ~= nil then
if type(value) == "function" then if type(value) == "function" then
value = value(c, props) value = value(c, props)
end end
handler(c, value, props) handler(c, value, props)
end end
end end

View File

@ -37,7 +37,8 @@ util.shell = os.getenv("SHELL") or "/bin/sh"
-- @deprecated deprecate -- @deprecated deprecate
-- @param[opt] see The message to a new method / function to use. -- @param[opt] see The message to a new method / function to use.
-- @tparam table args Extra arguments -- @tparam table args Extra arguments
-- @tparam boolean args.raw Print the message as-is without the automatic context -- @tparam boolean args.raw Print the message as-is without the automatic
-- context (but only append a leading dot).
-- @tparam integer args.deprecated_in Print the message only when Awesome's -- @tparam integer args.deprecated_in Print the message only when Awesome's
-- version is equal to or greater than deprecated_in. -- version is equal to or greater than deprecated_in.
-- @see gears.debug -- @see gears.debug