Follow window corner radius in insert hint
Browse files at this commitfce5d668783b4bbd5a6cea5e816d5d90a810d8e6Parent: 05d21813 changed files +16 -4
- src/layout/mod.rs +12 -1
- src/layout/tile.rs +1 -1
- src/layout/workspace.rs +3 -2
src/layout/mod.rsmodified+12 -1
| @@ -35,7 +35,8 @@ use std::rc::Rc; | |||
| 35 | use std::time::Duration; | 35 | use std::time::Duration; |
| 36 | 36 | ||
| 37 | use niri_config::{ | 37 | use niri_config::{ |
| 38 | - CenterFocusedColumn, Config, FloatOrInt, PresetSize, Struts, Workspace as WorkspaceConfig, | 38 | + CenterFocusedColumn, Config, CornerRadius, FloatOrInt, PresetSize, Struts, |
| 39 | + Workspace as WorkspaceConfig, | ||
| 39 | }; | 40 | }; |
| 40 | use niri_ipc::SizeChange; | 41 | use niri_ipc::SizeChange; |
| 41 | use smithay::backend::renderer::element::surface::WaylandSurfaceRenderElement; | 42 | use smithay::backend::renderer::element::surface::WaylandSurfaceRenderElement; |
| @@ -2260,10 +2261,20 @@ impl<W: LayoutElement> Layout<W> { | |||
| 2260 | .unwrap(); | 2261 | .unwrap(); |
| 2261 | 2262 | ||
| 2262 | let position = ws.get_insert_position(move_.pointer_pos_within_output - offset); | 2263 | let position = ws.get_insert_position(move_.pointer_pos_within_output - offset); |
| 2264 | + | ||
| 2265 | + let rules = move_.tile.window().rules(); | ||
| 2266 | + let border_width = move_.tile.effective_border_width().unwrap_or(0.); | ||
| 2267 | + let corner_radius = rules | ||
| 2268 | + .geometry_corner_radius | ||
| 2269 | + .map_or(CornerRadius::default(), |radius| { | ||
| 2270 | + radius.expanded_by(border_width as f32) | ||
| 2271 | + }); | ||
| 2272 | + | ||
| 2263 | ws.set_insert_hint(InsertHint { | 2273 | ws.set_insert_hint(InsertHint { |
| 2264 | position, | 2274 | position, |
| 2265 | width: move_.width, | 2275 | width: move_.width, |
| 2266 | is_full_width: move_.is_full_width, | 2276 | is_full_width: move_.is_full_width, |
| 2277 | + corner_radius, | ||
| 2267 | }); | 2278 | }); |
| 2268 | } | 2279 | } |
| 2269 | } | 2280 | } |
src/layout/tile.rsmodified+1 -1
| @@ -392,7 +392,7 @@ impl<W: LayoutElement> Tile<W> { | |||
| 392 | } | 392 | } |
| 393 | 393 | ||
| 394 | /// Returns `None` if the border is hidden and `Some(width)` if it should be shown. | 394 | /// Returns `None` if the border is hidden and `Some(width)` if it should be shown. |
| 395 | - fn effective_border_width(&self) -> Option<f64> { | 395 | + pub fn effective_border_width(&self) -> Option<f64> { |
| 396 | if self.is_fullscreen { | 396 | if self.is_fullscreen { |
| 397 | return None; | 397 | return None; |
| 398 | } | 398 | } |
src/layout/workspace.rsmodified+3 -2
| @@ -4,7 +4,7 @@ use std::rc::Rc; | |||
| 4 | use std::time::Duration; | 4 | use std::time::Duration; |
| 5 | 5 | ||
| 6 | use niri_config::{ | 6 | use niri_config::{ |
| 7 | - CenterFocusedColumn, OutputName, PresetSize, Struts, Workspace as WorkspaceConfig, | 7 | + CenterFocusedColumn, CornerRadius, OutputName, PresetSize, Struts, Workspace as WorkspaceConfig, |
| 8 | }; | 8 | }; |
| 9 | use niri_ipc::SizeChange; | 9 | use niri_ipc::SizeChange; |
| 10 | use ordered_float::NotNan; | 10 | use ordered_float::NotNan; |
| @@ -137,6 +137,7 @@ pub struct InsertHint { | |||
| 137 | pub position: InsertPosition, | 137 | pub position: InsertPosition, |
| 138 | pub width: ColumnWidth, | 138 | pub width: ColumnWidth, |
| 139 | pub is_full_width: bool, | 139 | pub is_full_width: bool, |
| 140 | + pub corner_radius: CornerRadius, | ||
| 140 | } | 141 | } |
| 141 | 142 | ||
| 142 | #[derive(Debug, Clone)] | 143 | #[derive(Debug, Clone)] |
| @@ -566,7 +567,7 @@ impl<W: LayoutElement> Workspace<W> { | |||
| 566 | self.insert_hint_element.update_render_elements( | 567 | self.insert_hint_element.update_render_elements( |
| 567 | area.size, | 568 | area.size, |
| 568 | view_rect, | 569 | view_rect, |
| 569 | - Default::default(), | 570 | + insert_hint.corner_radius, |
| 570 | self.scale.fractional_scale(), | 571 | self.scale.fractional_scale(), |
| 571 | ); | 572 | ); |
| 572 | } | 573 | } |