naughty: Break the API (sorry) to make the signals more standard.

Most of the notification code is from 2017. Soon after being written,
the permission system started to take shape. This required to
standardize the `request::` signals into the "object, context, args"
style. The notification code wasn't merged during that refactoring
and was accidently merged without the fixes.

Since this is still unreleased, I break the API now before it is too
late. Sorry about this.
This commit is contained in:
Emmanuel Lepage Vallee 2020-02-16 02:22:34 -05:00
parent c6f617ab98
commit e12b5fb097
2 changed files with 6 additions and 4 deletions

View File

@ -284,7 +284,7 @@ local function resume()
v._private.args = nil v._private.args = nil
naughty.emit_signal("added", v, args) naughty.emit_signal("added", v, args)
naughty.emit_signal("request::display", v, args) naughty.emit_signal("request::display", v, "resume", args)
if v.timer then v.timer:start() end if v.timer then v.timer:start() end
end end
naughty.notifications.suspended = { } naughty.notifications.suspended = { }
@ -540,6 +540,7 @@ naughty.connect_signal("request::screen", naughty.default_screen_handler)
-- end) -- end)
-- --
-- @tparam table notification The `naughty.notification` object. -- @tparam table notification The `naughty.notification` object.
-- @tparam string context Why is the signal sent.
-- @tparam table args Any arguments passed to the `naughty.notify` function, -- @tparam table args Any arguments passed to the `naughty.notify` function,
-- including, but not limited to, all `naughty.notification` properties. -- including, but not limited to, all `naughty.notification` properties.
-- @signal request::display -- @signal request::display
@ -547,6 +548,7 @@ naughty.connect_signal("request::screen", naughty.default_screen_handler)
--- Emitted when a notification needs pre-display configuration. --- Emitted when a notification needs pre-display configuration.
-- --
-- @tparam table notification The `naughty.notification` object. -- @tparam table notification The `naughty.notification` object.
-- @tparam string context Why is the signal sent.
-- @tparam table args Any arguments passed to the `naughty.notify` function, -- @tparam table args Any arguments passed to the `naughty.notify` function,
-- including, but not limited to, all `naughty.notification` properties. -- including, but not limited to, all `naughty.notification` properties.
-- @signal request::preset -- @signal request::preset

View File

@ -942,13 +942,13 @@ local function create(args)
-- The rules are attached to this. -- The rules are attached to this.
if naughty._has_preset_handler then if naughty._has_preset_handler then
naughty.emit_signal("request::preset", n, args) naughty.emit_signal("request::preset", n, "new", args)
end end
-- Let all listeners handle the actual visual aspects -- Let all listeners handle the actual visual aspects
if (not n.ignore) and ((not n.preset) or n.preset.ignore ~= true) then if (not n.ignore) and ((not n.preset) or n.preset.ignore ~= true) then
naughty.emit_signal("request::display" , n, args) naughty.emit_signal("request::display" , n, "new", args)
naughty.emit_signal("request::fallback", n, args) naughty.emit_signal("request::fallback", n, "new", args)
end end
-- Because otherwise the setter logic would not be executed -- Because otherwise the setter logic would not be executed