mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-05 07:15:30 -04:00
input: improve behavior when sway bugs out
When we receive a keyboard_key or pointer_motion event without first having received a keyboard_enter or pointer_enter event (that being the "sway bugs" part), we generally don't know _which_ terminal window the event was intended for. However, if we only have *one* window open (always the case for a regular 'foot' process, or when there's a single footclient connected to a foot server process), then obviously we can "guess" which window the event was intended for... so do that. Now, the only time the event is ignored is when we're a server process with more than one window open (= more than one footclient connected).
This commit is contained in:
parent
937fd6933b
commit
1a68a7cf0b
1 changed files with 17 additions and 3 deletions
20
input.c
20
input.c
|
|
@ -161,8 +161,15 @@ keyboard_key(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
|
||||||
have_warned = true;
|
have_warned = true;
|
||||||
LOG_WARN("compositor sent keyboard_key event without first sending keyboard_enter");
|
LOG_WARN("compositor sent keyboard_key event without first sending keyboard_enter");
|
||||||
}
|
}
|
||||||
stop_repeater(wayl, -1);
|
|
||||||
return;
|
if (tll_length(wayl->terms) == 1) {
|
||||||
|
/* With only one terminal we *know* which one has focus */
|
||||||
|
term = tll_front(wayl->terms);
|
||||||
|
} else {
|
||||||
|
/* But with multiple windows we can't guess - ignore the event */
|
||||||
|
stop_repeater(wayl, -1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(term != NULL);
|
assert(term != NULL);
|
||||||
|
|
@ -441,7 +448,14 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
|
||||||
have_warned = true;
|
have_warned = true;
|
||||||
LOG_WARN("compositor sent pointer_motion event without first sending pointer_enter");
|
LOG_WARN("compositor sent pointer_motion event without first sending pointer_enter");
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
|
if (tll_length(wayl->terms) == 1) {
|
||||||
|
/* With only one terminal we *know* which one has focus */
|
||||||
|
term = tll_front(wayl->terms);
|
||||||
|
} else {
|
||||||
|
/* But with multiple windows we can't guess - ignore the event */
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(term != NULL);
|
assert(term != NULL);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue