This way their name doesn't get mangle by the broken magic. It will also
eventually allow to `error()` in the template when the implicit
`@function` is used.
This commit also fixes a large number of issues found while
proof-reading everything.
ldoc has a magical `@classmod` module type which tries to detect
what is a method and what is a static function. It fails about as
often as it works. This commit makes everything explicit to remove
such issues.
Fixes#2640
Ref #1373
* naughty.legacy: Fix a regression caused by a prior fix.
The title was only set "later" because it was called too early.
The intended result was to prevent the code from being executed when
there is no leagcy popup, but it had this side effect.
* naughty.dbus: Expose the new "private" methods so they can be tested.
Because it now uses Gio instead of capi.dbus, it isn't possible to
just shim the backend anymore.
* shims: Upgrade the dbus shims to also emulate some Gio behavior.
As usual, it is the most basic version that produces the correct
result. It doesn't try to comply to the real API.
LGI truncates GVariant bytestring instances at the first embedded \0
byte when using .value for "unwrapping". This commit works around that
problem by avoiding the .value API for accessing the image data [0].
Thanks a lot to Will Dietz for finding this problem and for providing a
preliminary patch fixing the problem. That saved me a lot of time [1].
[0]: https://github.com/pavouk/lgi/pull/223
[1]: eecdeb7d46
Signed-off-by: Uli Schlachter <psychon@znc.in>
This starts the switch from our own, semi-broken DBus bindings to using
the sane bindings that Gio provides.
Part-of: https://github.com/awesomeWM/awesome/issues/1093
Signed-off-by: Uli Schlachter <psychon@znc.in>
When you call `reset_timeout` on a notification with 0 timeout and thus no timer, a nil field error occures.
(can be tested with `awesome-client 'require"naughty".notification{message="TEST",timeout=0}:reset_timeout()'`)
Everywhere else in similar places (even at the beginning of the `reset_timeout`) the `self.timer` field is checked so i guess it was just forgotten there.
Previously, it would create a new object. The leaves the old
`replaces_id` logic mostly intact for now to keep the full backward
compatibility. I don't think anybody would have noticed the changed, by
time and time again we had proof that some silent users have some
amazing and advanced code hidden somewhere. It could be cleaned later
when breaking compatibility isn't an issue.
When the mouse is over or a keyboard driven menu is open, avoid
unexpected expiration to mess with the current notifications.
This commit also improve the `suspended` behavior to correctly
emit some signals.
The current API is non-compliant with the 1.0 spec and cannot represent
the v1.2 spec at all. The pair of name and callback fails to represent
the explicit ordering and cannot support the icons cleanly.
Plus to support the keyboard navigation use case, the notification
action need to be able to get some sort of focus state. Having an
object makes this easy.
When mangling notifications via naughty.config.notify_callback it is
advised (1) to return nil to reject a notification. The underlaying dbus
library tries to access a field of that notification table and fails.
(1) https://awesomewm.org/doc/api/libraries/naughty.html
When an icon is sent over dbus, we turn this into a cairo ImageSurface.
This is done by turning the actual icon data into a string and using
cairo.ImageSurface.create_for_data() to create a surface for this data.
However, this function only creates an ImageSurface that refers to this
data. It does not copy the data. Thus, when the Lua GC later frees the
string, we have a cairo surface that refers to already-freed data.
Fix this by duplicating the cairo surface, which makes cairo create a
copy of the data. Then, we finish the original surface. While doing
this, the string is kept alive in a local variable.
(Possibly) Fixes: https://github.com/awesomeWM/awesome/issues/2361
Signed-off-by: Uli Schlachter <psychon@znc.in>
* Add support for resizing notification icon with respect to aspect
Previously, if an icon was not exactly square, an icon size set in configuration
would cause the notification to pad the icon with empty space so dimensions are
equal.
Now behaviour is different: the bigger dimension of the icon is scaled to fit
the icon_size value, while smaller is scaled same amount to preserve aspect.
Also, ImageSurface is now not created as fixed size square, but it's dimensions
are computed in similar way.
* Round the computed dimensions of ImageSurface
Even one pixel off is still off.
This fixes a regression introduced in be29ee6768. This commit changed
naughty to reuse an already-existing wibox when replaces_id is used,
instead of creating a new wibox. However, some of the properties that
are set only when creating a wibox were ignored due to this.
Fixes: https://github.com/awesomeWM/awesome/issues/2040
Signed-off-by: Uli Schlachter <psychon@znc.in>