forge
Explore
Log in

Don't you dare go Hollow

Extract mapped_hit_data()

Browse files at this commit

25f24f668cf4ebdaa6a886e1eaed7cab3c8f1483Ivan MolodetskikhParent: 929eaf0
src/niri.rsmodified+19 -17
@@ -2990,26 +2990,28 @@ impl Niri {
2990 let layer_toplevel_under = |layer| layer_surface_under(layer, false);2990 let layer_toplevel_under = |layer| layer_surface_under(layer, false);
2991 let layer_popup_under = |layer| layer_surface_under(layer, true);2991 let layer_popup_under = |layer| layer_surface_under(layer, true);
2992 2992
2993+ let mapped_hit_data = |(mapped, hit): (&Mapped, HitType)| {
2994+ let window = &mapped.window;
2995+ let surface_and_pos = if let HitType::Input { win_pos } = hit {
2996+ let win_pos_within_output = win_pos;
2997+ window
2998+ .surface_under(
2999+ pos_within_output - win_pos_within_output,
3000+ WindowSurfaceType::ALL,
3001+ )
3002+ .map(|(s, pos_within_window)| {
3003+ (s, pos_within_window.to_f64() + win_pos_within_output)
3004+ })
3005+ } else {
3006+ None
3007+ };
3008+ (surface_and_pos, (Some((window.clone(), hit)), None))
3009+ };
3010+
2993 let window_under = || {3011 let window_under = || {
2994 self.layout3012 self.layout
2995 .window_under(output, pos_within_output)3013 .window_under(output, pos_within_output)
2996- .map(|(mapped, hit)| {3014+ .map(mapped_hit_data)
2997- let window = &mapped.window;
2998- let surface_and_pos = if let HitType::Input { win_pos } = hit {
2999- let win_pos_within_output = win_pos;
3000- window
3001- .surface_under(
3002- pos_within_output - win_pos_within_output,
3003- WindowSurfaceType::ALL,
3004- )
3005- .map(|(s, pos_within_window)| {
3006- (s, pos_within_window.to_f64() + win_pos_within_output)
3007- })
3008- } else {
3009- None
3010- };
3011- (surface_and_pos, (Some((window.clone(), hit)), None))
3012- })
3013 };3015 };
3014 3016
3015 let mon = self.layout.monitor_for_output(output).unwrap();3017 let mon = self.layout.monitor_for_output(output).unwrap();