Don't add padding to layer-shell popups
Browse files at this commitb5640d5293ad8dca06cb447692ea7cbb21680eb1Parent: 860a08c1 changed file +16 -4
- src/handlers/xdg_shell.rs +16 -4
src/handlers/xdg_shell.rsmodified+16 -4
| @@ -1251,7 +1251,7 @@ impl State { | |||
| 1251 | let mut target = self.niri.layout.popup_target_rect(window); | 1251 | let mut target = self.niri.layout.popup_target_rect(window); |
| 1252 | target.loc -= get_popup_toplevel_coords(popup).to_f64(); | 1252 | target.loc -= get_popup_toplevel_coords(popup).to_f64(); |
| 1253 | 1253 | ||
| 1254 | - self.position_popup_within_rect(popup, target); | 1254 | + self.position_popup_within_rect(popup, target, true); |
| 1255 | } | 1255 | } |
| 1256 | 1256 | ||
| 1257 | pub fn unconstrain_layer_shell_popup( | 1257 | pub fn unconstrain_layer_shell_popup( |
| @@ -1285,14 +1285,26 @@ impl State { | |||
| 1285 | target.loc -= layer_geo.loc; | 1285 | target.loc -= layer_geo.loc; |
| 1286 | target.loc -= get_popup_toplevel_coords(popup); | 1286 | target.loc -= get_popup_toplevel_coords(popup); |
| 1287 | 1287 | ||
| 1288 | - self.position_popup_within_rect(popup, target.to_f64()); | 1288 | + // Don't add padding to layer-shell popups. It's not really needed, and it's unexpected. |
| 1289 | + self.position_popup_within_rect(popup, target.to_f64(), false); | ||
| 1289 | } | 1290 | } |
| 1290 | 1291 | ||
| 1291 | - fn position_popup_within_rect(&self, popup: &PopupKind, target: Rectangle<f64, Logical>) { | 1292 | + fn position_popup_within_rect( |
| 1293 | + &self, | ||
| 1294 | + popup: &PopupKind, | ||
| 1295 | + target: Rectangle<f64, Logical>, | ||
| 1296 | + padding: bool, | ||
| 1297 | + ) { | ||
| 1292 | match popup { | 1298 | match popup { |
| 1293 | PopupKind::Xdg(popup) => { | 1299 | PopupKind::Xdg(popup) => { |
| 1294 | popup.with_pending_state(|state| { | 1300 | popup.with_pending_state(|state| { |
| 1295 | - state.geometry = unconstrain_with_padding(state.positioner, target); | 1301 | + state.geometry = if padding { |
| 1302 | + unconstrain_with_padding(state.positioner, target) | ||
| 1303 | + } else { | ||
| 1304 | + state | ||
| 1305 | + .positioner | ||
| 1306 | + .get_unconstrained_geometry(target.to_i32_round()) | ||
| 1307 | + }; | ||
| 1296 | }); | 1308 | }); |
| 1297 | } | 1309 | } |
| 1298 | PopupKind::InputMethod(popup) => { | 1310 | PopupKind::InputMethod(popup) => { |