mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-09 05:33:58 -04:00
wayland: globals: destroy: seat: use keyboard/pointer listener interfaces
This commit is contained in:
parent
b6342bb36d
commit
a6da07b3dd
1 changed files with 9 additions and 17 deletions
26
wayland.c
26
wayland.c
|
|
@ -859,27 +859,19 @@ handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
|
||||||
LOG_INFO("seat destroyed: %s", seat->name);
|
LOG_INFO("seat destroyed: %s", seat->name);
|
||||||
|
|
||||||
if (seat->kbd_focus != NULL) {
|
if (seat->kbd_focus != NULL) {
|
||||||
|
LOG_WARN("compositor destroyed seat '%s' "
|
||||||
|
"without sending keyboard/pointer leave events",
|
||||||
|
seat->name);
|
||||||
|
|
||||||
struct terminal *term = seat->kbd_focus;
|
struct terminal *term = seat->kbd_focus;
|
||||||
|
|
||||||
/* Clear this seat's focus */
|
if (seat->wl_keyboard != NULL)
|
||||||
seat->kbd_focus = NULL;
|
keyboard_listener.leave(
|
||||||
|
seat, seat->wl_keyboard, -1, term->window->surface);
|
||||||
|
|
||||||
/* Check if term is focused by *another* seat */
|
if (seat->wl_pointer != NULL)
|
||||||
bool term_has_other_focus = false;
|
pointer_listener.leave(
|
||||||
tll_foreach(wayl->seats, s) {
|
seat, seat->wl_pointer, -1, term->window->surface);
|
||||||
if (&s->item == seat)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (s->item.kbd_focus == term) {
|
|
||||||
term_has_other_focus = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* No other seat has it focused - tell it it was unfocused */
|
|
||||||
if (!term_has_other_focus)
|
|
||||||
term_kbd_focus_out(term);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
seat_destroy(seat);
|
seat_destroy(seat);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue