diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-04-24 18:47:40 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-04-25 02:00:18 -0700 |
| commit | ef60dd81d7f72a7b452857be02bbed2a1ab6a60f (patch) | |
| tree | 0e5ff1767dc45e3352bc89c9e697ea025562e546 /src/layout/mod.rs | |
| parent | 7671a5d833a5de612247404b69a4583ef703ff42 (diff) | |
| download | niri-ef60dd81d7f72a7b452857be02bbed2a1ab6a60f.tar.gz niri-ef60dd81d7f72a7b452857be02bbed2a1ab6a60f.tar.bz2 niri-ef60dd81d7f72a7b452857be02bbed2a1ab6a60f.zip | |
layout/monitor: Cache scale, view_size, working_area
Diffstat (limited to 'src/layout/mod.rs')
| -rw-r--r-- | src/layout/mod.rs | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index d4de5693..ceed2f60 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -1432,19 +1432,12 @@ impl<W: LayoutElement> Layout<W> { pub fn update_output_size(&mut self, output: &Output) { let _span = tracy_client::span!("Layout::update_output_size"); - let MonitorSet::Normal { monitors, .. } = &mut self.monitor_set else { - panic!() + let Some(mon) = self.monitor_for_output_mut(output) else { + error!("monitor missing in update_output_size()"); + return; }; - for mon in monitors { - if &mon.output == output { - for ws in &mut mon.workspaces { - ws.update_output_size(); - } - - break; - } - } + mon.update_output_size(); } pub fn scroll_amount_to_activate(&self, window: &W::Id) -> f64 { @@ -2551,6 +2544,17 @@ impl<W: LayoutElement> Layout<W> { assert_eq!(self.clock, workspace.clock); assert_eq!( + monitor.scale().integer_scale(), + workspace.scale().integer_scale() + ); + assert_eq!( + monitor.scale().fractional_scale(), + workspace.scale().fractional_scale() + ); + assert_eq!(monitor.view_size(), workspace.view_size()); + assert_eq!(monitor.working_area(), workspace.working_area()); + + assert_eq!( workspace.base_options, self.options, "workspace options must be synchronized with layout" ); @@ -2602,7 +2606,7 @@ impl<W: LayoutElement> Layout<W> { saw_view_offset_gesture = has_view_offset_gesture; } - let scale = monitor.output.current_scale().fractional_scale(); + let scale = monitor.scale().fractional_scale(); let iter = monitor.workspaces_with_render_geo(); for (_ws, ws_geo) in iter { let pos = ws_geo.loc; |
