If the amount of data coming in is more than we can hold in our
buffer, we resized the buffer by doubling its size. However, there
were two(!) issues here:
* If this was the first resize, the buffer size was set to 1024. This
may not be enough (i.e. there may be more than 1024 bytes to process).
* In all other cases, the buffer size was doubled. However, there is
still no guarantee the buffer is large enough.
Fix by looping until the buffer *is* large enough.
This ensures the bar's size (width) is updated when the screen
resolution (and/or scale) is changed.
Note that we already handled scale changes. This logic has been moved
from output_scale() to output_done().
Closes#330
If the surface enters an output, there's no need for
last_mapped_monitor, and it must be reset to fulfill the asserts in
other parts of the code.
This makes yambar no longer crash when it is hidden by an opaque window
multiple times on a compositor using wlroots' scene tree.
MFD_NOEXEC_SEAL is only supported on kernels 6.3 and later.
If we were compiled on linux >= 6.3, but run on linux < 6.3, we'd exit
with an error, due to memfd_create() failing with EINVAL.
This patch fixes the problem by first trying to call
memfd_create() *with* MFD_NOEXEC_SEAL, and if that fails with EINVAL,
we try again without it.
Flex regexps are greedy.
This means '"foo" || "bar"' will return 'foo" || "bar', which is
obviously wrong.
Use "start conditions" to implement non-greedy matching.
Closes#302
Fixes the following compiler warning/error:
In file included from /usr/include/stdio.h:906,
from ../tag.c:6:
In function ‘snprintf’,
inlined from ‘tags_expand_template’ at ../tag.c:708:13:
/usr/include/bits/stdio2.h:54:10: error: ‘fmt’ may be used uninitialized [-Werror=maybe-uninitialized]
54 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
../tag.c: In function ‘tags_expand_template’:
../tag.c:677:25: note: ‘fmt’ was declared here
677 | const char *fmt;
| ^~~
cc1: all warnings being treated as errors
Closes#311
We now do tilde expansion of the *first* argument in on-click
handlers.
That is:
~/bin/foobar.sh ~/arg1
is expanded to
$HOME/bin/foobar.sh ~/arg1
(meaning, the handler will most likely *not* do what you’d expect)
Related to #307
We may receive udev notifications for the power-supply subsystem, that
aren’t for us.
Before this patch, this would result in a new poll() call, with
timeout being set to m->poll_interval again. That is, the poll timeout
was being reset.
In theory, this means we could end up in a situation where the battery
status is never updated.
This patch fixes it by tracking how much time is left of the poll
interval. The interval is reset either when the timeout has occurred,
or when we receive an udev notification that _is_ for us.
Hopefully closes#305
The kernel also provides time_to_full, also in seconds, so let's use
that too. Both time_to_empty and time_to_full have 0 as their default
value, hence only consider them for the estimate if they are
positive (instead of non-negative).
Signed-off-by: David Bimmler <git@d4ve.email>
The kernel docs state that time_to_empty contains the estimation of
remaining time in seconds. Hence, calculate estimate minutes and hours
from that in a more correct way.
Signed-off-by: David Bimmler <git@d4ve.email>