forge
Explore
Log in

Don't you dare go Hollow

Fix screenshot UI selection pointer clamping

Browse files at this commit

77dafb819f03b803a31cb05cd16c61c2c0d518b3Ivan MolodetskikhParent: 1da99f4
src/input/mod.rsmodified+6 -6
@@ -1143,13 +1143,13 @@ impl State {
11431143 let geom = self.niri.global_space.output_geometry(output).unwrap();
11441144 let mut point = (new_pos - geom.loc.to_f64())
11451145 .to_physical(output.current_scale().fractional_scale())
1146- .to_i32_round();
1146+ .to_i32_round::<i32>();
11471147
11481148 let size = output.current_mode().unwrap().size;
11491149 let transform = output.current_transform();
11501150 let size = transform.transform_size(size);
1151- point.x = min(size.w - 1, point.x);
1152- point.y = min(size.h - 1, point.y);
1151+ point.x = point.x.clamp(0, size.w - 1);
1152+ point.y = point.y.clamp(0, size.h - 1);
11531153
11541154 self.niri.screenshot_ui.pointer_motion(point);
11551155 }
@@ -1242,13 +1242,13 @@ impl State {
12421242 let geom = self.niri.global_space.output_geometry(output).unwrap();
12431243 let mut point = (pos - geom.loc.to_f64())
12441244 .to_physical(output.current_scale().fractional_scale())
1245- .to_i32_round();
1245+ .to_i32_round::<i32>();
12461246
12471247 let size = output.current_mode().unwrap().size;
12481248 let transform = output.current_transform();
12491249 let size = transform.transform_size(size);
1250- point.x = min(size.w - 1, point.x);
1251- point.y = min(size.h - 1, point.y);
1250+ point.x = point.x.clamp(0, size.w - 1);
1251+ point.y = point.y.clamp(0, size.h - 1);
12521252
12531253 self.niri.screenshot_ui.pointer_motion(point);
12541254 }