Fix screenshot UI selection pointer clamping
Browse files at this commit77dafb819f03b803a31cb05cd16c61c2c0d518b3Parent: 1da99f41 changed file +6 -6
- src/input/mod.rs +6 -6
src/input/mod.rsmodified+6 -6
| @@ -1143,13 +1143,13 @@ impl State { | ||
| 1143 | 1143 | let geom = self.niri.global_space.output_geometry(output).unwrap(); |
| 1144 | 1144 | let mut point = (new_pos - geom.loc.to_f64()) |
| 1145 | 1145 | .to_physical(output.current_scale().fractional_scale()) |
| 1146 | - .to_i32_round(); | |
| 1146 | + .to_i32_round::<i32>(); | |
| 1147 | 1147 | |
| 1148 | 1148 | let size = output.current_mode().unwrap().size; |
| 1149 | 1149 | let transform = output.current_transform(); |
| 1150 | 1150 | 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); | |
| 1153 | 1153 | |
| 1154 | 1154 | self.niri.screenshot_ui.pointer_motion(point); |
| 1155 | 1155 | } |
| @@ -1242,13 +1242,13 @@ impl State { | ||
| 1242 | 1242 | let geom = self.niri.global_space.output_geometry(output).unwrap(); |
| 1243 | 1243 | let mut point = (pos - geom.loc.to_f64()) |
| 1244 | 1244 | .to_physical(output.current_scale().fractional_scale()) |
| 1245 | - .to_i32_round(); | |
| 1245 | + .to_i32_round::<i32>(); | |
| 1246 | 1246 | |
| 1247 | 1247 | let size = output.current_mode().unwrap().size; |
| 1248 | 1248 | let transform = output.current_transform(); |
| 1249 | 1249 | 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); | |
| 1252 | 1252 | |
| 1253 | 1253 | self.niri.screenshot_ui.pointer_motion(point); |
| 1254 | 1254 | } |