This is similar to #3820 but does not use qsort but an insertion sort in
con_attach.
Since each bar block automatically gets its own incremental bar id,
bards end up being sorted according to their definition order in the
config file.
For i3bar, the WM_CLASS is modified to include an instance name which
depends on the bar_id. This could be useful for other reason, e.g. users
targeting a specific bar instance.
Fixes#3491
* clang-format: bring back ForeachMacros
ForeachMacros was disabled in 4211274fcd
due to the breakage of include/queue.h. The currently used version,
clang-format-6.0 doesn't break it.
* Add curly braces
Co-authored-by: Orestis Floros <orestisflo@gmail.com>
- Having both parse_configuration and parse_file is excessive now
- We detect if we are parsing only by checking if conn is NULL, not with
use_nagbar
- font.pattern needs to be set to NULL because it is freed in
free_font()
Fixes#3660
Fixes for undefined behaviour on signed shift
Change literal 1 to unsigned to allow safe bitshift of 31.
Caught by cppcheck.
Make 0xFF unsigned to prevent a left shift into signed bit.
Spotted by @orestisf1993
copy has been used before this point - so it is too late to be concerned
about a NULL pointer now.
This is OK as sstrdup() calls err() on NULL return from the underlying
strdup() call.
Raised by cppcheck.
strlen already assumes that the string is NULL-terminated.
Like in https://github.com/i3/i3status/pull/312 but for whatever reason
gcc didn't warn about this here.
These are the changes that clang-format 6.0.1 makes to the codebase that
clang-format-3.8 doesn't change back.
Useful for those that use a more recent version of clang-format in their
local machines.
This change only affects clients that are subscribed to events, which
should be the main cause of our problems.
In the common case (no buffered data) the behaviour doesn't change at
all: the message is sent directly, no ev_io / ev_timeout callback is
enabled. Once a write to a client's socket is not completed fully
(returns with EAGAIN error), we put the message in the tail of a queue
and init an ev_io callback and a corresponding timer. If the timer is
triggered first, the socket is closed and the client connection is
removed. If the socket becomes writeable before the timeout we either
reset the timer if we couldn't push all the buffered data or completely
remove it if everything was pushed.
We could also replace ipc_send_message() for all client connections in
i3, not just those subscribed to events.
Furthermore, we could limit the amount of messages stored and increase
the timeout (or use multiple timeouts): eg it's ok if a client is not
reading for 10 seconds and we are only holding 5KB of messages for them
but it is not ok if they are inactive for 5 seconds and we have 30MB of
messages held.
Closes#2999Closes#2539
Using 'default:' cases can hide logical errors which would lead to i3
crashes for users. With this change the compiler will print a warning
when a case is not handled. For example, if I add a new value in the
Font.type enum:
../../i3/libi3/font.c: In function ‘draw_text’:
../../i3/libi3/font.c:378:5: warning: enumeration value ‘NEWFONT’ not handled in switch [-Wswitch]
switch (savedFont->type) {
^~~~~~
For opaque text, SOURCE is not any different from OVER. However, when
drawing color glyphs (which consist of RGBA pixels instead of strokes)
SOURCE's handling of alpha is not what we want.
I stumbled across this because cairo 1.15.8 seems to clear the surface
before drawing color emoji if the operator is SOURCE, deleting every-
thing drawn before. Arguably, the area outside the glyph bounds should
not be touched, but even if this is a cairo bug the problem of alpha
within the glyph remains.
If conn == NULL or display == NULL, init_dpi() jumps to init_dpi_end
before (declaring and) initializing resource. In init_dpi_end, there
is a free(resource) call conditionally on resource != NULL, so this
may lead to a bogus free. Found by clang -Wsometimes-uninitialized.