fix: set keyboard focus on touch target (similar to tablet/pointer)

This commit is contained in:
Hojjat 2026-09-03 21:36:24 -06:00 • committed by Victoria Brekenfeld
parent 467d1fbc7f
commit ed7814e51e

View file

@ -1471,11 +1471,18 @@ impl State {
};
let under = State::surface_under(position, &output, &shell)
.map(|(target, pos)| (target, pos.as_logical()));
let focus_target = State::element_under(position, &output, &shell, &seat);
std::mem::drop(shell);
let serial = SERIAL_COUNTER.next_serial();
let touch = seat.get_touch().unwrap();
// change the keyboard focus unless the touch is grabbed, like pointer buttons
if !touch.is_grabbed()
&& let Some(target) = focus_target.as_ref()
{
Shell::set_focus(self, Some(target), &seat, Some(serial), false);
}
touch.down(
self,
under,