From e1dbaf43b19542bdc691a76083ef33c3e7e828a7 Mon Sep 17 00:00:00 2001 From: ShootingStarDragons Date: Mon, 7 Oct 2024 01:07:40 +0900 Subject: [PATCH] fix: should storage the scale when scale init --- layershellev/src/lib.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/layershellev/src/lib.rs b/layershellev/src/lib.rs index e2eeb1f..5e997fb 100644 --- a/layershellev/src/lib.rs +++ b/layershellev/src/lib.rs @@ -1675,20 +1675,16 @@ impl Dispatch for WindowStat _qhandle: &QueueHandle, ) { if let wp_fractional_scale_v1::Event::PreferredScale { scale } = event { - let Some(id) = state - .units - .iter() - .find(|info| { - info.fractional_scale - .as_ref() - .is_some_and(|fractional_scale| fractional_scale == proxy) - }) - .map(|unit| unit.id) - else { + let Some(unit) = state.units.iter_mut().find(|info| { + info.fractional_scale + .as_ref() + .is_some_and(|fractional_scale| fractional_scale == proxy) + }) else { return; }; + unit.scale = scale; state.message.push(( - Some(id), + Some(unit.id), DispatchMessageInner::PreferredScale { scale_u32: scale, scale_float: scale as f64 / 120.,