server: activate toplevels after mapping

This behavior was removed a while back, because we were also trying to activate
popups and this was causing issues on some compositors. However, I think
activating toplevels after they're mapped is the behavior that X11 apps tend to
expect - in Steam Big Picture for example, when launching a game in Niri while
fullscreened, the focus doesn't automatically switch to the game. This may need
to be reevaluated and refined in the future though.
This commit is contained in:
Shawn Wallace 2025-10-25 11:50:46 -04:00
parent 04816e2a36
commit 52cc06e6c6
2 changed files with 12 additions and 7 deletions

View file

@ -1471,8 +1471,10 @@ impl<S: X11Selection> Dispatch<XwaylandSurfaceV1, Entity> for InnerServerState<S
let win = data.get::<&x::Window>().as_deref().copied().unwrap();
state.windows.insert(win, *entity);
debug!("associate {surface_id} with {win:?} (serial {serial:?})");
if data.get::<&WindowData>().unwrap().mapped {
state.create_role_window(win, *entity);
if data.get::<&WindowData>().unwrap().mapped
&& state.create_role_window(win, *entity)
{
state.activate_window(win);
}
} else {
state.world.insert(*entity, (serial,)).unwrap();