forge
Explore
Log in

Don't you dare go Hollow

Compute exclusive layer-shell focus in render order

Browse files at this commit

e5b0c1a8d430ed061ab472f4172b38a6cc961405Ivan MolodetskikhParent: ee8a04b
Before, with two surfaces, the one below would keep keyboard focus
instead of the one on top. This is weird and also inconsistent with
pointer focus.

The on-demand change doesn't affect the logic but is good for
consistency to avoid mistakes going forward.
src/niri.rsmodified+2 -2
@@ -1297,7 +1297,7 @@ impl State {
1297 };1297 };
1298 1298
1299 let excl_focus_on_layer = |layer| {1299 let excl_focus_on_layer = |layer| {
1300- layers.layers_on(layer).find_map(|surface| {1300+ layers.layers_on(layer).rev().find_map(|surface| {
1301 if surface.cached_state().keyboard_interactivity1301 if surface.cached_state().keyboard_interactivity
1302 != wlr_layer::KeyboardInteractivity::Exclusive1302 != wlr_layer::KeyboardInteractivity::Exclusive
1303 {1303 {
@@ -1315,7 +1315,7 @@ impl State {
1315 };1315 };
1316 1316
1317 let on_d_focus_on_layer = |layer| {1317 let on_d_focus_on_layer = |layer| {
1318- layers.layers_on(layer).find_map(|surface| {1318+ layers.layers_on(layer).rev().find_map(|surface| {
1319 let is_on_demand_surface =1319 let is_on_demand_surface =
1320 Some(surface) == self.niri.layer_shell_on_demand_focus.as_ref();1320 Some(surface) == self.niri.layer_shell_on_demand_focus.as_ref();
1321 is_on_demand_surface1321 is_on_demand_surface