unicode-mode: move state from seat to term

This fixes an issue where entering unicode-mode in one foot client,
also enabled unicode-mode on other foot clients. Both
visually (although glitchy), and in effect.

The reason the state was originally in the seat objects, was to fully
support multi-seat. That is, one seat/keyboard entering unicode-mode
should not affect other seats/keyboards.

The issue with this is that seat objects are Wayland global. Thus, in
server mode, all seat objects are shared between the foot clients.

There is a similarity with IME, which also keeps state in the
seat. There's one big difference, however, and that is IME has Wayland
native enter/leave events, that the compositor emits when windows are
focused/unfocused. These events allow us to reset IME state. For our
own Unicode mode, there is nothing similar.

This patch moves the Unicode state from seats, to the terminal
struct. This does mean that if one seat/keyboard enters Unicode mode,
then *all* seats/keyboards will affect the unicode state. This
potential downside is outweighed by the fact that different foot
clients no longer affect each other.

Closes #1717
This commit is contained in:
Daniel Eklöf 2024-05-21 07:06:45 +02:00
parent cf65ad49e8
commit 18b702b249
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
8 changed files with 42 additions and 49 deletions

View file

@ -719,6 +719,12 @@ struct terminal {
bool ime_enabled;
#endif
struct {
bool active;
int count;
char32_t character;
} unicode_mode;
struct {
bool in_progress;
bool client_has_terminated;