Instead of creating a graphics context for every surface_t, this commit
adds a cache that allows to "remember" up to two GCs. Thus, the code
uses less GCs. When a GC from the cache can be used, this also gets rid
of a round-trip to the X11 server. Both of these are tiny, insignificant
savings, but so what?
Since GCs are per-depth, this code needs access to get_visual_depth().
To avoid a code duplication, this function is moved to libi3.
Fixes: https://github.com/i3/i3/issues/3478
Signed-off-by: Uli Schlachter <psychon@znc.in>
Unfortunately, grabbing / ungrabbing doesn't seem to work correctly in
xvfb so we can't really test this.
I also fixed the deduplication code in bindings_get_buttons_to_grab().
Having just a single fork is beneficial, as it preserves the approprate
parent information for the children of i3, which is useful in some
scenarious e.g. when a child wants to do something on the wm's exit
(possible via `prctl(PR_SET_PDEATHSIG, ...)`).
Moreover, this is a zero-cost benefit: i3 is already using libev with
the default loop, which automatically reaps all the zombie children even
when there is no corresponding event set.
Resolves#5506
Also updates the function to use proper types, const and style.
The warning:
../i3/i3-input/main.c: In function ‘finish_input’:
../i3/i3-input/main.c:187:13: warning: ‘__builtin_strncat’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
187 | strncat(dest, command, inputlen);
| ^
../i3/i3-input/main.c:175:20: note: length computed here
175 | int inputlen = strlen(command);
Which is triggered because gcc thinks it's bad that `input_len` (the
length of the source in the copy) is used instead of a length that is
inside the limits of the allocated size for the destination. However, in
practice, `full_len` is always than `input_len`.
They are newly failing since the previous commit (upgrading to Ubuntu focal),
so instead of debugging what the issue is, let’s just remove them entirely.
Not many i386 users are left, as the world is on amd64 and arm64 these days.
We use run_command for conditionals, meaning meson execution should not stop
when the command returns false. This change keeps our meson setup working
throughout the upcoming change of default behavior (check: true).
This requires --buildtype=debugoptimized (or --buildtype=release, but
optimizations need to be enabled), and will allow us to keep the i3 build free
of warnings during development.
Distributions like Debian build with -D_FORTIFY_SOURCE=2.
Unlike in the man page, only one --entry-type is reasonable possible.
On using multiple --entry-types and a command offers multiple, duplicates are removed i3-dmenu-desktop.
See more at #5291
added --show-duplicates flag for this