Setting the title ultimately leads to a call to
xdg_toplevel::set_title(). It is a protocol violation to try to set a
title that contains an invalid UTF-8 sequence:
The string must be encoded in UTF-8.
Closes#1552
To enable 8-bit meta mode, we need to:
* disable "send ESC when meta modifies a key" (private mode 1036)
* enable "8-bit meta mode" (private mode 1034)
rmm reverses the above.
Closes#1584
For the purpose of matching key bindings, "significant" modifiers are
no more.
We're really only interested in filtering out "locked"
modifiers. We're already doing this, so there's no need to *also*
match against a set of "significant" modifiers.
Furthermore, we *never* want to consider locked keys (e.g. when
emitting escapes to the client application), thus we can filter those
out already when retrieving the set of active modifiers.
The exception is the kitty keyboard protocol, which has support for
CapsLock and NumLock. Since we're already re-retrieving the "consumed"
modifiers (using the GTK style, rather than normal "XKB" style, to
better match the kitty terminal), we might as well re-retrieve the
effective modifiers as well.
That is, allow custom modifiers (i.e. other than ctrl/shift/alt etc)
in key bindings.
This is done by no longer validating/translating modifier names to
booleans for a pre-configured set of modifiers (ctrl, shift, alt,
super).
Instead, we keep the modifier *names* in a list, in the key binding
struct.
When a keymap is loaded, and we "convert" the key binding, _then_ we
do modifier translation. For invalid modifier names, we print an
error, and then ignore it. I.e. we no longer fail to load a config due
to invalid modifier names.
We also need to update how we determine the set of significant
modifiers. Any modifier not in this list will be ignored when matching
key bindings.
Before this patch, we hardcoded this to shift/alt/ctrl/super. Now, to
handle custom modifiers as well, we simply treat *all* modifiers
defined by the current layout as significant.
Typically, the only unwanted modifiers are "locked" modifiers. We are
already filtering these out.
Starting with kitty 0.32.0, the modifier bits during modifier key
events behave differently, compared to before. Or, rather, they have
now been spec:ed; before, behavior was different on e.g. MacOS, and
Linux.
The new behavior is this:
On key press, the modifier bits in the kitty key event *includes* the
pressed modifier key.
On key release, the modifier bits in the kitty key event does *not*
include the released modifier key.
In other words, The modifier bits reflects the state *after* the key
event.
This is the exact opposite of what foot did before this patch.
The patch is really pretty small: in order to include the key in the
modifier set, we simulate a key press to update the XKB state, using
xkb_state_uppate_key(). For key pressed, we simulate an XKB_KEY_DOWN
event, and for key releases we simulate an XKB_KEY_UP event.
Then we re-retrieve the modifers, both the full set, and the consumed
set.
Closes#1561
```
../slave.c: In function 'slave_spawn':
../slave.c:441:21: error: 'custom_envp' undeclared (first use in this function); did you mean 'custom_env'?
441 | add_to_env(&custom_envp, "TERMINFO", FOOT_TERMINFO_PATH);
| ^~~~~~~~~~~
| custom_env
../slave.c:441:21: note: each undeclared identifier is reported only once for each function it appears in
```
When launching footclient with -E,--client-environment the environment
variables that should be set by foot, wasn't.
Those variables are:
* TERM
* COLORTERM
* PWD
* SHELL
and all variables defined by the user in the [environment] section in
foot.ini.
In the same way, we did not *unset* TERM_PROGRAM and
TERM_PROGRAM_VERSION.
This patch fixes it by "cloning" the custom environment, making it
mutable, and then adding/removing the variables above from it.
Instead of calling setenv()/unsetenv() directly, we add the wrapper
functions add_to_env() and del_from_env().
When *not* using a custom environment, they simply call
setenv()/unsetenv().
When we *are* using a custom environment, add_to_env() first loops all
existing variables, looking for a match. If a match is found, it's
updated with the new value. If it's not found, a new entry is added.
del_from_env() loops all entries, and removes it when a match is
found. If no match is found, nothing is done.
The mutable environment is allocated on the heap, but never free:d. We
don't need to free it, since it's only allocated after forking, in the
child process.
Closes#1568
When cloning a config struct, the env_vars tllist wasn't correctly
copied. We did correctly iterate and duplicate all old entries, but we
did *not* reset the list in the cloned struct before doing so.
This meant the list contained entries shared with the original list,
causing double free:s in --server mode.
764248bb0d modified
wayl_surface_scale_explicit_width_height() to not assert the surface
size is valid for the given scaling factor. This, since that function
is only used when scaling a mouse pointer surface.
However, that commit only updated the code path run when fractional
scaling is available (i.e. when the compositor implements the
fractional-scale-v1 protocol).
The legacy code path, that does integer scaling, was still asserting
the surface width/height were divisible with the scaling factor.
For the same reasons this isn't true with fractional scaling
available, it's not true with integer scaling. Fix by skipping the
assertions.
This patch also converts the assertions to more verbose BUG() calls,
that prints more information on the numbers involved.
Closes#1573
It's not critical.
Fixes
../slave.c: In function ‘slave_spawn’:
../slave.c:410:9: error: ignoring return value of ‘chdir’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
410 | chdir("/");
| ^~~~~~~~~~
With this patch, the terminal process now changes PWD to / after
spawning the client application.
This ensures the terminal process itself does not "lock" a
directory. For example, we may keep a mount point from being
unmounted.
Closes#1528
conf file descriptor is closed once again during cleanup at the end of
config_load() if descriptor >= 0. avoid double closing by assigning
negative value to fd after first close.
by the time second close happens some other descriptor might be opened
reusing previous number ie it might happen during foot server startup
when syslog message is logged between one close and the other. in this
particular situation, as of this writing, it considers fd=3 for which
following events apply:
1. conf file is opened and fclosed()
2. warning is logged with syslog which leads to opening socket to
/dev/log which is kept open by glibc (gets fd=3)
3. second close during config_load() closes /dev/log socket descriptor
4. epoll_create() in fdm.c reuses fd=3 again
5. another message is being logged with syslog. glibc notices sendto()
failure on saved /dev/log descriptor hence it closes it and opens
new one
Due to epoll descriptor closure foot starts a chain of errors that
lead to startup failure.
Fixes#1531
Reject color values that aren't in either RGB, or ARGB format. That
is, color values that aren't hexadecimal numbers with either 6 or 8
digits.
Also, if a color value is allowed to have an alpha component, and the
user left it out, default to 0xff (opaque) rather than 0x00 (fully
transparent).
Closes#1526