Age | Commit message (Collapse) | Author |
|
`gcc-14` added a new `-Walloc-size` warning that makes sure that size of
an individual element matches size of a pointed type:
https://gcc.gnu.org/PR71219
`sway` triggers it on `calloc()` calls where member size is used as
`1` (instead of member count):
swaynag/config.c:169:65: error: allocation of insufficient size '1'
for type 'struct swaynag_button' with size '48' [-Werror=alloc-size]
169 | struct swaynag_button *button = calloc(sizeof(struct swaynag_button), 1);
|
|
And fix the fallout of the swaynag_destroy having evolved without
being tested:
* wl_display_disconnect was called too early
* `button_close` and `swaynag.details.button_details` needed to be
heap allocated, since they are added to swaynag.buttons, and all
entries of swaynag.buttons are freed in swaynag_destroy
* To keep things simpler, disconnect the lifetime of the 'Toggle details'
button text config setting from the button itself.
|
|
It's too easy to have this go out of sync with font_description.
|
|
Avoids parsing the configured font each time text is rendered.
|
|
|
|
|
|
read_from_stdin not only read from stdin, but trimming trailing
newlines, so rename it to reflect this.
|
|
They are used together, so it doesn't make sense to allocate them
separately.
|
|
|
|
Replace them with snprintf, which ensures buffer overflows won't
happen.
|
|
Uses --layer/-y set to overlay|top|bottom|background
|
|
|
|
|
|
Adds a new config option for details background for swaynag
issue/#5673
|
|
|
|
I don't love -z / -Z, but I figure this patch is far from being
accepted for other reasons too.
|
|
This is the first in a series of commits to refactor the color handling
in sway. This changes parse_color to return whether it was success and
no longer uses 0xFFFFFFFF as the fallback color. This also verifies that
the string actually contains a valid hexadecimal number along with
the length checks.
In the process of altering the calls to parse_color, I also took the
opportunity to heavily refactor swaybar's ipc_parse_colors function.
This allowed for several lines of duplicated code to be removed.
|
|
This revamps the type configs for swaynag. All sizing attributes for
swaynag are now `ssize_t` instead of `uint32_t` to allow for a default
value of `-1`, which allows for `0` to be a valid value. Additionally,
the initialization of the type configs has been changed from a simple
calloc to use a new function `swaynag_type_new`. `swaynag_type_new`
calloc's the memory, checks for an allocation failure, sets the name,
and all sizes to -1. The layering order has also been changed to
default, general config, type config, and as highest priority command
line arguments. Finally, `swaynag_type_merge` has been modified to
handle the layering and sizing changes.
|
|
When swaynag is run with the -l/--detailed-message option, a crash may
occur if the detailed message read from stdin is large enough. E.g.:
swaynag -m hello -l < ~/.config/sway/config
The root cause is that the read_from_stdin() function under-allocates
memory for the destination buffer which causes that buffer to be overflowed
when copying line data to it with snprintf().
The repair is to allocate one more byte for the terminating null byte.
N.B. although getline() returns the number of bytes read excluding a
terminating null byte, the line buffer is terminated with a null byte. Thus
we have a guarantee that the line buffer will be null terminated (which is
important when copying with snprintf()).
|
|
Now that swaynag uses getline (instead of the old readline), the
trailing newline characters have to be removed when reading the config
|
|
|
|
|
|
|
|
Set config path to fallback instead of setting $XDG_CONFIG_HOME
|
|
All occurrences of read_line have been replaced by getline.
peek_line has been absorbed into detect_brace.
|
|
In `i3 4.16`, `i3-nagbar` introduces the flags `-B/--button-no-terminal`
to run the action directly instead of inside a terminal. This implements
the flags for swaynag for compatibility.
Since swaynag does not use an equivalent to `i3-sensible-terminal`, the
flags `-b/--button` only uses a terminal when the environment variable
`TERMINAL` is set, otherwise it acts the same as these new flags.
|
|
And make sure we don't define both in the same source file.
|
|
If they really do not take undefined number of arguments.
|
|
|
|
|
|
|
|
|
|
|