mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-03 07:15:29 -04:00
input: pointer_button: apply same workaround as in pointer_motion
Sway 1.2 has been seen to send pointer_button events without first having sent pointer_enter.
This commit is contained in:
parent
9efa28b4c6
commit
729ba8b8ac
1 changed files with 18 additions and 1 deletions
19
input.c
19
input.c
|
|
@ -505,8 +505,25 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
|
||||||
|
|
||||||
struct wayland *wayl = data;
|
struct wayland *wayl = data;
|
||||||
struct terminal *term = wayl->moused;
|
struct terminal *term = wayl->moused;
|
||||||
assert(term != NULL);
|
|
||||||
|
|
||||||
|
/* Workaround buggy Sway 1.2 */
|
||||||
|
if (term == NULL) {
|
||||||
|
static bool have_warned = false;
|
||||||
|
if (!have_warned) {
|
||||||
|
have_warned = true;
|
||||||
|
LOG_WARN("compositor sent pointer_button event without first sending pointer_enter");
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
search_cancel(term);
|
search_cancel(term);
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue