focus: Don't consider XWaylandGrab exclusive

This commit is contained in:
Victoria Brekenfeld 2025-08-15 13:14:13 +02:00 committed by Victoria Brekenfeld
parent 4209e61c48
commit b28f92a6e1
6 changed files with 36 additions and 61 deletions

View file

@ -435,6 +435,14 @@ impl Common {
.cloned()
.collect::<Vec<_>>();
for seat in &seats {
let mut xwayland_grab = seat
.user_data()
.get_or_insert(XWaylandGrabSeatData::default)
.grab
.lock()
.unwrap();
xwayland_grab.take_if(|(surface, g)| !g.grab().is_alive() || !surface.alive());
{
let shell = state.common.shell.read();
let focused_output = seat.focused_output();
@ -559,18 +567,6 @@ fn focus_target_is_valid(
return matches!(target, KeyboardFocusTarget::LockSurface(_));
}
let xwayland_grab = seat
.user_data()
.get_or_insert(XWaylandGrabSeatData::default)
.grab
.lock()
.unwrap();
if let Some((surface, grab)) = &*xwayland_grab {
if grab.grab().is_alive() {
return target == KeyboardFocusTarget::XWaylandGrab(surface.clone());
}
}
// If an exclusive layer shell surface exists (on any output), only exclusive
// shell surfaces can have focus, on the highest layer with exclusive surfaces.
if let Some(layer) = exclusive_layer_surface_layer(shell) {
@ -632,7 +628,6 @@ fn focus_target_is_valid(
}
KeyboardFocusTarget::Popup(_) => true,
KeyboardFocusTarget::LockSurface(_) => false,
KeyboardFocusTarget::XWaylandGrab(_) => false,
}
}
@ -641,21 +636,12 @@ fn update_focus_target(
seat: &Seat<State>,
output: &Output,
) -> Option<KeyboardFocusTarget> {
let mut xwayland_grab = seat
.user_data()
.get_or_insert(XWaylandGrabSeatData::default)
.grab
.lock()
.unwrap();
xwayland_grab.take_if(|(_, g)| !g.grab().is_alive());
if let Some(session_lock) = &shell.session_lock {
session_lock
.surfaces
.get(output)
.cloned()
.map(KeyboardFocusTarget::from)
} else if let Some((surface, _)) = &*xwayland_grab {
Some(KeyboardFocusTarget::XWaylandGrab(surface.clone()))
} else if let Some(layer) = exclusive_layer_surface_layer(shell) {
layer_map_for_output(output)
.layers()